From c5f24b97a38c2c34b9ab5c182f19f5a02260dc74 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 1 Apr 2019 19:31:34 +0800 Subject: =?UTF-8?q?=E8=BF=98=E6=98=AF=E6=89=BE=E5=88=B0=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E5=B0=B1=E8=BF=94=E5=9B=9E=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/method/textDocument/definition.lua | 7 ++++--- server/src/method/textDocument/implementation.lua | 11 ++++++----- 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 -- cgit v1.2.3