diff options
author | CppCXY <812125110@qq.com> | 2023-04-26 20:50:43 +0800 |
---|---|---|
committer | CppCXY <812125110@qq.com> | 2023-04-26 20:50:43 +0800 |
commit | f6e103f10acd4b20fd73cd7a5b9b76fa0a676810 (patch) | |
tree | 6d5958fb51aaf543b72790c0610d05a26ee01ff9 /script/core | |
parent | 19906a977c517b1e6edfd3ada60e20b2f9179e43 (diff) | |
download | lua-language-server-f6e103f10acd4b20fd73cd7a5b9b76fa0a676810.zip |
complete namestyle provider
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/diagnostics/name-style.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/script/core/diagnostics/name-style.lua b/script/core/diagnostics/name-style.lua new file mode 100644 index 00000000..4bdb068f --- /dev/null +++ b/script/core/diagnostics/name-style.lua @@ -0,0 +1,35 @@ +local files = require 'files' +local converter = require 'proto.converter' +local log = require 'log' +local nameStyle = require 'provider.name-style' + + +---@async +return function (uri, callback) + local state = files.getState(uri) + if not state then + return + end + local text = state.originText + + local status, diagnosticInfos = nameStyle.nameStyleCheck(uri, text) + + if not status then + if diagnosticInfos ~= nil then + log.error(diagnosticInfos) + end + + return + end + + if diagnosticInfos then + for _, diagnosticInfo in ipairs(diagnosticInfos) do + callback { + start = converter.unpackPosition(state, diagnosticInfo.range.start), + finish = converter.unpackPosition(state, diagnosticInfo.range["end"]), + message = diagnosticInfo.message, + data = diagnosticInfo.data + } + end + end +end |