summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
authoranott03 <amitav_nott@ryecountryday.org>2021-07-14 13:25:00 -0400
committerGitHub <noreply@github.com>2021-07-14 19:25:00 +0200
commitdf579bac425e4b6b69a0c8e694b154610cd5420b (patch)
treefc4eb1bcbeeabe199bd997757bd72892fb4c07a0 /lua/telescope/make_entry.lua
parenta4896e5ef39a8006a8251d48d4cf24aac81a4f94 (diff)
refactor: move from telescope.path to plenary.path (#473)
This will deprecate telescope.path, we will remove it soon. Please move over to plenary.path Co-authored-by: Simon Hauser <Simon-Hauser@outlook.de>
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua13
1 files changed, 5 insertions, 8 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index e0b58c6..12da181 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -1,8 +1,6 @@
local entry_display = require('telescope.pickers.entry_display')
-local path = require('telescope.path')
local utils = require('telescope.utils')
local strings = require('plenary.strings')
-
local Path = require('plenary.path')
local treesitter_type_highlight = {
@@ -88,7 +86,7 @@ do
if raw then return raw end
if k == "path" then
- local retpath = t.cwd .. path.separator .. t.value
+ local retpath = Path:new({t.cwd, t.value}):absolute()
if not vim.loop.fs_access(retpath, "R", nil) then
retpath = t.value
end
@@ -146,7 +144,7 @@ do
if Path:new(t.filename):is_absolute() then
return t.filename, false
else
- return t.cwd .. path.separator .. t.filename, false
+ return Path:new({t.cwd, t.filename}):absolute(), false
end
end,
@@ -446,7 +444,7 @@ function make_entry.gen_from_buffer(opts)
return function(entry)
local bufname = entry.info.name ~= "" and entry.info.name or '[No Name]'
-- if bufname is inside the cwd, trim that part of the string
- bufname = path.normalize(bufname, cwd)
+ bufname = Path:new(bufname):normalize(cwd)
local hidden = entry.info.hidden == 1 and 'h' or 'a'
local readonly = vim.api.nvim_buf_get_option(entry.bufnr, 'readonly') and '=' or ' '
@@ -815,7 +813,7 @@ function make_entry.gen_from_ctags(opts)
opts = opts or {}
local cwd = vim.fn.expand(opts.cwd or vim.fn.getcwd())
- local current_file = path.normalize(vim.fn.expand('%'), cwd)
+ local current_file = Path:new(vim.fn.expand('%')):normalize(cwd)
local display_items = {
{ remaining = true },
@@ -1106,10 +1104,9 @@ function make_entry.gen_from_git_status(opts)
status = mod,
ordinal = entry,
display = make_display,
- path = opts.cwd .. path.separator .. file
+ path = Path:new({opts.cwd, file}):absolute()
}
end
end
-
return make_entry