blob: 0000bb125c29da29b4dc8eef267e7dc18e805fc5 (
plain)
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
43
44
45
46
47
48
49
50
51
52
53
|
local lclient = require 'lclient'
local ws = require 'workspace'
local files = require 'files'
local furi = require 'file-uri'
local util = require 'utility'
local fs = require 'bee.filesystem'
local rootPath = LOGPATH .. '/files-associations'
local rootUri = furi.encode(rootPath)
fs.create_directories(fs.path(rootPath))
local filePath = rootPath .. '/test.lua.txt'
local fileUri = furi.encode(filePath)
util.saveFile(filePath, '')
---@async
lclient():start(function (client)
client:registerFakers()
client:register('workspace/configuration', function ()
return {
{},
{
["*.lua.txt"] = "lua",
}
}
end)
client:initialize {
rootPath = rootPath,
rootUri = rootUri,
workspaceFolders = {
{
name = 'ws',
uri = rootUri,
},
},
capabilities = {
workspace = {
configuration = true,
}
}
}
ws.awaitReady(rootUri)
assert(files.isLua(furi.encode 'aaa.lua.txt') == true)
assert(files.isLua(furi.encode '/aaa.lua.txt') == true)
assert(files.isLua(furi.encode 'D:\\aaa.lua.txt') == true)
assert(files.isLua(fileUri) == true)
assert(files.exists(fileUri) == true)
end)
|