Compare commits

..

2 Commits

Author SHA1 Message Date
c2bd871627
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.
2024-05-15 09:22:41 -05:00
62f606918b
feat!: overhaul the config setup
This deprecates the old setup layout

Closes https://github.com/PriceHiller/nvim-ts-autotag/issues/5
2024-05-15 09:22:41 -05:00
2 changed files with 8 additions and 4 deletions

View File

@ -139,7 +139,7 @@ local Setup = {
per_filetype = {},
}
--- Do general plugin setup. Can be called multiple times to override values piecemeal.
--- Do general plugin setup
---@param opts nvim-ts-autotag.PluginSetup
function Setup.setup(opts)
if Setup.did_setup then
@ -147,8 +147,7 @@ function Setup.setup(opts)
end
if opts and not opts.opts then
vim.notify(
"nvim-ts-autotag: Using the legacy setup opts! Please migrate to the new setup options layout as this will eventually have its support removed in 1.0.0!"
.. vim.inspect(Setup.did_setup),
"nvim-ts-autotag: Using the legacy setup opts! Please migrate to the new setup options layout as this will eventually have its support removed in 1.0.0!",
vim.log.levels.WARN
)
opts = {

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