diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-10-11 16:19:08 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-10-11 16:19:08 +0800 |
commit | e82c09fd0b06e8d4ca872759fb6bb4d50506dd6a (patch) | |
tree | a126cdd41e72a1a45db6cdf875c2c0d021a2ce1c /test/tclient/tests/same-prefix.lua | |
parent | 8ec593e83fff0ba00466361cdee5dece07c5d98e (diff) | |
download | lua-language-server-e82c09fd0b06e8d4ca872759fb6bb4d50506dd6a.zip |
fix #1567
Diffstat (limited to 'test/tclient/tests/same-prefix.lua')
-rw-r--r-- | test/tclient/tests/same-prefix.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/tclient/tests/same-prefix.lua b/test/tclient/tests/same-prefix.lua new file mode 100644 index 00000000..bc2a1f9b --- /dev/null +++ b/test/tclient/tests/same-prefix.lua @@ -0,0 +1,57 @@ +local lclient = require 'lclient' +local fs = require 'bee.filesystem' +local util = require 'utility' +local furi = require 'file-uri' +local ws = require 'workspace' +local files = require 'files' +local scope = require 'workspace.scope' + +local rootPath = LOGPATH .. '/same-prefix' +local rootUri = furi.encode(rootPath) + +for _, name in ipairs { 'ws', 'ws1' } do + fs.create_directories(fs.path(rootPath .. '/' .. name)) +end + +---@async +lclient():start(function (client) + client:registerFakers() + + client:initialize { + rootPath = rootPath, + rootUri = rootUri, + workspaceFolders = { + { + name = 'ws', + uri = rootUri .. '/ws', + }, + { + name = 'ws1', + uri = rootUri .. '/ws1', + }, + } + } + + ws.awaitReady(rootUri .. '/ws') + ws.awaitReady(rootUri .. '/ws1') + + files.setText(rootUri .. '/ws1/test.lua', [[ + ]]) + + files.setText(rootUri .. '/ws/main.lua', [[ +require '' + ]]) + + local comps1 = client:awaitRequest('textDocument/completion', { + textDocument = { + uri = rootUri .. '/ws/main.lua', + }, + position = { + line = 0, + character = 9, + }, + }) + for _, item in ipairs(comps1.items) do + assert(item.label ~= 'test') + end +end) |