fix: crash in preview on nvim 0.8
This commit is contained in:
parent
6f9e1057c5
commit
81b2c5f04a
1 changed files with 1 additions and 1 deletions
|
|
@ -926,7 +926,7 @@ M.read_file_to_scratch_buffer = function(path, preview_method)
|
|||
return
|
||||
end
|
||||
local ft = vim.filetype.match({ filename = path, buf = bufnr })
|
||||
if ft and ft ~= "" then
|
||||
if ft and ft ~= "" and vim.treesitter.language.get_lang then
|
||||
local lang = vim.treesitter.language.get_lang(ft)
|
||||
if not pcall(vim.treesitter.start, bufnr, lang) then
|
||||
vim.bo[bufnr].syntax = ft
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue