summaryrefslogtreecommitdiff
path: root/test/tclient
diff options
context:
space:
mode:
Diffstat (limited to 'test/tclient')
-rw-r--r--test/tclient/init.lua2
-rw-r--r--test/tclient/tests/same-prefix.lua57
2 files changed, 59 insertions, 0 deletions
diff --git a/test/tclient/init.lua b/test/tclient/init.lua
index 6f861142..eff77d8a 100644
--- a/test/tclient/init.lua
+++ b/test/tclient/init.lua
@@ -11,4 +11,6 @@ require 'tclient.tests.change-workspace-folder'
require 'tclient.tests.jump-source'
require 'tclient.tests.load-relative-library'
require 'tclient.tests.hover-set-local'
+require 'tclient.tests.same-prefix'
+
require 'tclient.tests.build-meta'
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)