From 1b465b38a3a6dd90f05cf96f2fbb8d201ca2ea60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 27 Dec 2018 18:23:33 +0800 Subject: =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/matcher/diagnostics.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'server/src/matcher') 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) -- cgit v1.2.3