Skip to content

Commit

Permalink
fix: Statistics syntax highlight (#540)
Browse files Browse the repository at this point in the history
Check if language is nil before calling `vim.treesitter.start`
  • Loading branch information
cristianradulescu authored Mar 6, 2025
1 parent 949b585 commit 7ca9204
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/rest-nvim/ui/result.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local function syntax_highlight(buffer, filetype)
-- manually stop any attached tree-sitter parsers (#424, #429)
vim.treesitter.stop(buffer)
local lang = vim.treesitter.language.get_lang(filetype)
local ok = pcall(vim.treesitter.start, buffer, lang)
local ok = lang ~= nil and pcall(vim.treesitter.start, buffer, lang)
if not lang or not ok then
vim.bo[buffer].syntax = filetype
end
Expand Down

0 comments on commit 7ca9204

Please sign in to comment.