2022-02-03 22:24:23 -06:00
|
|
|
local internal = require("nvim-ts-autotag.internal")
|
2021-03-10 00:09:41 -06:00
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
2024-05-19 07:02:34 -05:00
|
|
|
---@deprecated
|
|
|
|
---Will be removed in 1.0.0
|
2021-03-10 00:09:41 -06:00
|
|
|
function M.init()
|
2024-05-19 07:02:34 -05:00
|
|
|
local _, nvim_ts = pcall(require, "nvim-treesitter")
|
|
|
|
if not nvim_ts then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
nvim_ts.define_modules({
|
|
|
|
autotag = {
|
|
|
|
attach = function(bufnr, lang)
|
|
|
|
vim.deprecate(
|
|
|
|
"Nvim Treesitter Setup",
|
|
|
|
"`require('nvim-ts-autotag').setup()`",
|
|
|
|
"1.0.0",
|
|
|
|
"nvim-ts-autotag",
|
|
|
|
true
|
|
|
|
)
|
|
|
|
internal.attach(bufnr, lang)
|
|
|
|
end,
|
|
|
|
detach = function(bufnr)
|
|
|
|
internal.detach(bufnr)
|
|
|
|
end,
|
|
|
|
is_supported = function(lang)
|
|
|
|
return internal.is_supported(lang)
|
|
|
|
end,
|
|
|
|
},
|
2024-05-18 08:18:45 -05:00
|
|
|
})
|
|
|
|
end
|
2021-03-10 00:09:41 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
function M.setup(opts)
|
2024-05-19 07:01:00 -05:00
|
|
|
internal.setup(opts)
|
2024-05-15 02:53:46 -05:00
|
|
|
local augroup = vim.api.nvim_create_augroup("nvim_ts_xmltag", { clear = true })
|
|
|
|
vim.api.nvim_create_autocmd("Filetype", {
|
|
|
|
group = augroup,
|
|
|
|
callback = function(args)
|
|
|
|
require("nvim-ts-autotag.internal").attach(args.buf)
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("BufDelete", {
|
|
|
|
group = augroup,
|
|
|
|
callback = function(args)
|
|
|
|
require("nvim-ts-autotag.internal").detach(args.buf)
|
|
|
|
end,
|
|
|
|
})
|
2021-03-10 00:09:41 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|