aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter.lua1
-rw-r--r--lua/nvim-treesitter/install.lua17
2 files changed, 18 insertions, 0 deletions
diff --git a/lua/nvim-treesitter.lua b/lua/nvim-treesitter.lua
index 8dae7c33b..8628e499b 100644
--- a/lua/nvim-treesitter.lua
+++ b/lua/nvim-treesitter.lua
@@ -15,5 +15,6 @@ end
-- To install, run `:lua require'nvim-treesitter'.install_parser('language')`
-- we should add a vim layer over the lua function
M.install_parser = install.install_parser
+M.list_parsers = install.list_parsers
return M
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index b8d72dfbc..c83567310 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -236,4 +236,21 @@ function M.checkhealth()
end
end
+function M.list_parsers()
+ local max_len = 0
+ for parser_name, _ in pairs(repositories) do
+ if #parser_name > max_len then max_len = #parser_name end
+ end
+
+ for parser_name, _ in pairs(repositories) do
+ local is_installed = #api.nvim_get_runtime_file('parser/'..parser_name..'.so', false) > 0
+ api.nvim_out_write(parser_name..string.rep(' ', max_len - #parser_name + 1))
+ if is_installed then
+ api.nvim_out_write("[✓] installed\n")
+ else
+ api.nvim_out_write("[✗] not installed\n")
+ end
+ end
+end
+
return M