summaryrefslogtreecommitdiff
path: root/script/files.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-03-01 17:14:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-03-01 17:14:57 +0800
commitd6a09457eefdb44425f99ac4d5ffcaa2c1b7b685 (patch)
treed41ab233813660ff72d5ed9f0cde7d5e9254673f /script/files.lua
parentda4ddec0289d7d72ce53816259cbfb0069353ab1 (diff)
downloadlua-language-server-d6a09457eefdb44425f99ac4d5ffcaa2c1b7b685.zip
improve delay of completion
Diffstat (limited to 'script/files.lua')
-rw-r--r--script/files.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/script/files.lua b/script/files.lua
index 220a2ee2..ed9fd880 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -182,6 +182,7 @@ function m.setText(uri, text, isTrust)
file.version = file.version + 1
m.globalVersion = m.globalVersion + 1
await.close('files.version')
+ await.close('compile:' .. uri)
if create then
m.onWatch('create', originUri)
end
@@ -346,6 +347,7 @@ function m.eachDll()
end
function m.compileAst(uri, text)
+ await.setID('compile:' .. uri)
local ws = require 'workspace'
if not m.isOpen(uri) and #text >= config.config.workspace.preloadFileSize * 1000 then
if not m.notifyCache['preloadFileSize'] then
@@ -378,12 +380,14 @@ function m.compileAst(uri, text)
special = config.config.runtime.special,
unicodeName = config.config.runtime.unicodeName,
nonstandardSymbol = config.config.runtime.nonstandardSymbol,
+ delay = await.delay,
}
)
local passed = os.clock() - clock
if passed > 0.1 then
log.warn(('Compile [%s] takes [%.3f] sec, size [%.3f] kb.'):format(uri, passed, #text / 1000))
end
+ await.delay()
if state then
state.uri = uri
state.ast.uri = uri