fix(highlight): Use TS built-in is_enabled function (#1513)
The function just replicated the logic from is_enabled and assumed the `disable` setting is always a table. This is no longer the case (https://github.com/nvim-treesitter/nvim-treesitter/pull/2009), it can now also be a function.
This commit is contained in:
@@ -96,11 +96,11 @@ end
|
||||
|
||||
local treesitter_attach = function(bufnr, ft)
|
||||
local lang = ts_parsers.ft_to_lang(ft)
|
||||
if ts_parsers.has_parser(lang) then
|
||||
local config = ts_configs.get_module "highlight"
|
||||
if vim.tbl_contains(config.disable, lang) then
|
||||
if not ts_configs.is_enabled("highlight", lang, bufnr) then
|
||||
return false
|
||||
end
|
||||
|
||||
local config = ts_configs.get_module "highlight"
|
||||
for k, v in pairs(config.custom_captures) do
|
||||
vim.treesitter.highlighter.hl_map[k] = v
|
||||
end
|
||||
@@ -114,8 +114,6 @@ local treesitter_attach = function(bufnr, ft)
|
||||
end
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Attach ts highlighter
|
||||
utils.ts_highlighter = function(bufnr, ft)
|
||||
|
||||
Reference in New Issue
Block a user