summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <sumnekosun@intranet.123u.com>2019-04-01 19:31:34 +0800
committerunknown <sumnekosun@intranet.123u.com>2019-04-01 19:31:34 +0800
commitc5f24b97a38c2c34b9ab5c182f19f5a02260dc74 (patch)
tree87f113f0f5e3ecb4513770b1bbc0f7740462e228
parent09578bf7b01b1f01b744fb12a2beb44273c26802 (diff)
downloadlua-language-server-c5f24b97a38c2c34b9ab5c182f19f5a02260dc74.zip
还是找到结果就返回吧
-rw-r--r--server/src/method/textDocument/definition.lua7
-rw-r--r--server/src/method/textDocument/implementation.lua11
-rw-r--r--server/src/method/textDocument/references.lua11
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