From 63b711c6d0d10db80ff8550cfe840bd7d2200967 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Thu, 29 Aug 2024 14:01:49 +0700 Subject: [PATCH] fix: error when disable config returns `false` Fixes #31 --- lua/rocks_treesitter/highlight.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/rocks_treesitter/highlight.lua b/lua/rocks_treesitter/highlight.lua index 102b4d0..e85b922 100644 --- a/lua/rocks_treesitter/highlight.lua +++ b/lua/rocks_treesitter/highlight.lua @@ -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