fix: preview = true (#2168)

This commit is contained in:
Simon Hauser
2022-10-08 07:46:08 +02:00
committed by GitHub
parent 76ea9a898d
commit 3a29c1e89d
3 changed files with 23 additions and 5 deletions

View File

@@ -78,9 +78,22 @@ end
--- Attach default highlighter which will choose between regex and ts
utils.highlighter = function(bufnr, ft, opts)
opts = opts or {}
opts.preview = opts.preview or {}
opts.preview.treesitter = vim.F.if_nil(opts.preview.treesitter, conf.preview.treesitter)
opts = vim.F.if_nil(opts, {})
opts.preview = vim.F.if_nil(opts.preview, {})
opts.preview.treesitter = (function()
if type(opts.preview) == "table" and opts.preview.treesitter then
return opts.preview.treesitter
end
if type(conf.preview) == "table" and conf.preview.treesitter then
return conf.preview.treesitter
end
if type(conf.preview) == "boolean" then
return conf.preview
end
-- We should never get here
return false
end)()
if type(opts.preview.treesitter) == "boolean" then
local temp = { enable = opts.preview.treesitter }
opts.preview.treesitter = temp