summaryrefslogtreecommitdiff
path: root/script/provider/provider.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-12-16 19:21:19 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-12-16 19:21:19 +0800
commit00be6b2734c3fa59fbf8a2ac253f9c9465d3f1a1 (patch)
tree288ef1cae51a230343dfe6d92ddd64f657188fda /script/provider/provider.lua
parent37a0d728ffdccfb0ab40017e43984fb82276de1d (diff)
downloadlua-language-server-00be6b2734c3fa59fbf8a2ac253f9c9465d3f1a1.zip
set text after ready
Diffstat (limited to 'script/provider/provider.lua')
-rw-r--r--script/provider/provider.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 319d00a9..a01b5d10 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -261,6 +261,7 @@ m.register 'workspace/didChangeWorkspaceFolders' {
}
m.register 'textDocument/didOpen' {
+ ---@async
function (params)
local doc = params.textDocument
local scheme = furi.split(doc.uri)
@@ -270,6 +271,7 @@ m.register 'textDocument/didOpen' {
end
local uri = files.getRealUri(doc.uri)
log.debug('didOpen', uri)
+ workspace.awaitReady(uri)
local text = doc.text
files.setText(uri, text, true, function (file)
file.version = doc.version
@@ -301,6 +303,7 @@ m.register 'textDocument/didChange' {
end
local changes = params.contentChanges
local uri = files.getRealUri(doc.uri)
+ workspace.awaitReady(uri)
local text = files.getOriginText(uri)
if not text then
files.setText(uri, pub.awaitTask('loadFile', furi.decode(uri)), false)