From c88c4ffbb41c10dfd36e3405f4619e355ebee58d Mon Sep 17 00:00:00 2001 From: bekaboo <18127878294@qq.com> Date: Sat, 25 Nov 2023 03:05:10 +0800 Subject: [PATCH] fix(sources-treesitter): active ts parser ignore if highlight disabled --- lua/dropbar/sources/treesitter.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/dropbar/sources/treesitter.lua b/lua/dropbar/sources/treesitter.lua index 9ed527ad..80aa6c56 100644 --- a/lua/dropbar/sources/treesitter.lua +++ b/lua/dropbar/sources/treesitter.lua @@ -150,7 +150,8 @@ end ---@param cursor integer[] cursor position ---@return dropbar_symbol_t[] symbols winbar symbols local function get_symbols(buf, win, cursor) - if not vim.treesitter.highlighter.active[buf] then + local ts_ok = pcall(vim.treesitter.get_parser, buf or 0, vim.b[buf].ft) + if not ts_ok then return {} end