Skip to content

Commit 7e37427

Browse files
committed
fix
1 parent c6271c7 commit 7e37427

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

script/provider/capability.lua

+19
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require 'provider.inlay-hint'
1111
local m = {}
1212

1313
m.fillings = {}
14+
m.resolvedMap = {}
1415

1516
local function mergeFillings(provider)
1617
for _, filling in ipairs(m.fillings) do
@@ -29,6 +30,19 @@ local function mergeFillings(provider)
2930
end
3031
end
3132

33+
local function resolve(t)
34+
for k, v in pairs(t) do
35+
if type(v) == 'table' then
36+
resolve(v)
37+
end
38+
if type(v) == 'string' then
39+
t[k] = v:gsub('%{(.-)%}', function (key)
40+
return m.resolvedMap[key] or ''
41+
end)
42+
end
43+
end
44+
end
45+
3246
function m.getProvider()
3347
local provider = {
3448
offsetEncoding = client.getOffsetEncoding(),
@@ -52,6 +66,7 @@ function m.getProvider()
5266
nonil.disable()
5367

5468
mergeFillings(provider)
69+
resolve(provider)
5570

5671
return provider
5772
end
@@ -60,4 +75,8 @@ function m.filling(t)
6075
m.fillings[#m.fillings+1] = t
6176
end
6277

78+
function m.resolve(key, value)
79+
m.resolvedMap[key] = value
80+
end
81+
6382
return m

script/provider/provider.lua

+6-2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ m.register 'initialize' {
109109

110110
if params.rootUri then
111111
workspace.initRoot(params.rootUri)
112+
cap.resolve('ROOT_URI', furi.decode(params.rootUri):gsub('\\', '/') .. '/')
112113
end
113114

114115
if params.workspaceFolders then
@@ -188,7 +189,10 @@ m.register 'workspace/didRenameFiles' {
188189
filters = {
189190
{
190191
pattern = {
191-
glob = '**',
192+
glob = '{ROOT_URI}**',
193+
options = {
194+
ignoreCase = true,
195+
}
192196
},
193197
},
194198
},
@@ -203,7 +207,7 @@ m.register 'workspace/didRenameFiles' {
203207
for _, file in ipairs(params.files) do
204208
local oldUri = furi.normalize(file.oldUri)
205209
local newUri = furi.normalize(file.newUri)
206-
if files.exists(oldUri)
210+
if workspace.isValidLuaUri(oldUri)
207211
and workspace.isValidLuaUri(newUri) then
208212
renames[#renames+1] = {
209213
oldUri = oldUri,

0 commit comments

Comments
 (0)