mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 03:40:04 -04:00
fix: is_installed correctly detects installed parsers
This commit is contained in:
parent
754335b649
commit
8b241181ae
1 changed files with 7 additions and 2 deletions
|
|
@ -100,9 +100,14 @@ end
|
||||||
---@return boolean
|
---@return boolean
|
||||||
local function is_installed(lang)
|
local function is_installed(lang)
|
||||||
local matched_parsers = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true) or {}
|
local matched_parsers = vim.api.nvim_get_runtime_file("parser/" .. lang .. ".so", true) or {}
|
||||||
|
local install_dir = configs.get_parser_install_dir()
|
||||||
|
if not install_dir then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
install_dir = vim.fn.fnamemodify(install_dir, ":p")
|
||||||
for _, path in ipairs(matched_parsers) do
|
for _, path in ipairs(matched_parsers) do
|
||||||
local install_dir = configs.get_parser_install_dir()
|
local abspath = vim.fn.fnamemodify(path, ":p")
|
||||||
if vim.startswith(path, install_dir) then
|
if vim.startswith(abspath, install_dir) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue