summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-28 22:28:24 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-28 22:28:24 +0800
commite745667530f0d4fd340beebc1545f86c76c78af1 (patch)
tree90444f218bfc26a44ac2997f8e619f354afae058
parentd79bad83b120ab4a04bed447fad62789f21f24b5 (diff)
downloadlua-language-server-e745667530f0d4fd340beebc1545f86c76c78af1.zip
update
-rw-r--r--script/vm/ref.lua9
-rw-r--r--test/catch.lua7
-rw-r--r--test/definition/init.lua4
-rw-r--r--test/references/common.lua45
4 files changed, 29 insertions, 36 deletions
diff --git a/script/vm/ref.lua b/script/vm/ref.lua
index 9705094c..4765dc8d 100644
--- a/script/vm/ref.lua
+++ b/script/vm/ref.lua
@@ -24,7 +24,6 @@ end
simpleMap = util.switch()
: case 'local'
: call(function (source, pushResult)
- pushResult(source)
if source.ref then
for _, ref in ipairs(source.ref) do
if ref.type == 'setlocal'
@@ -33,12 +32,6 @@ simpleMap = util.switch()
end
end
end
-
- if source.dummy then
- for _, res in ipairs(vm.getDefs(source.method.node)) do
- pushResult(res)
- end
- end
end)
: case 'getlocal'
: case 'setlocal'
@@ -213,8 +206,6 @@ local function searchByNode(source, pushResult)
for _, get in ipairs(n:getGets()) do
pushResult(get)
end
- else
- pushResult(n)
end
end
end
diff --git a/test/catch.lua b/test/catch.lua
index 849be09d..01aac665 100644
--- a/test/catch.lua
+++ b/test/catch.lua
@@ -41,6 +41,10 @@ return function (script, seps)
local result = {}
local marks = {}
+ for s in seps:gmatch '.' do
+ result[s] = catchedTable()
+ end
+
local lineOffset = 1
local line = 0
local skipOffset = 0
@@ -68,9 +72,6 @@ return function (script, seps)
local mark = marks[j]
if mark.char == text then
local position = line * 10000 + offset - skipOffset - lineOffset
- if not result[text] then
- result[text] = catchedTable()
- end
result[text][#result[text]+1] = { mark.position, position }
table.remove(marks, j)
break
diff --git a/test/definition/init.lua b/test/definition/init.lua
index 98e97df5..3badaadf 100644
--- a/test/definition/init.lua
+++ b/test/definition/init.lua
@@ -34,9 +34,9 @@ function TEST(script)
positions[i] = { result.target.start, result.target.finish }
end
end
- assert(founded(catched['!'] or {}, positions))
+ assert(founded(catched['!'], positions))
else
- assert(catched['!'] == nil)
+ assert(#catched['!'] == 0)
end
files.remove('')
diff --git a/test/references/common.lua b/test/references/common.lua
index e95a4031..2331aa91 100644
--- a/test/references/common.lua
+++ b/test/references/common.lua
@@ -1,6 +1,6 @@
local config = require "config"
TEST [[
-local <!<?a?>!> = 1
+local <?a?> = 1
<!a!> = <!a!>
]]
@@ -38,12 +38,12 @@ end
TEST [[
local a = 1
-local <!<?a?>!> = 1
+local <?a?> = 1
<!a!> = <!a!>
]]
TEST [[
-local <!<?a?>!>
+local <?a?>
local b = <!a!>
]]
@@ -81,22 +81,9 @@ t[a.b.c] = 1
TEST [[
local t = {}
t.x = 1
-t[a.b.<?x?>] = 1
+t[a.b.<!<?x?>!>] = 1
]]
-config.set(nil, 'Lua.IntelliSense.traceBeSetted', true)
-TEST [[
-local t
-local <!f!> = t.<?f?>
-
-<!f!>()
-
-return {
- <!f!> = <!f!>,
-}
-]]
-config.set(nil, 'Lua.IntelliSense.traceBeSetted', false)
-
TEST [[
self = {
results = {
@@ -112,22 +99,36 @@ print(a.b.<!c!>)
]]
TEST [[
-local <!mt!> = {}
+local mt = {}
+function mt:x()
+ <!<?self?>!>:x()
+end
+]]
+
+TEST [[
+local <?mt?> = {}
function <!mt!>:x()
- <?self?>:x()
+ self:x()
+end
+]]
+
+TEST [[
+local mt = {}
+function mt:x()
+ self:<!<?x?>!>()
end
]]
TEST [[
local mt = {}
-function mt:<!x!>()
- self:<?x?>()
+function mt:<?x?>()
+ self:<!x!>()
end
]]
TEST [[
a.<!b!>.c = 1
-print(a.<?b?>.c)
+print(a.<!<?b?>!>.c)
]]
config.set(nil, 'Lua.IntelliSense.traceBeSetted', true)