fix: config is enabled also checks parser existence

This commit is contained in:
kiyan42 2020-04-25 16:11:53 +02:00
parent bae9f32952
commit f489b4b0a3
2 changed files with 8 additions and 7 deletions

View file

@ -1,5 +1,4 @@
local api = vim.api
local parsers = require'nvim-treesitter.parsers'
local install = require'nvim-treesitter.install'
local locals = require'nvim-treesitter.locals'
local utils = require'nvim-treesitter.utils'
@ -17,7 +16,7 @@ function M.setup(lang)
for _, ft in pairs(configs.available_parsers()) do
for _, mod in pairs(configs.available_modules()) do
if parsers.has_parser(ft) and configs.is_enabled(mod, ft) then
if configs.is_enabled(mod, ft) then
local cmd = string.format("lua require'nvim-treesitter.%s'.attach()", mod)
api.nvim_command(string.format("autocmd FileType %s %s", ft, cmd))
end