summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-12-01 16:51:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-12-01 16:51:44 +0800
commit75352f3809bfb34056c682e057d301a1f8b38309 (patch)
tree1203b29ea66cfc4d36a70e47ed3e3d6efbe6049c /script/provider
parentfb9dc04fc284843c021c4dc912a0a1b01cb0b6a9 (diff)
downloadlua-language-server-75352f3809bfb34056c682e057d301a1f8b38309.zip
fix #837
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/diagnostic.lua5
-rw-r--r--script/provider/provider.lua5
2 files changed, 4 insertions, 6 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index ca4bcdb8..e90d8afb 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -223,8 +223,6 @@ function m.doDiagnostic(uri)
local version = files.getVersion(uri)
- await.setID('diag:' .. uri)
-
local prog <close> = progress.create(lang.script.WINDOW_DIAGNOSING, 0.5)
prog:setMessage(ws.getRelativePath(uri))
@@ -277,8 +275,9 @@ function m.refresh(uri)
end
await.close('diag:' .. uri)
await.call(function () ---@async
- await.delay()
if uri then
+ await.setID('diag:' .. uri)
+ await.sleep(0.1)
m.clearCache(uri)
xpcall(m.doDiagnostic, log.error, uri)
end
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 7f025f78..8e64f5d3 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -210,8 +210,7 @@ m.register 'textDocument/didOpen' {
local doc = params.textDocument
local uri = files.getRealUri(doc.uri)
local text = doc.text
- log.debug('didOpen', uri)
- files.setText(uri, text, true)
+ files.setText(uri, text, true, doc.version)
files.open(uri)
end
}
@@ -239,7 +238,7 @@ m.register 'textDocument/didChange' {
local text = files.getOriginText(uri) or ''
local rows = files.getCachedRows(uri)
text, rows = tm(text, rows, changes)
- files.setText(uri, text, true)
+ files.setText(uri, text, true, doc.version)
files.setCachedRows(uri, rows)
end
}