mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 02:10:15 -04:00
fix get_package_path function for paths with trailing slash
This commit is contained in:
parent
1cdf8bf750
commit
cf9df71341
1 changed files with 2 additions and 2 deletions
|
|
@ -19,8 +19,8 @@ end
|
||||||
|
|
||||||
function M.get_package_path()
|
function M.get_package_path()
|
||||||
for _, path in pairs(api.nvim_list_runtime_paths()) do
|
for _, path in pairs(api.nvim_list_runtime_paths()) do
|
||||||
local last_segment = vim.fn.fnamemodify(path, ":t")
|
local last_segment = vim.fn.fnamemodify(path, ":p:h:t")
|
||||||
local penultimate_segment = vim.fn.fnamemodify(path, ":t:t")
|
local penultimate_segment = vim.fn.fnamemodify(path, ":p:h:t:t")
|
||||||
if last_segment == "nvim-treesitter" or (last_segment == "" and penultimate_segment == "nvim-treesitter") then
|
if last_segment == "nvim-treesitter" or (last_segment == "" and penultimate_segment == "nvim-treesitter") then
|
||||||
return path
|
return path
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue