summaryrefslogtreecommitdiff
path: root/server-beta/src/parser/guide.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-21 20:06:20 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-21 20:06:20 +0800
commitbafe0e44914ad3b669388b94b91d9992edeb8e07 (patch)
tree26f78a3934dc38d31f82bbf9b33975dfecb3a0d8 /server-beta/src/parser/guide.lua
parentc354b5e8bd05ba117857ac93e8d647980875d98d (diff)
downloadlua-language-server-bafe0e44914ad3b669388b94b91d9992edeb8e07.zip
hover的第一步
Diffstat (limited to 'server-beta/src/parser/guide.lua')
-rw-r--r--server-beta/src/parser/guide.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/server-beta/src/parser/guide.lua b/server-beta/src/parser/guide.lua
index f91c677e..af511555 100644
--- a/server-beta/src/parser/guide.lua
+++ b/server-beta/src/parser/guide.lua
@@ -444,11 +444,15 @@ function m.lineRange(lines, row)
return line.start, line.finish
end
-function m.getKeyString(obj)
+function m.getName(obj)
local tp = obj.type
if tp == 'getglobal'
or tp == 'setglobal' then
return obj[1]
+ elseif tp == 'local'
+ or tp == 'getlocal'
+ or tp == 'setlocal' then
+ return obj[1]
elseif tp == 'getfield'
or tp == 'setfield'
or tp == 'tablefield' then
@@ -459,12 +463,12 @@ function m.getKeyString(obj)
elseif tp == 'getindex'
or tp == 'setindex'
or tp == 'tableindex' then
- return m.getKeyString(obj.index)
+ return m.getName(obj.index)
elseif tp == 'field'
or tp == 'method' then
return obj[1]
elseif tp == 'index' then
- return m.getKeyString(obj.index)
+ return m.getName(obj.index)
elseif tp == 'string' then
return obj[1]
end