diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-16 15:39:38 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-16 15:39:38 +0800 |
commit | 5f48be0b6f61a83dd898687db468a9011313e8de (patch) | |
tree | 8acc98cce587ee3e0235ff641855c73b4bfc2257 /script | |
parent | 073afa589be41900e4881d755ba663d8718fffec (diff) | |
download | lua-language-server-5f48be0b6f61a83dd898687db468a9011313e8de.zip |
fix #1217
Diffstat (limited to 'script')
-rw-r--r-- | script/provider/provider.lua | 7 |
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) |