diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-26 14:57:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-26 14:57:15 +0800 |
commit | 88b9936cfef9f84580cae3ba2f346c95f8f27103 (patch) | |
tree | 15b009745422b6d5654a029063f8dd7d84080b5c /server/src/method/textDocument/references.lua | |
parent | 6d929d7682fd297f49773efef5be039f2831427a (diff) | |
download | lua-language-server-88b9936cfef9f84580cae3ba2f346c95f8f27103.zip |
修正引用链不正确的问题
Diffstat (limited to 'server/src/method/textDocument/references.lua')
-rw-r--r-- | server/src/method/textDocument/references.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/src/method/textDocument/references.lua b/server/src/method/textDocument/references.lua index 7dbd4b95..ad1ebce0 100644 --- a/server/src/method/textDocument/references.lua +++ b/server/src/method/textDocument/references.lua @@ -1,4 +1,5 @@ local core = require 'core' +local LastTask return function (lsp, params) local uri = params.textDocument.uri @@ -8,15 +9,21 @@ return function (lsp, params) return nil end + if LastTask then + LastTask:remove() + LastTask = nil + end + -- lua是从1开始的,因此都要+1 local position = lines:positionAsChar(params.position.line + 1, params.position.character) return function (response) - ac.timer(0.1, 100, function (t) + LastTask = ac.timer(0.1, 100, function (t) if lsp:isWaitingCompile() then return end t:remove() + vm, lines = lsp:getVM(uri) local positions = core.references(vm, position, declarat) if not positions then |