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/core/diagnostics | |
parent | 0ff98557a45c25d7a49520e57f49561a62300f35 (diff) | |
download | lua-language-server-838ce36fdd7abdff0b4cab5e67c2500325178805.zip |
update
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r-- | script/core/diagnostics/ambiguity-1.lua | 4 | ||||
-rw-r--r-- | script/core/diagnostics/newfield-call.lua | 8 | ||||
-rw-r--r-- | script/core/diagnostics/newline-call.lua | 2 | ||||
-rw-r--r-- | script/core/diagnostics/trailing-space.lua | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/script/core/diagnostics/ambiguity-1.lua b/script/core/diagnostics/ambiguity-1.lua index f03f4361..830b2f2f 100644 --- a/script/core/diagnostics/ambiguity-1.lua +++ b/script/core/diagnostics/ambiguity-1.lua @@ -27,10 +27,10 @@ local literalMap = { return function (uri, callback) local state = files.getState(uri) - if not state then + local text = files.getText(uri) + if not state or not text then return end - local text = files.getText(uri) guide.eachSourceType(state.ast, 'binary', function (source) if source.op.type ~= 'or' then return diff --git a/script/core/diagnostics/newfield-call.lua b/script/core/diagnostics/newfield-call.lua index 669ed2bb..b81d8c0a 100644 --- a/script/core/diagnostics/newfield-call.lua +++ b/script/core/diagnostics/newfield-call.lua @@ -3,14 +3,14 @@ local guide = require 'parser.guide' local lang = require 'language' return function (uri, callback) - local ast = files.getState(uri) - if not ast then + local state = files.getState(uri) + local text = files.getText(uri) + if not state or not text then return end - local text = files.getText(uri) - guide.eachSourceType(ast.ast, 'table', function (source) + guide.eachSourceType(state.ast, 'table', function (source) for i = 1, #source do local field = source[i] if field.type ~= 'tableexp' then diff --git a/script/core/diagnostics/newline-call.lua b/script/core/diagnostics/newline-call.lua index 3f2d5ca5..9c526980 100644 --- a/script/core/diagnostics/newline-call.lua +++ b/script/core/diagnostics/newline-call.lua @@ -5,7 +5,7 @@ local lang = require 'language' return function (uri, callback) local state = files.getState(uri) local text = files.getText(uri) - if not state then + if not state or not text then return end diff --git a/script/core/diagnostics/trailing-space.lua b/script/core/diagnostics/trailing-space.lua index cc51cf77..d23b0692 100644 --- a/script/core/diagnostics/trailing-space.lua +++ b/script/core/diagnostics/trailing-space.lua @@ -14,10 +14,10 @@ end return function (uri, callback) local state = files.getState(uri) - if not state then + local text = files.getText(uri) + if not state or not text then return end - local text = files.getText(uri) local lines = state.lines for i = 0, #lines do local startOffset = lines[i] |