Skip to content

Commit

Permalink
fix: fallback to syntax if treesitter parser is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Oct 25, 2022
1 parent 2eb646f commit 882e58c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/noice/view/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 882e58c

Please sign in to comment.