diff options
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | script/core/highlight.lua | 2 | ||||
-rw-r--r-- | script/core/rename.lua | 10 | ||||
-rw-r--r-- | test/crossfile/references.lua | 19 | ||||
-rw-r--r-- | test/rename/init.lua | 3 |
5 files changed, 24 insertions, 12 deletions
diff --git a/changelog.md b/changelog.md index 82f8351c..25f91b0a 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,8 @@ ## 2.5.7 * `FIX` [#879](https://github.com/sumneko/lua-language-server/issues/879) * `FIX` [#884](https://github.com/sumneko/lua-language-server/issues/884) +* `FIX` [#885](https://github.com/sumneko/lua-language-server/issues/885) +* `FIX` [#886](https://github.com/sumneko/lua-language-server/issues/886) ## 2.5.6 `2021-12-27` diff --git a/script/core/highlight.lua b/script/core/highlight.lua index 02f3c07f..bbfd1504 100644 --- a/script/core/highlight.lua +++ b/script/core/highlight.lua @@ -348,7 +348,7 @@ return function (uri, offset) results[#results+1] = { start = start, finish = finish, - kind = define.DocumentHighlightKind.Write + kind = define.DocumentHighlightKind.Text } end) diff --git a/script/core/rename.lua b/script/core/rename.lua index 0c48dbc4..d90a49bb 100644 --- a/script/core/rename.lua +++ b/script/core/rename.lua @@ -183,14 +183,7 @@ end local function ofField(source, newname, callback) local key = guide.getKeyName(source) - local node - if source.type == 'tablefield' - or source.type == 'tableindex' then - node = source.parent - else - node = source.node - end - for _, src in ipairs(vm.getAllRefs(node, '*')) do + for _, src in ipairs(vm.getAllRefs(source)) do ofFieldThen(key, src, newname, callback) end end @@ -276,7 +269,6 @@ local function rename(source, newname, callback) return ofField(parent, newname, callback) end end - return end local function prepareRename(source) diff --git a/test/crossfile/references.lua b/test/crossfile/references.lua index ec02eef7..18e9c5f9 100644 --- a/test/crossfile/references.lua +++ b/test/crossfile/references.lua @@ -183,3 +183,22 @@ TEST { ]] } } + +TEST { + { + path = 'a.lua', + content = [[ + local t = {} + t.<~x~> = 1 + return t + ]] + }, + { + path = 'b.lua', + content = [[ + local t = require 'a' + + print(t.<!x!>) + ]] + } +} diff --git a/test/rename/init.lua b/test/rename/init.lua index c4108df2..31421ada 100644 --- a/test/rename/init.lua +++ b/test/rename/init.lua @@ -90,7 +90,7 @@ local function f(b) end ]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', true) +--config.set('Lua.IntelliSense.traceBeSetted', true) TEST ('a', '!!!') [[ t = { a = 0 @@ -118,7 +118,6 @@ t = { t["!!!"] = 1 a = t["!!!"] ]] -config.set(nil, 'Lua.IntelliSense.traceBeSetted', false) TEST ('a', '"') [[ print(t[ "a" ]) |