From b9dae579612ccf1cd749150ff1603ff6dffc2610 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sat, 9 Nov 2024 23:33:05 +0100 Subject: [PATCH] perf(ui): only enable treesitter folds if the buffer has treesitter highlighting --- lua/lazyvim/util/ui.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/lazyvim/util/ui.lua b/lua/lazyvim/util/ui.lua index 14d0850f..267137dc 100644 --- a/lua/lazyvim/util/ui.lua +++ b/lua/lazyvim/util/ui.lua @@ -53,6 +53,11 @@ local skip_check = assert(vim.uv.new_check()) function M.foldexpr() local buf = vim.api.nvim_get_current_buf() + -- no highlight, no foldexpr + if not vim.b[buf].ts_highlight then + return "0" + end + -- still in the same tick and no parser if M.skip_foldexpr[buf] then return "0"