Skip to content

Commit

Permalink
fix(treesitter): preload treesitter queries
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamHsieh committed Jul 30, 2024
1 parent 7b1a36c commit 452a10e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions config/nvim/lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
local M = {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
lazy = true,
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
cmd = "TSUpdate",
event = "LazyFile",
event = { "LazyFile", "VeryLazy" },

-- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
-- no longer trigger the **nvim-treesitter** module to be loaded in time.
-- Luckily, the only things that those plugins need are the custom queries, which we make available
-- during startup.
init = function(plugin)
require("lazy.core.loader").add_to_rtp(plugin)
require("nvim-treesitter.query_predicates")
end,

dependencies = {
"andymass/vim-matchup",
"windwp/nvim-ts-autotag",
Expand Down

0 comments on commit 452a10e

Please sign in to comment.