diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 02:57:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 02:57:13 +0800 |
commit | 838ce36fdd7abdff0b4cab5e67c2500325178805 (patch) | |
tree | bffd74f604cbcf666ca5d41d1c9f5750e48e1db9 /script/provider/diagnostic.lua | |
parent | 0ff98557a45c25d7a49520e57f49561a62300f35 (diff) | |
download | lua-language-server-838ce36fdd7abdff0b4cab5e67c2500325178805.zip |
update
Diffstat (limited to 'script/provider/diagnostic.lua')
-rw-r--r-- | script/provider/diagnostic.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 23dad33d..4c94c952 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -32,6 +32,9 @@ end local function buildSyntaxError(uri, err) local text = files.getText(uri) + if not text then + return + end local message = lang.script('PARSER_' .. err.type, err.info) if err.version then @@ -83,10 +86,14 @@ local function buildDiagnostic(uri, diag) relatedInformation = {} for _, rel in ipairs(diag.related) do local rtext = files.getText(rel.uri) + if not rtext then + goto CONTINUE + end relatedInformation[#relatedInformation+1] = { message = rel.message or rtext:sub(rel.start, rel.finish), location = converter.location(rel.uri, converter.packRange(rel.uri, rel.start, rel.finish)) } + ::CONTINUE:: end end |