summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-18 18:48:50 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-18 18:48:50 +0800
commit2580893630af08fd38810a74a4f02013367ae17f (patch)
tree00fd131bcbf1857cf9123685ad382bf2385264c0 /test
parent19bd07b6a7b1a41f15d1a09e6a5b9c0e285ae4d8 (diff)
downloadlua-language-server-2580893630af08fd38810a74a4f02013367ae17f.zip
parse path in `source`
Diffstat (limited to 'test')
-rw-r--r--test/tclient/tests/jump-source.lua40
1 files changed, 39 insertions, 1 deletions
diff --git a/test/tclient/tests/jump-source.lua b/test/tclient/tests/jump-source.lua
index b6ad4da0..dd7666c3 100644
--- a/test/tclient/tests/jump-source.lua
+++ b/test/tclient/tests/jump-source.lua
@@ -14,7 +14,7 @@ lclient():start(function (client)
client:notify('textDocument/didOpen', {
textDocument = {
- uri = furi.encode('1.lua'),
+ uri = furi.encode('D:/test/1.lua'),
languageId = 'lua',
version = 0,
text = [[
@@ -36,6 +36,12 @@ YY = 1
---@class BBB
---@source file:///lib.c
BBB = {}
+
+---@source D:/xxx/2.lua
+D2 = 1
+
+---@source 2.lua
+D3 = 1
]]
}
})
@@ -55,6 +61,8 @@ print(XX)
print(YY)
---@type BBB
print(BBB)
+print(D2)
+print(D3)
]]
}
})
@@ -148,4 +156,34 @@ print(BBB)
}
}
}))
+
+ local locations = client:awaitRequest('textDocument/definition', {
+ textDocument = { uri = furi.encode('main.lua') },
+ position = { line = 9, character = 7 },
+ })
+
+ assert(util.equal(locations, {
+ {
+ uri = 'file:///d%3A/xxx/2.lua',
+ range = {
+ start = { line = 0, character = 0 },
+ ['end'] = { line = 0, character = 0 },
+ }
+ }
+ }))
+
+ local locations = client:awaitRequest('textDocument/definition', {
+ textDocument = { uri = furi.encode('main.lua') },
+ position = { line = 10, character = 7 },
+ })
+
+ assert(util.equal(locations, {
+ {
+ uri = 'file:///d%3A/test/2.lua',
+ range = {
+ start = { line = 0, character = 0 },
+ ['end'] = { line = 0, character = 0 },
+ }
+ }
+ }))
end)