Skip to content

Commit

Permalink
fix(telescope): item path. Fixes #521
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 24, 2024
1 parent 57761ba commit 6e19371
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lua/trouble/sources/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ local Util = require("trouble.util")
---@field filename? string The filename of the item.
---@field text? string The text of the item.
---@field cwd? string The current working directory of the item.
---@field path? string The path of the item.

---@class trouble.Source.telescope: trouble.Source
local M = {}
Expand Down Expand Up @@ -41,9 +42,15 @@ M.config = {

---@param item telescope.Item
function M.item(item)
local filename = item.filename
if item.cwd then
filename = item.cwd .. "/" .. filename
---@type string
local filename
if item.path then
filename = item.path
else
filename = item.filename
if item.cwd then
filename = item.cwd .. "/" .. filename
end
end
local word = item.text and item.text:sub(item.col):match("%S+")
local pos = (item.lnum and item.col) and { item.lnum, item.col - 1 } or nil
Expand Down

0 comments on commit 6e19371

Please sign in to comment.