Skip to content

Commit 27c4083

Browse files
Fix treesitter highlight disable property being a function. Closes #204.
1 parent ae8554b commit 27c4083

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lua/orgmode/config/init.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,19 @@ function Config:ts_highlights_enabled()
271271
end
272272
self.ts_hl_enabled = false
273273
local hl_module = require('nvim-treesitter.configs').get_module('highlight')
274-
if hl_module and hl_module.enable and not vim.tbl_contains(hl_module.disable or {}, 'org') then
275-
self.ts_hl_enabled = true
274+
if not hl_module or not hl_module.enable then
275+
return false
276276
end
277+
if hl_module.disable then
278+
if type(hl_module.disable) == 'function' and hl_module.disable('org', vim.api.nvim_get_current_buf()) then
279+
return false
280+
end
281+
282+
if type(hl_module.disable) == 'table' and vim.tbl_contains(hl_module.disable, 'org') then
283+
return false
284+
end
285+
end
286+
self.ts_hl_enabled = true
277287
return self.ts_hl_enabled
278288
end
279289

0 commit comments

Comments
 (0)