apply cwd to path when parsing LSP URIs (#341)

main
bhagwan 2 years ago
parent 59de53fbbe
commit 5f1506fc0c

@ -635,8 +635,8 @@ require'fzf-lua'.setup {
file_icons = true,
git_icons = false,
lsp_icons = true,
severity = "hint",
ui_select = true, -- use 'vim.ui.select' for code actions
severity = "hint",
icons = {
["Error"] = { icon = "", color = "red" }, -- error
["Warning"] = { icon = "", color = "yellow" }, -- warning

@ -677,8 +677,8 @@ Consult the list below for available settings:
file_icons = true,
git_icons = false,
lsp_icons = true,
severity = "hint",
ui_select = true, -- use 'vim.ui.select' for code actions
severity = "hint",
icons = {
["Error"] = { icon = "", color = "red" }, -- error
["Warning"] = { icon = "", color = "yellow" }, -- warning

@ -172,15 +172,22 @@ 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)
local isURI = stripped:match("^%a+://")
-- Prepend cwd before constructing the URI (#341)
if cwd and #cwd>0 and not isURI and
not M.starts_with_separator(stripped) then
stripped = M.join({cwd, stripped})
end
-- #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
if not isURI and force_uri then
isURI = true
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
if not bufnr and stripped:match("^%a+://") then
if isURI and not bufnr then
-- Issue #195, when using nvim-jdtls
-- https://github.com/mfussenegger/nvim-jdtls
-- LSP entries inside .jar files appear as URIs
@ -196,10 +203,6 @@ function M.entry_to_file(entry, cwd, force_uri)
local file = s[1]
local line = tonumber(s[2])
local col = tonumber(s[3])
if cwd and #cwd>0 and not M.starts_with_separator(file) then
file = M.join({cwd, file})
stripped = M.join({cwd, stripped})
end
local terminal
if bufnr then
terminal = utils.is_term_buffer(bufnr)

@ -210,6 +210,9 @@ M.read_file_async = function(filepath, callback)
end
-- deepcopy can fail with: "Cannot deepcopy object of type userdata" (#353)
-- this can happen when copying items/on_choice params of vim.ui.select
-- run in a pcall and fallback to our poor man's clone
function M.deepcopy(t)
local ok, res = pcall(vim.deepcopy, t)
if ok then

Loading…
Cancel
Save