diff options
| author | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-04-21 20:14:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-21 20:14:41 +0200 |
| commit | fbf6efd5b190b7d8327cd4ecbcaf5404fb0424e6 (patch) | |
| tree | ea293f7e27fd74983dfde74dd5fb11100ea80fa2 /lua/nvim-treesitter/install.lua | |
| parent | 522030f1482c200480facbeb2d1d04130e06a997 (diff) | |
| parent | 0de42dd7fb16c2255403493d6426ab816a5fa8ae (diff) | |
Merge pull request #11 from kyazdani42/parser-list
feat: add parser list
Diffstat (limited to 'lua/nvim-treesitter/install.lua')
| -rw-r--r-- | lua/nvim-treesitter/install.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index b8d72dfb..c8356731 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 |
