From 882e58c2dccce0adba30a7d483af15fbe40dd70b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 25 Oct 2022 13:37:31 +0200 Subject: [PATCH] fix: fallback to syntax if treesitter parser is not available --- lua/noice/view/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/noice/view/init.lua b/lua/noice/view/init.lua index 44d22ee..088e5b3 100644 --- a/lua/noice/view/init.lua +++ b/lua/noice/view/init.lua @@ -201,7 +201,9 @@ function View:render(buf, opts) end if self._opts.lang and not vim.b[buf].ts_highlight then - pcall(vim.treesitter.start, buf, self._opts.lang) + if not pcall(vim.treesitter.start, buf, self._opts.lang) then + vim.bo[buf].syntax = self._opts.lang + end end vim.api.nvim_buf_clear_namespace(buf, Config.ns, linenr - 1, -1)