From 56b8847c2943eb9bd6da0bc7d61787465bc0d098 Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Sun, 3 Nov 2024 18:15:43 +0200 Subject: [PATCH] fix(lazyfile): change logic to add `syntax=ft` instead of disabling the parser --- lua/lazyvim/plugins/extras/lang/tex.lua | 2 +- lua/lazyvim/util/plugin.lua | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/tex.lua b/lua/lazyvim/plugins/extras/lang/tex.lua index 2f7b6017..53f881e8 100644 --- a/lua/lazyvim/plugins/extras/lang/tex.lua +++ b/lua/lazyvim/plugins/extras/lang/tex.lua @@ -13,7 +13,7 @@ return { if vim.fn.argc() > 0 and vim.fn.isdirectory(vim.fn.argv(0) --[[@as string]]) ~= 1 then - vim.g.treesitter_disable_highlight = { "latex" } + vim.g.treesitter_syntax_legacy = { "latex" } end end, opts = function(_, opts) diff --git a/lua/lazyvim/util/plugin.lua b/lua/lazyvim/util/plugin.lua index b84d4590..0f516442 100644 --- a/lua/lazyvim/util/plugin.lua +++ b/lua/lazyvim/util/plugin.lua @@ -86,12 +86,12 @@ function M.lazy_file() if ft then -- Add treesitter highlights and fallback to syntax local lang = vim.treesitter.language.get_lang(ft) - if vim.tbl_contains(vim.g.treesitter_disable_highlight or {}, lang) then - lang = nil - end if not (lang and pcall(vim.treesitter.start, event.buf, lang)) then vim.bo[event.buf].syntax = ft end + if vim.tbl_contains(vim.g.treesitter_syntax_legacy or {}, lang) then + vim.bo[event.buf].syntax = ft + end -- Trigger early redraw vim.cmd([[redraw]])