summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-21 14:28:01 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-21 14:28:01 +0800
commit1c038bc8af402ed05ebc10b78b8274c95ee0b4e1 (patch)
tree0815c1ff0cded8089d48bc8ecc0cb00256dfbd9c /server
parentefe60d90cc42d47afdc75abf61f7b237ebaef40f (diff)
downloadlua-language-server-1c038bc8af402ed05ebc10b78b8274c95ee0b4e1.zip
修正定义跳转的一些问题
Diffstat (limited to 'server')
-rw-r--r--server/src/core/definition.lua6
-rw-r--r--server/src/core/implementation.lua6
-rw-r--r--server/src/service.lua3
3 files changed, 13 insertions, 2 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua
index 341a363f..9b4b7233 100644
--- a/server/src/core/definition.lua
+++ b/server/src/core/definition.lua
@@ -123,6 +123,9 @@ local function parseValue(vm, source, lsp)
local mark = {}
local function callback(src)
+ if source == src then
+ return
+ end
if mark[src] then
return
end
@@ -143,8 +146,9 @@ local function parseValue(vm, source, lsp)
if source:bindValue() then
source:bindValue():eachInfo(function (info, src)
- if info.type == 'set' or info.type == 'local' then
+ if info.type == 'set' or info.type == 'local' or info.type == 'return' then
callback(src)
+ return true
end
end)
end
diff --git a/server/src/core/implementation.lua b/server/src/core/implementation.lua
index b0fa6e9e..832181f5 100644
--- a/server/src/core/implementation.lua
+++ b/server/src/core/implementation.lua
@@ -97,6 +97,9 @@ local function parseValue(vm, source, lsp)
local mark = {}
local function callback(src)
+ if source == src then
+ return
+ end
if mark[src] then
return
end
@@ -117,8 +120,9 @@ local function parseValue(vm, source, lsp)
if source:bindValue() then
source:bindValue():eachInfo(function (info, src)
- if info.type == 'set' or info.type == 'local' then
+ if info.type == 'set' or info.type == 'local' or info.type == 'return' then
callback(src)
+ return true
end
end)
end
diff --git a/server/src/service.lua b/server/src/service.lua
index 214e3f41..4b9d4319 100644
--- a/server/src/service.lua
+++ b/server/src/service.lua
@@ -224,6 +224,9 @@ function mt:loadVM(uri)
if not obj then
return nil
end
+ if uri ~= self._lastLoadedVM then
+ self:needCompile(uri)
+ end
self:compileVM(uri)
if obj.vm then
self._lastLoadedVM = uri