diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-29 13:33:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-29 13:33:00 +0800 |
commit | 25f2563cda4381760d69010bdab2313551cb7e10 (patch) | |
tree | 0611e1eb7881bd6c6b3387eacb87c81296fa2090 /server/src/method/textDocument/publishDiagnostics.lua | |
parent | ea45861759cb00143552a7469fdc7a0b48cb7225 (diff) | |
download | lua-language-server-25f2563cda4381760d69010bdab2313551cb7e10.zip |
更新语法检查
Diffstat (limited to 'server/src/method/textDocument/publishDiagnostics.lua')
-rw-r--r-- | server/src/method/textDocument/publishDiagnostics.lua | 21 |
1 files changed, 14 insertions, 7 deletions
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 |