-
-
Notifications
You must be signed in to change notification settings - Fork 423
Expand file tree
/
Copy pathrelative-library.lua
More file actions
42 lines (34 loc) · 1.12 KB
/
relative-library.lua
File metadata and controls
42 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 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 ()
return {
{
['workspace.library'] = {
'./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)