summaryrefslogtreecommitdiff
path: root/script/provider/diagnostic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/provider/diagnostic.lua')
-rw-r--r--script/provider/diagnostic.lua33
1 files changed, 17 insertions, 16 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index db377ea0..382b73d9 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -1,14 +1,15 @@
-local await = require 'await'
-local proto = require 'proto.proto'
-local define = require 'proto.define'
-local lang = require 'language'
-local files = require 'files'
-local config = require 'config'
-local core = require 'core.diagnostics'
-local util = require 'utility'
-local ws = require 'workspace'
-local progress = require "progress"
-local client = require 'client'
+local await = require 'await'
+local proto = require 'proto.proto'
+local define = require 'proto.define'
+local lang = require 'language'
+local files = require 'files'
+local config = require 'config'
+local core = require 'core.diagnostics'
+local util = require 'utility'
+local ws = require 'workspace'
+local progress = require "progress"
+local client = require 'client'
+local converter = require 'proto.converter'
local m = {}
m._start = false
@@ -45,17 +46,17 @@ local function buildSyntaxError(uri, err)
else
rmessage = text:sub(rel.start, rel.finish)
end
- local relUri = rel.uri
+ local relUri = rel.uri or uri
relatedInformation[#relatedInformation+1] = {
message = rmessage,
- location = define.location(relUri, files.range(relUri, rel.start, rel.finish)),
+ location = converter.location(relUri, converter.packRange(relUri, rel.start, rel.finish)),
}
end
end
return {
code = err.type:lower():gsub('_', '-'),
- range = files.range(uri, err.start, err.finish),
+ range = converter.packRange(uri, err.start, err.finish),
severity = define.DiagnosticSeverity.Error,
source = lang.script.DIAG_SYNTAX_CHECK,
message = message,
@@ -75,13 +76,13 @@ local function buildDiagnostic(uri, diag)
local rtext = files.getText(rel.uri)
relatedInformation[#relatedInformation+1] = {
message = rel.message or rtext:sub(rel.start, rel.finish),
- location = define.location(rel.uri, files.range(rel.uri, rel.start, rel.finish))
+ location = converter.location(rel.uri, converter.packRange(rel.uri, rel.start, rel.finish))
}
end
end
return {
- range = files.range(uri, diag.start, diag.finish),
+ range = converter.packRange(uri, diag.start, diag.finish),
source = lang.script.DIAG_DIAGNOSTICS,
severity = diag.level,
message = diag.message,