From 971547b9acb086ddceb50a03467be47b2aa0e0f0 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Wed, 15 May 2024 09:00:51 -0500 Subject: [PATCH] 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. --- lua/nvim-ts-autotag/internal.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/nvim-ts-autotag/internal.lua b/lua/nvim-ts-autotag/internal.lua index 029de73..fa1eb98 100644 --- a/lua/nvim-ts-autotag/internal.lua +++ b/lua/nvim-ts-autotag/internal.lua @@ -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