From e20e8f174cc7125bf996a3ff3bd57c097daa1ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 20 Jul 2021 15:20:38 +0800 Subject: small fix --- changelog.md | 2 ++ script/core/definition.lua | 10 +++++++++- test/definition/bug.lua | 13 ++++++------- 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 ?> = '' ]] --- TODO: bug ---TEST [[ ---local t, a ---local = t[a] --- ---t[a] = ---]] +TEST [[ +local t, a +local = t[a] + +t[a] = +]] -- cgit v1.2.3