Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lua/telescope/builtin/__diagnostics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ diagnostics.get = function(opts)
if opts.bufnr ~= 0 then
opts.bufnr = nil
end
if opts.bufnr == nil then
opts.path_display = vim.F.if_nil(opts.path_display, {})
end
if type(opts.bufnr) == "string" then
opts.bufnr = tonumber(opts.bufnr)
end
if opts.bufnr ~= nil then
opts.path_display = vim.F.if_nil(opts.path_display, "hidden")
end

local locations = diagnostics_to_tbl(opts)

Expand All @@ -157,7 +157,6 @@ diagnostics.get = function(opts)
return
end

opts.path_display = vim.F.if_nil(opts.path_display, "hidden")
pickers
.new(opts, {
prompt_title = opts.bufnr == nil and "Workspace Diagnostics" or "Document Diagnostics",
Expand Down
39 changes: 31 additions & 8 deletions lua/telescope/make_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ do

if k == "path" then
local retpath = Path:new({ t.cwd, t.value }):absolute()
if not vim.loop.fs_access(retpath, "R", nil) then
if not vim.loop.fs_access(retpath, "R") then
retpath = t.value
end
return retpath
Expand Down Expand Up @@ -540,8 +540,14 @@ function make_entry.gen_from_lsp_symbols(opts)
msg,
}
else
local display_path, path_style = utils.transform_path(opts, entry.filename)
return displayer {
utils.transform_path(opts, entry.filename),
{
display_path,
function()
return path_style
end,
},
entry.symbol_name,
{ entry.symbol_type:lower(), type_highlight[entry.symbol_type] },
msg,
Expand Down Expand Up @@ -1043,7 +1049,7 @@ function make_entry.gen_from_ctags(opts)
}

local make_display = function(entry)
local filename = utils.transform_path(opts, entry.filename)
local display_path, path_style = utils.transform_path(opts, entry.filename)

local scode
if opts.show_line then
Expand All @@ -1057,7 +1063,12 @@ function make_entry.gen_from_ctags(opts)
}
else
return displayer {
filename,
{
display_path,
function()
return path_style
end,
},
entry.tag,
scode,
}
Expand All @@ -1073,7 +1084,7 @@ function make_entry.gen_from_ctags(opts)

if k == "path" then
local retpath = Path:new({ t.filename }):absolute()
if not vim.loop.fs_access(retpath, "R", nil) then
if not vim.loop.fs_access(retpath, "R") then
retpath = t.filename
end
return retpath
Expand Down Expand Up @@ -1174,7 +1185,7 @@ function make_entry.gen_from_diagnostics(opts)
}

local make_display = function(entry)
local filename = utils.transform_path(opts, entry.filename)
local display_path, path_style = utils.transform_path(opts, entry.filename)

-- add styling of entries
local pos = string.format("%4d:%2d", entry.lnum, entry.col)
Expand All @@ -1187,7 +1198,12 @@ function make_entry.gen_from_diagnostics(opts)
return displayer {
line_info,
entry.text,
filename,
{
display_path,
function()
return path_style
end,
},
}
end

Expand Down Expand Up @@ -1345,11 +1361,18 @@ function make_entry.gen_from_git_status(opts)
local status_x = git_abbrev[x] or {}
local status_y = git_abbrev[y] or {}

local display_path, path_style = utils.transform_path(opts, entry.path)

local empty_space = " "
return displayer {
{ status_x.icon or empty_space, status_x.hl },
{ status_y.icon or empty_space, status_y.hl },
utils.transform_path(opts, entry.path),
{
display_path,
function()
return path_style
end,
},
}
end

Expand Down