revert: "fix(lsp): do not expand $VAR in tagfunc filenames" #41489

revert c5cb0350a6
This commit is contained in:
Justin M. Keyes
2026-08-25 14:09:02 -04:00
committed by GitHub
parent 8adf6e769f
commit aae43789d7
2 changed files with 1 additions and 20 deletions

View File

@@ -12,10 +12,9 @@ local function mk_tag_item(name, range, uri, position_encoding)
-- This is get_line_byte_from_position is 0-indexed, call cursor expects a 1-indexed position
local pos = vim.pos.lsp(bufnr, range.start, position_encoding)
local byte = pos.col + 1
-- :tag expands "$VAR" in filenames. Escape so URI paths keep literal "$". #41313
return {
name = name,
filename = vim.fn.fnameescape(vim.uri_to_fname(uri)),
filename = vim.uri_to_fname(uri),
cmd = string.format([[/\%%%dl\%%%dc/]], range.start.line + 1, byte),
}
end

View File

@@ -3242,24 +3242,6 @@ describe('LSP', function()
return {}
end)
end)
it('does not expand $ in tag filenames #41313', function()
local result = exec_lua(function()
vim.env.personId = 'EXPANDED'
local dir = vim.fn.tempname()
vim.fn.mkdir(dir, 'p')
local f = vim.fs.abspath(dir .. '/people_.$personId.tsx')
vim.fn.writefile({ 'symbol' }, f)
_G.mock_locations[1].uri = vim.uri_from_fname(f)
local tags = vim.lsp.tagfunc('symbol', 'c')
vim.cmd.edit(tags[1].filename)
return {
bufname = vim.fs.abspath(vim.api.nvim_buf_get_name(0)),
expected = f,
}
end)
eq(result.expected, result.bufname)
end)
end)
describe('cmd', function()