summaryrefslogtreecommitdiff
path: root/server-beta/src/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-17 23:46:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-17 23:46:38 +0800
commite9fcf13480ed98af15201911cad542fe6e84dc1e (patch)
tree577422178b2d4ca28d1186faff7a010fdea6b9f9 /server-beta/src/core
parente8ea5f90e60e36833b3e2d98e66d89e6098faacc (diff)
downloadlua-language-server-e9fcf13480ed98af15201911cad542fe6e84dc1e.zip
修正一些bug
Diffstat (limited to 'server-beta/src/core')
-rw-r--r--server-beta/src/core/highlight.lua37
1 files changed, 26 insertions, 11 deletions
diff --git a/server-beta/src/core/highlight.lua b/server-beta/src/core/highlight.lua
index 8c609485..9aaf62b8 100644
--- a/server-beta/src/core/highlight.lua
+++ b/server-beta/src/core/highlight.lua
@@ -14,20 +14,35 @@ end
local function ofField(source, uri, callback)
local parent = source.parent
- if not parent or not parent.node then
+ if not parent then
return
end
local myKey = guide.getKeyName(source)
- searcher.eachField(parent.node, function (info)
- if info.key ~= myKey then
- return
- end
- local destUri = guide.getRoot(info.source).uri
- if destUri ~= uri then
- return
- end
- callback(info.source)
- end)
+ if parent.type == 'tableindex'
+ or parent.type == 'tablefield' then
+ local tbl = parent.parent
+ searcher.eachField(tbl, function (info)
+ if info.key ~= myKey then
+ return
+ end
+ local destUri = guide.getRoot(info.source).uri
+ if destUri ~= uri then
+ return
+ end
+ callback(info.source)
+ end)
+ else
+ searcher.eachField(parent.node, function (info)
+ if info.key ~= myKey then
+ return
+ end
+ local destUri = guide.getRoot(info.source).uri
+ if destUri ~= uri then
+ return
+ end
+ callback(info.source)
+ end)
+ end
end
local function ofIndex(source, uri, callback)