Skip to content

Commit 7c21f30

Browse files
committed
fix(previewer): disable ts without highlights.scm
1 parent 4be5156 commit 7c21f30

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/fzf-lua/utils.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,11 @@ end
14701470
---@return boolean
14711471
function M.has_ts_parser(lang)
14721472
if M.__HAS_NVIM_011 then
1473-
return vim.treesitter.language.add(lang) and true or false
1473+
return vim.treesitter.language.add(lang)
1474+
-- ensure the language has a highlights parser or we get
1475+
-- no highlights for langugaes like json/jsonc/toml/etc
1476+
and #vim.treesitter.query.get_files(lang, "highlights") > 0
1477+
or false
14741478
else
14751479
return (pcall(vim.treesitter.language.add, lang))
14761480
end

0 commit comments

Comments
 (0)