summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md2
-rw-r--r--script/core/definition.lua10
-rw-r--r--test/definition/bug.lua13
3 files changed, 17 insertions, 8 deletions
diff --git a/changelog.md b/changelog.md
index d5864a7c..80ddc795 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,7 @@
# changelog
+## 2.3.2
+
## 2.3.1
`2021-7-19`
* `NEW` setting `Lua.workspace.userThirdParty`, add private user [third-parth](https://github.com/sumneko/lua-language-server/tree/master/meta/3rd) by this setting
diff --git a/script/core/definition.lua b/script/core/definition.lua
index e4eadf8c..b6b45871 100644
--- a/script/core/definition.lua
+++ b/script/core/definition.lua
@@ -150,7 +150,15 @@ return function (uri, offset)
if not root then
goto CONTINUE
end
- src = src.field or src.method or src.index or src
+ src = src.field or src.method or src
+ if src.type == 'getindex'
+ or src.type == 'setindex'
+ or src.type == 'tableindex' then
+ src = src.index
+ if not guide.isLiteral(src) then
+ goto CONTINUE
+ end
+ end
if src.type == 'doc.class.name'
or src.type == 'doc.alias.name' then
if source.type ~= 'doc.type.name'
diff --git a/test/definition/bug.lua b/test/definition/bug.lua
index 819f051d..aace2aee 100644
--- a/test/definition/bug.lua
+++ b/test/definition/bug.lua
@@ -243,10 +243,9 @@ end
local <?<!s!>?> = ''
]]
--- TODO: bug
---TEST [[
---local t, a
---local <!v!> = t[a]
---
---t[a] = <?v?>
---]]
+TEST [[
+local t, a
+local <!v!> = t[a]
+
+t[a] = <?v?>
+]]