Skip to content

Commit 41ffcf2

Browse files
committed
feat: add variable substitution support for ${workspaceFolder:x}
1 parent a2ddc19 commit 41ffcf2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

script/files.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,17 @@ function m.resolvePathPlaceholders(path)
945945
elseif key:sub(1, 4) == "env:" then
946946
local env = os.getenv(key:sub(5))
947947
return env
948+
elseif key == "workspaceFolder" then
949+
local ws = require 'workspace'
950+
return ws.rootUri and furi.decode(ws.rootUri)
951+
elseif key:match("^workspaceFolder:.+$") then
952+
local folderName = key:match("^workspaceFolder:(.+)$")
953+
for _, scp in ipairs(scope.folders) do
954+
if scp:getFolderName() == folderName then
955+
return scp.uri and furi.decode(scp.uri)
956+
end
957+
end
958+
log.warn(('variable ${%s} cannot be resolved when processing path: %s'):format(key, path))
948959
end
949960
end)
950961

0 commit comments

Comments
 (0)