Skip to content

Commit 9c705c9

Browse files
authored
fix: improve Deno path handling in definition module (#1521)
1 parent b0f4430 commit 9c705c9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lua/lspsaga/definition.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ function def:close_all()
6666
api.nvim_del_augroup_by_name('SagaPeekdefinition')
6767
end
6868

69+
local function transform_deno_path(fname)
70+
if not fname:match('^deno:/') then
71+
return fname
72+
end
73+
fname = fname:gsub('%%40', '@')
74+
return fname:gsub('^deno:', 'deno\\:')
75+
end
76+
6977
function def:apply_maps(bufnr)
7078
for action, map in pairs(config.definition.keys) do
7179
if action ~= 'close' then
@@ -86,6 +94,7 @@ function def:apply_maps(bufnr)
8694
self:close_all()
8795
local curbuf = api.nvim_get_current_buf()
8896
if action ~= 'edit' or curbuf ~= bufnr then
97+
fname = transform_deno_path(fname)
8998
vim.cmd[action](fname)
9099
end
91100
restore()

0 commit comments

Comments
 (0)