diff options
-rw-r--r-- | server/src/method/textDocument/definition.lua | 7 | ||||
-rw-r--r-- | server/src/method/textDocument/implementation.lua | 11 | ||||
-rw-r--r-- | server/src/method/textDocument/references.lua | 11 |
3 files changed, 16 insertions, 13 deletions
diff --git a/server/src/method/textDocument/definition.lua b/server/src/method/textDocument/definition.lua index e419b57e..0334bef0 100644 --- a/server/src/method/textDocument/definition.lua +++ b/server/src/method/textDocument/definition.lua @@ -92,15 +92,16 @@ return function (lsp, params) local result = findResult(lsp, params) if result then response(result) + LastTask:remove() + LastTask = nil + return end if lsp:isWaitingCompile() then return end + response(nil) LastTask:remove() LastTask = nil - if not result then - response(nil) - end end) end end diff --git a/server/src/method/textDocument/implementation.lua b/server/src/method/textDocument/implementation.lua index 8f878850..68643e7c 100644 --- a/server/src/method/textDocument/implementation.lua +++ b/server/src/method/textDocument/implementation.lua @@ -37,7 +37,7 @@ local function findResult(lsp, params) if valueLines then local start_row, start_col = valueLines:rowcol(start) local finish_row, finish_col = valueLines:rowcol(finish) - locations[#locations] = { + locations[#locations+1] = { uri = valueUri, range = { start = { @@ -52,7 +52,7 @@ local function findResult(lsp, params) } } else - locations[#locations] = { + locations[#locations+1] = { uri = valueUri, range = { start = { @@ -90,16 +90,17 @@ return function (lsp, params) LastTask = ac.loop(0.1, function () local result = findResult(lsp, params) if result then + LastTask:remove() + LastTask = nil response(result) + return end if lsp:isWaitingCompile() then return end LastTask:remove() LastTask = nil - if not result then - response(nil) - end + response(nil) end) end end diff --git a/server/src/method/textDocument/references.lua b/server/src/method/textDocument/references.lua index 017999df..d969e919 100644 --- a/server/src/method/textDocument/references.lua +++ b/server/src/method/textDocument/references.lua @@ -16,7 +16,7 @@ local function findReferences(lsp, uri, position, declarat) if valueLines then local start_row, start_col = valueLines:rowcol(start) local finish_row, finish_col = valueLines:rowcol(finish) - locations[#locations] = { + locations[#locations+1] = { uri = valueUri, range = { start = { @@ -31,7 +31,7 @@ local function findReferences(lsp, uri, position, declarat) } } else - locations[#locations] = { + locations[#locations+1] = { uri = valueUri, range = { start = { @@ -75,15 +75,16 @@ return function (lsp, params) local positions = findReferences(lsp, uri, position, declarat) if positions then response(positions) + t:remove() + LastTask = nil + return end if lsp:isWaitingCompile() then return end + response(nil) t:remove() LastTask = nil - if not positions then - response(nil) - end end) end end |