diff options
| author | kiyan42 <yazdani.kiyan@protonmail.com> | 2020-06-20 12:21:42 +0200 |
|---|---|---|
| committer | kiyan42 <yazdani.kiyan@protonmail.com> | 2020-06-20 12:31:52 +0200 |
| commit | df17a48c85b8e47bc4982b640dbb686e372cd81e (patch) | |
| tree | a3071e4c045485bf70b4d508887305d4f279a8c7 /lua/nvim-treesitter/install.lua | |
| parent | ad636f4f5306b7741bc55ad63e6b12f9379a2515 (diff) | |
refactor: parser list and lang->ft/ft->lang
- move parser list in `parsers.lua`
- most `ft` variable where changed to `lang`, `ft` is only used on
autocmd binding, and lang is used for everything else. Functions have
been defined to make the switch between `ft` and `lang`
Diffstat (limited to 'lua/nvim-treesitter/install.lua')
| -rw-r--r-- | lua/nvim-treesitter/install.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua index 381afaa4..c2eeaf76 100644 --- a/lua/nvim-treesitter/install.lua +++ b/lua/nvim-treesitter/install.lua @@ -2,7 +2,6 @@ local api = vim.api local fn = vim.fn local luv = vim.loop -local configs = require'nvim-treesitter.configs' local utils = require'nvim-treesitter.utils' local parsers = require'nvim-treesitter.parsers' @@ -103,7 +102,7 @@ local function install(...) if not string.match(yesno, '^y.*') then return end end - local parser_config = configs.get_parser_configs()[ft] + local parser_config = parsers.get_parser_configs()[ft] if not parser_config then return api.nvim_err_writeln('Parser not available for language '..ft) end @@ -122,15 +121,15 @@ end M.ensure_installed = function(languages) if type(languages) == 'string' then if languages == 'all' then - languages = configs.available_parsers() + languages = parsers.available_parsers() else languages = {languages} end end - for _, ft in ipairs(languages) do - if not parsers.has_parser(ft) then - install(ft) + for _, lang in ipairs(languages) do + if not parsers.has_parser(lang) then + install(lang) end end end |
