diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-03-01 15:06:06 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-03-01 15:06:06 +0800 |
commit | 6a02e5c4b0c3bebf009fe4c455fe6b0f36cd7a52 (patch) | |
tree | ae067311c363568f7a4301a7d09d7659a51498e1 | |
parent | 9898f87795b5c3cf096197c6f9c92e368addb2a3 (diff) | |
download | lua-language-server-6a02e5c4b0c3bebf009fe4c455fe6b0f36cd7a52.zip |
completion delays for 10 ms
-rw-r--r-- | script/core/completion.lua | 8 | ||||
-rw-r--r-- | script/provider/provider.lua | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index 3add81e3..96115471 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -1827,15 +1827,19 @@ local function clearCache() end local function completion(uri, offset) + tracy.ZoneBeginN 'completion cache' local results = getCache(uri, offset) + tracy.ZoneEnd() if results then return results end + tracy.ZoneBeginN 'completion #1' local ast = files.getAst(uri) local text = files.getText(uri) results = {} clearStack() - tracy.ZoneBeginN 'completion' + tracy.ZoneEnd() + tracy.ZoneBeginN 'completion #2' if ast then if getComment(ast, offset) then tryLuaDoc(ast, text, offset, results) @@ -1860,7 +1864,9 @@ local function completion(uri, offset) return nil end + tracy.ZoneBeginN 'completion #3' makeCache(uri, offset, results) + tracy.ZoneEnd() return results end diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 3fe7e691..9b43a4a2 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -429,8 +429,11 @@ proto.on('textDocument/prepareRename', function (params) placeholder = result.text, } end) - +require 'tracy'.enable() proto.on('textDocument/completion', function (params) + await.close('completion') + await.setID('completion') + await.sleep(0.01) workspace.awaitReady() local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_COMPLETION, 0.5) --log.info(util.dump(params)) @@ -452,6 +455,8 @@ proto.on('textDocument/completion', function (params) if not result then return nil end + tracy.ZoneBeginN 'completion make' + local _ <close> = tracy.ZoneEnd local easy = false local items = {} for i, res in ipairs(result) do |