From e2e1f6e1049e4e30cfe772c265225cb04e960280 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 4 Jan 2026 10:45:56 +0900 Subject: [PATCH 1/3] test: add failing test for library of relative dir --- test/tclient/init.lua | 1 + test/tclient/tests/relative-library.lua | 41 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 test/tclient/tests/relative-library.lua diff --git a/test/tclient/init.lua b/test/tclient/init.lua index f945d570e..4e05302b2 100644 --- a/test/tclient/init.lua +++ b/test/tclient/init.lua @@ -13,6 +13,7 @@ require 'tclient.tests.hover-set-local' require 'tclient.tests.same-prefix' require 'tclient.tests.recursive-runner' require 'tclient.tests.modify-luarc' +require 'tclient.tests.relative-library' require 'tclient.tests.performance-jass-common' require 'tclient.tests.build-meta' diff --git a/test/tclient/tests/relative-library.lua b/test/tclient/tests/relative-library.lua new file mode 100644 index 000000000..3140c7bb1 --- /dev/null +++ b/test/tclient/tests/relative-library.lua @@ -0,0 +1,41 @@ +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 .. '/relative-library' +local rootUri = furi.encode(rootPath) + +for _, name in ipairs { 'src', 'lib' } do + fs.create_directories(fs.path(rootPath .. '/' .. name)) + util.saveFile(rootPath .. '/' .. name .. '/test.lua', '') +end + +---@async +lclient():start(function (client) + client:registerFakers() + + client:register('workspace/configuration', function (params) + return { + ['workspace.library'] = { + rootPath .. '/lib', + } + } + end) + + client:initialize { + rootPath = rootPath, + rootUri = rootUri + } + + ws.awaitReady(rootUri .. '/src') + + assert(files.getState(rootUri .. '/src/test.lua') ~= nil) + assert(files.getState(rootUri .. '/lib/test.lua') ~= nil) + + assert(files.isLibrary(rootUri .. '/src/test.lua') == false) + assert(files.isLibrary(rootUri .. '/lib/test.lua') == true) +end) From 05b18fe4ab545c76f3a807b6589e94c3b068a559 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 4 Jan 2026 10:52:16 +0900 Subject: [PATCH 2/3] chore: specify lib directory using relative path --- test/tclient/tests/relative-library.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/tclient/tests/relative-library.lua b/test/tclient/tests/relative-library.lua index 3140c7bb1..15ae3189d 100644 --- a/test/tclient/tests/relative-library.lua +++ b/test/tclient/tests/relative-library.lua @@ -4,7 +4,6 @@ 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 .. '/relative-library' local rootUri = furi.encode(rootPath) @@ -18,10 +17,10 @@ end lclient():start(function (client) client:registerFakers() - client:register('workspace/configuration', function (params) + client:register('workspace/configuration', function () return { ['workspace.library'] = { - rootPath .. '/lib', + './lib', } } end) From 3a4e05a2213de9f8b1a9d65dfe16950dc370ec50 Mon Sep 17 00:00:00 2001 From: sevenc-nanashi Date: Sun, 4 Jan 2026 14:13:28 +0900 Subject: [PATCH 3/3] fix: fix workspace configuration --- test/tclient/tests/relative-library.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/tclient/tests/relative-library.lua b/test/tclient/tests/relative-library.lua index 15ae3189d..5628c0b41 100644 --- a/test/tclient/tests/relative-library.lua +++ b/test/tclient/tests/relative-library.lua @@ -19,8 +19,10 @@ lclient():start(function (client) client:register('workspace/configuration', function () return { - ['workspace.library'] = { - './lib', + { + ['workspace.library'] = { + './lib', + } } } end)