Skip to content

Commit

Permalink
fix: error when disable config returns false
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
mrcjkb authored Aug 29, 2024
1 parent fd0c830 commit 63b711c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/rocks_treesitter/highlight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,12 @@ function highlight.create_autocmd()
local filetype = vim.bo[bufnr].filetype
local lang = get_lang(filetype)
---@type boolean | nil
local disable = type(config.disable) == "function" and config.disable(lang, bufnr)
or config.disable[filetype]
local disable
if type(config.disable) == "function" then
disable = config.disable(lang, bufnr)
else
disable = config.disable[filetype]
end
if not disable and config.auto_highlight == "all" or config.auto_highlight[lang] then
do_highlight(lang)
end
Expand Down

0 comments on commit 63b711c

Please sign in to comment.