Skip to content

Commit 2d37173

Browse files
committed
fix #886
1 parent 820aa1a commit 2d37173

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 2.5.7
44
* `FIX` [#879](https://github.com./sumneko/lua-language-server/issues/879)
55
* `FIX` [#884](https://github.com./sumneko/lua-language-server/issues/884)
6+
* `FIX` [#886](https://github.com./sumneko/lua-language-server/issues/886)
67

78
## 2.5.6
89
`2021-12-27`

script/core/rename.lua

+1-9
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,7 @@ end
183183

184184
local function ofField(source, newname, callback)
185185
local key = guide.getKeyName(source)
186-
local node
187-
if source.type == 'tablefield'
188-
or source.type == 'tableindex' then
189-
node = source.parent
190-
else
191-
node = source.node
192-
end
193-
for _, src in ipairs(vm.getAllRefs(node, '*')) do
186+
for _, src in ipairs(vm.getAllRefs(source)) do
194187
ofFieldThen(key, src, newname, callback)
195188
end
196189
end
@@ -276,7 +269,6 @@ local function rename(source, newname, callback)
276269
return ofField(parent, newname, callback)
277270
end
278271
end
279-
return
280272
end
281273

282274
local function prepareRename(source)

test/crossfile/references.lua

+19
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,22 @@ TEST {
179179
]]
180180
}
181181
}
182+
183+
TEST {
184+
{
185+
path = 'a.lua',
186+
content = [[
187+
local t = {}
188+
t.<~x~> = 1
189+
return t
190+
]]
191+
},
192+
{
193+
path = 'b.lua',
194+
content = [[
195+
local t = require 'a'
196+
197+
print(t.<!x!>)
198+
]]
199+
}
200+
}

test/rename/init.lua

+1-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ local function f(b)
9090
end
9191
]]
9292

93-
config.set('Lua.IntelliSense.traceBeSetted', true)
93+
--config.set('Lua.IntelliSense.traceBeSetted', true)
9494
TEST ('a', '!!!') [[
9595
t = {
9696
a = 0
@@ -118,7 +118,6 @@ t = {
118118
t["!!!"] = 1
119119
a = t["!!!"]
120120
]]
121-
config.set('Lua.IntelliSense.traceBeSetted', false)
122121

123122
TEST ('a', '"') [[
124123
print(t[ "a" ])

0 commit comments

Comments
 (0)