aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2022-11-27 14:15:42 -0800
committerStephan Seitz <stephan.seitz@fau.de>2022-11-28 00:33:04 +0100
commit8b241181ae573b320ded4c70f4d035e93460038d (patch)
treec7c1f3d7cc108e34131e8f55ea41c863b4190cbe /lua
parentfix(install): don't auto-install ignored parsers (diff)
downloadnvim-treesitter-8b241181ae573b320ded4c70f4d035e93460038d.tar
nvim-treesitter-8b241181ae573b320ded4c70f4d035e93460038d.tar.gz
nvim-treesitter-8b241181ae573b320ded4c70f4d035e93460038d.tar.bz2
nvim-treesitter-8b241181ae573b320ded4c70f4d035e93460038d.tar.lz
nvim-treesitter-8b241181ae573b320ded4c70f4d035e93460038d.tar.xz
nvim-treesitter-8b241181ae573b320ded4c70f4d035e93460038d.tar.zst
nvim-treesitter-8b241181ae573b320ded4c70f4d035e93460038d.zip
fix: is_installed correctly detects installed parsers
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/install.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index fff3bb1c0..b0428bd8f 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -100,9 +100,14 @@ end
---@return boolean
local function is_installed(lang)
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
- local install_dir = configs.get_parser_install_dir()
- if vim.startswith(path, install_dir) then
+ local abspath = vim.fn.fnamemodify(path, ":p")
+ if vim.startswith(abspath, install_dir) then
return true
end
end