Skip to content

Commit

Permalink
fix: Fix bug with relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
desdic committed Mar 8, 2024
1 parent 772737d commit 738ce06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lua/agrolens/core.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
local M = {}

local ppath = require("plenary.path")
local utils = require("telescope._extensions.utils")

M.create_entry = function(filename, matches, iter_query, bufnr, capture_name)
Expand Down Expand Up @@ -105,7 +104,6 @@ M.get_captures = function(opts)

for _, bufnr in ipairs(opts.bufids) do
local buffilename = vim.api.nvim_buf_get_name(bufnr)
local relpath = ppath:new(buffilename):make_relative(opts.cwd)
local filetype = vim.filetype.match({ buf = bufnr })

if filetype and filetype ~= "" then
Expand All @@ -114,7 +112,7 @@ M.get_captures = function(opts)
entries,
opts.queries,
bufnr,
relpath,
buffilename,
filetype
)
end
Expand Down
3 changes: 3 additions & 0 deletions lua/telescope/_extensions/agrolenslib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local conf = require("telescope.config").values
local utils = require("telescope._extensions.utils")
local core = require("agrolens.core")
local entry_display = require("telescope.pickers.entry_display")
local ppath = require("plenary.path")

local agrolens = {}

Expand Down Expand Up @@ -103,6 +104,8 @@ agrolens.entry_maker = function(entry)
and agrolens.telescope_opts.force_long_filepath ~= true
then
fname = vim.fs.basename(fname)
else
fname = ppath:new(fname):make_relative(agrolens.cur_opts.cwd)
end

local line = fname
Expand Down

0 comments on commit 738ce06

Please sign in to comment.