force LSP jumps to use 'vim.lsp.util.jump_to_location' (closes #336)

main
bhagwan 2 years ago
parent c96ef0c109
commit a487c6752f

@ -85,7 +85,7 @@ M.vimcmd_file = function(vimcmd, selected, opts)
local curbuf = vim.api.nvim_buf_get_name(0)
local is_term = utils.is_term_buffer(0)
for i = 1, #selected do
local entry = path.entry_to_file(selected[i])
local entry = path.entry_to_file(selected[i], opts.cwd, opts.force_uri)
entry.ctag = path.entry_to_ctag(selected[i])
-- Java LSP entries, 'jdt://...'
if entry.uri then

@ -168,10 +168,15 @@ function M.entry_to_location(entry)
}
end
function M.entry_to_file(entry, cwd)
function M.entry_to_file(entry, cwd, force_uri)
-- Remove ansi coloring and prefixed icons
entry = utils.strip_ansi_coloring(entry)
local stripped, idx = stripBeforeLastOccurrenceOf(entry, utils.nbsp)
-- #336: force LSP jumps using 'vim.lsp.util.jump_to_location'
-- so that LSP entries are added to the tag stack
if force_uri and not stripped:match("^%a+://") then
stripped = "file://" .. stripped
end
-- entries from 'buffers' contain '[<bufnr>]'
-- buffer placeholder always comes before the nbsp
local bufnr = idx>1 and entry:sub(1, idx):match("%[(%d+)") or nil

@ -295,6 +295,7 @@ local function fzf_lsp_locations(opts)
opts = normalize_lsp_opts(opts, config.globals.lsp)
if not opts then return end
opts = core.set_fzf_line_args(opts)
if opts.force_uri == nil then opts.force_uri = true end
opts = set_lsp_fzf_fn(opts)
if not opts.fzf_fn then return end
return core.fzf_files(opts)
@ -335,6 +336,7 @@ M.workspace_symbols = function(opts)
if not opts then return end
opts.lsp_params = {query = opts.query or ''}
opts = core.set_fzf_line_args(opts)
if opts.force_uri == nil then opts.force_uri = true end
opts = set_lsp_fzf_fn(opts)
if not opts.fzf_fn then return end
return core.fzf_files(opts)
@ -617,6 +619,7 @@ M.diagnostics = function(opts)
end
opts = core.set_fzf_line_args(opts)
if opts.force_uri == nil then opts.force_uri = true end
return core.fzf_files(opts)
end
@ -677,6 +680,7 @@ M.live_workspace_symbols = function(opts)
opts.__FNCREF__ = M.live_workspace_symbols
opts = core.set_fzf_interactive_cb(opts)
opts = core.set_fzf_line_args(opts)
if opts.force_uri == nil then opts.force_uri = true end
core.fzf_files(opts)
opts.search = nil
end

Loading…
Cancel
Save