summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/spell-check.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-17 16:38:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-17 16:38:44 +0800
commitbfb576d3eba9f12bb582a9f7e942c5eac387fe2b (patch)
treed5e3790aeca21994d4b9558453f40657383fcf63 /script/core/diagnostics/spell-check.lua
parent3bdd74aa30a6175f1bbf973559241f99eb563dfe (diff)
downloadlua-language-server-bfb576d3eba9f12bb582a9f7e942c5eac387fe2b.zip
use `state` instead of `uri` for converter
The state may have changed when responding, so we need to use the state when requesting. Try not to get the state on the spot.
Diffstat (limited to 'script/core/diagnostics/spell-check.lua')
-rw-r--r--script/core/diagnostics/spell-check.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/script/core/diagnostics/spell-check.lua b/script/core/diagnostics/spell-check.lua
index 7369a235..a4cb87be 100644
--- a/script/core/diagnostics/spell-check.lua
+++ b/script/core/diagnostics/spell-check.lua
@@ -6,10 +6,11 @@ local spell = require 'provider.spell'
---@async
return function(uri, callback)
- local text = files.getOriginText(uri)
- if not text then
+ local state = files.getState(uri)
+ if not state then
return
end
+ local text = state.originText
local status, diagnosticInfos = spell.spellCheck(uri, text)
@@ -24,8 +25,8 @@ return function(uri, callback)
if diagnosticInfos then
for _, diagnosticInfo in ipairs(diagnosticInfos) do
callback {
- start = converter.unpackPosition(uri, diagnosticInfo.range.start),
- finish = converter.unpackPosition(uri, diagnosticInfo.range["end"]),
+ start = converter.unpackPosition(state, diagnosticInfo.range.start),
+ finish = converter.unpackPosition(state, diagnosticInfo.range["end"]),
message = diagnosticInfo.message,
data = diagnosticInfo.data
}