summaryrefslogtreecommitdiff
path: root/lua/nvim-treesitter/install.lua
diff options
context:
space:
mode:
authorkiyan42 <yazdani.kiyan@protonmail.com>2020-04-20 22:33:13 +0200
committerkiyan42 <yazdani.kiyan@protonmail.com>2020-04-20 22:33:13 +0200
commit0de42dd7fb16c2255403493d6426ab816a5fa8ae (patch)
treeb56fe62d3471cc72824c5f00ef0598c2b2fabdc9 /lua/nvim-treesitter/install.lua
parent3975ca91f66a2ce7d1d113c445bd25877a1eab34 (diff)
feat: add parser list
Diffstat (limited to 'lua/nvim-treesitter/install.lua')
-rw-r--r--lua/nvim-treesitter/install.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index 8e39be5e..f55aa141 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -135,4 +135,21 @@ function M.install_parser(ft)
run_install(cache_folder, package_path, ft, repository.files, repository.url)
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