diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-27 18:23:33 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-27 18:23:33 +0800 |
commit | 1b465b38a3a6dd90f05cf96f2fbb8d201ca2ea60 (patch) | |
tree | b55b19aae07ba0d082b3e3a75e6bc952a60149d1 /server/src/matcher | |
parent | c8fbfd0f9db355ebfc9a3dd84b7553b30c2a1dc6 (diff) | |
download | lua-language-server-1b465b38a3a6dd90f05cf96f2fbb8d201ca2ea60.zip |
整理代码
Diffstat (limited to 'server/src/matcher')
-rw-r--r-- | server/src/matcher/diagnostics.lua | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/server/src/matcher/diagnostics.lua b/server/src/matcher/diagnostics.lua index 584a0cb5..a6672c0b 100644 --- a/server/src/matcher/diagnostics.lua +++ b/server/src/matcher/diagnostics.lua @@ -1,5 +1,12 @@ local lang = require 'language' +local DiagnosticSeverity = { + Error = 1, + Warning = 2, + Information = 3, + Hint = 4, +} + local function searchUnusedLocals(results, callback) for _, var in ipairs(results.locals) do if var.key == 'self' @@ -199,7 +206,7 @@ return function (vm, lines, uri) datas[#datas+1] = { start = start, finish = finish, - level = 'Information', + level = DiagnosticSeverity.Information, message = lang.script('DIAG_UNUSED_LOCAL', key), } end) @@ -208,7 +215,7 @@ return function (vm, lines, uri) datas[#datas+1] = { start = start, finish = finish, - level = 'Warning', + level = DiagnosticSeverity.Warning, message = lang.script('DIAG_UNDEFINED_GLOBAL', key), } end) @@ -217,7 +224,7 @@ return function (vm, lines, uri) datas[#datas+1] = { start = start, finish = finish, - level = 'Information', + level =DiagnosticSeverity.Information, message = lang.script('DIAG_UNUSED_LABEL', key) } end) @@ -226,7 +233,7 @@ return function (vm, lines, uri) datas[#datas+1] = { start = start, finish = finish, - level = 'Information', + level = DiagnosticSeverity.Information, message = message, } end) @@ -235,7 +242,7 @@ return function (vm, lines, uri) datas[#datas+1] = { start = start, finish = finish, - level = 'Information', + level = DiagnosticSeverity.Information, message = lang.script('DIAG_REDEFINED_LOCAL', key), related = related, } @@ -245,7 +252,7 @@ return function (vm, lines, uri) datas[#datas+1] = { start = start, finish = finish, - level = 'Warning', + level = DiagnosticSeverity.Information, message = lang.script.DIAG_PREVIOUS_CALL, } end) @@ -254,7 +261,7 @@ return function (vm, lines, uri) datas[#datas+1] = { start = start, finish = finish, - level = 'Warning', + level = DiagnosticSeverity.Warning, message = lang.script('DIAG_OVER_MAX_ARGS', max, passed), } end) |