From 25f2563cda4381760d69010bdab2313551cb7e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sat, 29 Dec 2018 13:33:00 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=AD=E6=B3=95=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/method/textDocument/publishDiagnostics.lua | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'server/src/method/textDocument/publishDiagnostics.lua') diff --git a/server/src/method/textDocument/publishDiagnostics.lua b/server/src/method/textDocument/publishDiagnostics.lua index e5c8b2ff..6e2f437a 100644 --- a/server/src/method/textDocument/publishDiagnostics.lua +++ b/server/src/method/textDocument/publishDiagnostics.lua @@ -79,23 +79,30 @@ end local function buildError(err, lines) local diagnostic = { source = 'Lua Language Server', - message = lang.script.PARSER_IN_DEVELOPMENT, + message = lang.script('PARSER_'..err.type, err.info) } if err.level == 'error' then diagnostic.severity = DiagnosticSeverity.Error else diagnostic.severity = DiagnosticSeverity.Warning end - local row, col = lines:rowcol(err.pos) - local _, max = lines:range(row) + local startrow, startcol = lines:rowcol(err.start) + local endrow, endcol + if err.finish then + endrow, endcol = lines:rowcol(err.finish) + else + endrow = startrow + local _, max = lines:range(endrow) + endcol = max + end local range = { start = { - line = row - 1, - character = col - 1, + line = startrow - 1, + character = startcol - 1, }, ['end'] = { - line = row - 1, - character = max, + line = endrow - 1, + character = endcol, }, } diagnostic.range = range -- cgit v1.2.3