Skip to content

Commit 7ca9204

Browse files
fix: Statistics syntax highlight (#540)
Check if language is nil before calling `vim.treesitter.start`
1 parent 949b585 commit 7ca9204

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/rest-nvim/ui/result.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ local function syntax_highlight(buffer, filetype)
2323
-- manually stop any attached tree-sitter parsers (#424, #429)
2424
vim.treesitter.stop(buffer)
2525
local lang = vim.treesitter.language.get_lang(filetype)
26-
local ok = pcall(vim.treesitter.start, buffer, lang)
26+
local ok = lang ~= nil and pcall(vim.treesitter.start, buffer, lang)
2727
if not lang or not ok then
2828
vim.bo[buffer].syntax = filetype
2929
end

0 commit comments

Comments
 (0)