fix: no TS highlight if it gets loaded after Telescope (#479)

This commit is contained in:
elianiva
2021-01-30 23:34:05 +07:00
committed by GitHub
parent 2a5db2f4f1
commit b1fb172b7f

View File

@@ -72,6 +72,14 @@ end
-- Attach ts highlighter -- Attach ts highlighter
utils.ts_highlighter = function(bufnr, ft) utils.ts_highlighter = function(bufnr, ft)
if not has_ts then
has_ts, _ = pcall(require, 'nvim-treesitter')
if has_ts then
_, ts_highlight = pcall(require, 'nvim-treesitter.highlight')
_, ts_parsers = pcall(require, 'nvim-treesitter.parsers')
end
end
if has_ts and has_filetype(ft) then if has_ts and has_filetype(ft) then
local lang = ts_parsers.ft_to_lang(ft); local lang = ts_parsers.ft_to_lang(ft);
if ts_parsers.has_parser(lang) then if ts_parsers.has_parser(lang) then