diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-01 17:14:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-01 17:14:57 +0800 |
commit | d6a09457eefdb44425f99ac4d5ffcaa2c1b7b685 (patch) | |
tree | d41ab233813660ff72d5ed9f0cde7d5e9254673f /script/files.lua | |
parent | da4ddec0289d7d72ce53816259cbfb0069353ab1 (diff) | |
download | lua-language-server-d6a09457eefdb44425f99ac4d5ffcaa2c1b7b685.zip |
improve delay of completion
Diffstat (limited to 'script/files.lua')
-rw-r--r-- | script/files.lua | 4 |
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 |