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>
This commit is contained in:
anott03
2021-07-14 13:25:00 -04:00
committed by GitHub
parent a4896e5ef3
commit df579bac42
11 changed files with 100 additions and 69 deletions

View File

@@ -3,7 +3,7 @@ local action_set = require('telescope.actions.set')
local action_state = require('telescope.actions.state')
local finders = require('telescope.finders')
local make_entry = require('telescope.make_entry')
local path = require('telescope.path')
local Path = require('plenary.path')
local pickers = require('telescope.pickers')
local previewers = require('telescope.previewers')
local sorters = require('telescope.sorters')
@@ -135,7 +135,7 @@ internal.symbols = function(opts)
local results = {}
for _, source in ipairs(sources) do
local data = vim.fn.json_decode(path.read_file(source))
local data = vim.fn.json_decode(Path:new(source):read())
for _, entry in ipairs(data) do
table.insert(results, entry)
end
@@ -346,8 +346,9 @@ end
internal.vim_options = function(opts)
-- Load vim options.
local vim_opts = loadfile(utils.data_directory() .. path.separator .. 'options' ..
path.separator .. 'options.lua')().options
local vim_opts = loadfile(
Path:new({utils.data_directory(), 'options', 'options.lua'}):absolute()
)().options
pickers.new(opts, {
prompt = 'options',
@@ -449,7 +450,7 @@ internal.help_tags = function(opts)
local delimiter = string.char(9)
for _, lang in ipairs(langs) do
for _, file in ipairs(tag_files[lang] or {}) do
local lines = vim.split(path.read_file(file), '\n', true)
local lines = vim.split(Path:new(file):read(), '\n', true)
for _, line in ipairs(lines) do
-- TODO: also ignore tagComment starting with ';'
if not line:match'^!_TAG_' then