summaryrefslogtreecommitdiff
path: root/server/src/core/implementation.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-28 16:08:03 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-28 16:08:03 +0800
commit3eddd7eb2f4e22f29b1cc286e06dea345991da18 (patch)
tree342bcf86c2d7f2bbc18d7108e496d8b1ff3fa8e0 /server/src/core/implementation.lua
parent3342b201614baeb067e29b7941e26807ff13a244 (diff)
downloadlua-language-server-3eddd7eb2f4e22f29b1cc286e06dea345991da18.zip
更新
Diffstat (limited to 'server/src/core/implementation.lua')
-rw-r--r--server/src/core/implementation.lua20
1 files changed, 15 insertions, 5 deletions
diff --git a/server/src/core/implementation.lua b/server/src/core/implementation.lua
index c0cd0f76..6879c9b9 100644
--- a/server/src/core/implementation.lua
+++ b/server/src/core/implementation.lua
@@ -72,7 +72,7 @@ local function findFieldCrossUriByName(positions, vm, result, lsp)
end
end
-local function parseResult(vm, result, lsp)
+local function parseResultAsVar(vm, result, lsp)
local positions = {}
local tp = result.type
if tp == 'local' then
@@ -122,12 +122,19 @@ local function parseResult(vm, result, lsp)
}
end
end
- elseif tp == 'string' then
+ end
+ return positions
+end
+
+local function parseResultAsValue(vm, value, lsp)
+ local tp = value:getType()
+ local positions = {}
+ if tp == 'string' then
-- require 'XXX' 专用
positions[#positions+1] = {
0,
0,
- result.uri,
+ value.uri,
}
end
return positions
@@ -137,6 +144,9 @@ return function (vm, result, lsp)
if not result then
return nil
end
- local positions = parseResult(vm, result, lsp)
- return positions
+ if result.type == 'value' then
+ return parseResultAsValue(vm, result, lsp)
+ else
+ return parseResultAsVar(vm, result, lsp)
+ end
end