From e8d8d1e6608e53e366109fc4f9d7ab364ea0fb5c Mon Sep 17 00:00:00 2001 From: Vhyrro Date: Sun, 24 Mar 2024 19:09:12 +0100 Subject: [PATCH] fix: remove old and hacky code related to nvim-treesitter's query cache invalidation --- lua/neorg/modules/core/highlights/module.lua | 38 +++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/lua/neorg/modules/core/highlights/module.lua b/lua/neorg/modules/core/highlights/module.lua index 622a572a6..08184d6f5 100644 --- a/lua/neorg/modules/core/highlights/module.lua +++ b/lua/neorg/modules/core/highlights/module.lua @@ -429,23 +429,27 @@ module.public = { --- Reads the highlights configuration table and applies all defined highlights trigger_highlights = function() - do - local query = require("nvim-treesitter.query") - - if not query.has_highlights("norg") then - query.invalidate_query_cache() - - if not query.has_highlights("norg") then - log.error( - "nvim-treesitter has no available highlights for norg! Ensure treesitter is properly loaded in your config." - ) - end - end - - if vim.bo.filetype == "norg" then - require("nvim-treesitter.highlight").attach(vim.api.nvim_get_current_buf(), "norg") - end - end + -- NOTE(vhyrro): This code was added here to work around oddities related to nvim-treesitter. + -- This code, with modern nvim-treesitter versions, will probably not break as harshly. + -- This code should be removed as soon as possible. + -- + -- do + -- local query = require("nvim-treesitter.query") + + -- if not query.has_highlights("norg") then + -- query.invalidate_query_cache() + + -- if not query.has_highlights("norg") then + -- log.error( + -- "nvim-treesitter has no available highlights for norg! Ensure treesitter is properly loaded in your config." + -- ) + -- end + -- end + + -- if vim.bo.filetype == "norg" then + -- require("nvim-treesitter.highlight").attach(vim.api.nvim_get_current_buf(), "norg") + -- end + -- end --- Recursively descends down the highlight configuration and applies every highlight accordingly ---@param highlights table #The table of highlights to descend down