summaryrefslogtreecommitdiff
path: root/server/src/method/textDocument/publishDiagnostics.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/method/textDocument/publishDiagnostics.lua')
-rw-r--r--server/src/method/textDocument/publishDiagnostics.lua17
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