refactor: pcall require on nvim-treesitter.configs

`nvim-treesitter.configs` is going to be removed soon -- directly requiring it will cause an error once it has been removed.
This commit is contained in:
Price Hiller 2024-05-15 09:00:51 -05:00 committed by windwp
parent 08e9ada208
commit 971547b9ac

View File

@ -443,7 +443,12 @@ end
M.attach = function(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
if not Setup.did_setup then
local config = require("nvim-treesitter.configs").get_module("autotag")
local _, ts_configs = pcall(require, "nvim-treesitter.configs")
if not ts_configs then
M.setup({ opts = {} })
end
local config = ts_configs.get_module("autotag")
Setup.setup(config)
end