diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-27 18:20:31 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-27 18:20:31 +0800 |
commit | c8fbfd0f9db355ebfc9a3dd84b7553b30c2a1dc6 (patch) | |
tree | 121988970394f99eafc9804c5f10087499596e76 /server/src | |
parent | ffbff19e45c6f41fd6dba9f0baec0eda45b6f05b (diff) | |
download | lua-language-server-c8fbfd0f9db355ebfc9a3dd84b7553b30c2a1dc6.zip |
改进
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/method/textDocument/publishDiagnostics.lua | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/server/src/method/textDocument/publishDiagnostics.lua b/server/src/method/textDocument/publishDiagnostics.lua index 1186374d..552a4ca7 100644 --- a/server/src/method/textDocument/publishDiagnostics.lua +++ b/server/src/method/textDocument/publishDiagnostics.lua @@ -1,4 +1,5 @@ local matcher = require 'matcher' +local lang = require 'language' local DiagnosticSeverity = { Error = 1, @@ -78,15 +79,25 @@ end local function buildError(err, lines) local diagnostic = { source = 'Lua Language Server', - message = 'Error', + message = lang.script.PARSER_IN_DEVELOPMENT, } if err.level == 'error' then diagnostic.severity = DiagnosticSeverity.Error else diagnostic.severity = DiagnosticSeverity.Warning end - local range = getRange(err.pos, err.pos, lines) - range['end'].character = 9999 + local row, col = lines:rowcol(err.pos) + local _, max = lines:range(row) + local range = { + start = { + line = row - 1, + character = col - 1, + }, + ['end'] = { + line = row - 1, + character = max, + }, + } diagnostic.range = range return diagnostic end |