diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 18:08:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-27 18:08:00 +0800 |
commit | 8f206cfde9e41902bcf3f5314d9684d7d6cdbb29 (patch) | |
tree | 0ea290f6e8eacd94faee34ce6a830e50d78a0e2e /script/provider | |
parent | 922ddb3ecabd4533b924792b0ffbfbf4d70de0a5 (diff) | |
download | lua-language-server-8f206cfde9e41902bcf3f5314d9684d7d6cdbb29.zip |
move cache into core
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/provider.lua | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 8ba5bb1c..47fe457f 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -361,26 +361,17 @@ proto.on('textDocument/completion', function (params) --log.debug('completion:', params.context and params.context.triggerKind, params.context and params.context.triggerCharacter) local uri = params.textDocument.uri if not files.exists(uri) then - core.makeCache(nil) return nil end - local offset = files.offset(uri, params.position) - local cache = core.getCache(uri, offset) - if cache then - return { - isIncomplete = false, - items = cache, - } - end await.setPriority(1000) local clock = os.clock() + local offset = files.offset(uri, params.position) local result = core.completion(uri, offset) local passed = os.clock() - clock if passed > 0.1 then log.warn(('Completion takes %.3f sec.'):format(passed)) end if not result then - core.makeCache(nil) return nil end local easy = false @@ -443,7 +434,6 @@ proto.on('textDocument/completion', function (params) end items[i] = item end - core.makeCache(uri, offset, items) return { isIncomplete = false, items = items, @@ -481,7 +471,6 @@ proto.on('completionItem/resolve', function (item) end return t end)() - core.resolveCache(item) return item end) |