summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-16 15:39:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-16 15:39:38 +0800
commit5f48be0b6f61a83dd898687db468a9011313e8de (patch)
tree8acc98cce587ee3e0235ff641855c73b4bfc2257 /script
parent073afa589be41900e4881d755ba663d8718fffec (diff)
downloadlua-language-server-5f48be0b6f61a83dd898687db468a9011313e8de.zip
fix #1217
Diffstat (limited to 'script')
-rw-r--r--script/provider/provider.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 2943c77e..f23f1856 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -265,6 +265,7 @@ m.register 'textDocument/didClose' {
}
m.register 'textDocument/didChange' {
+ ---@async
function (params)
local doc = params.textDocument
local scheme = furi.split(doc.uri)
@@ -274,7 +275,11 @@ m.register 'textDocument/didChange' {
end
local changes = params.contentChanges
local uri = files.getRealUri(doc.uri)
- local text = files.getOriginText(uri) or ''
+ local text = files.getOriginText(uri)
+ if not text then
+ files.setText(uri, pub.awaitTask('loadFile', furi.decode(uri)), false)
+ return
+ end
local rows = files.getCachedRows(uri)
text, rows = tm(text, rows, changes)
files.setText(uri, text, true, function (file)