mirror of
https://github.com/windwp/nvim-ts-autotag.git
synced 2025-01-02 12:09:16 -06:00
Price Hiller
6e9742a006
This has deprecated `nvim-treesitter` setup. It has *not* been removed yet. I intend to tag the previous commit to this as `0.1.0` and then fully remove `nvim-treesitter` setup support in `1.0.0` -- a breaking change. TODO: We *must* have a way of detaching the plugin for a given buffer or even globally. Currently the plugin does not have it's own capabilities to do so.
45 lines
1.2 KiB
Lua
45 lines
1.2 KiB
Lua
local internal = require("nvim-ts-autotag.internal")
|
|
|
|
local M = {}
|
|
|
|
---@deprecated
|
|
---Will be removed in 1.0.0
|
|
function M.init()
|
|
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,
|
|
},
|
|
})
|
|
end
|
|
end
|
|
|
|
function M.setup(opts)
|
|
internal.setup(opts)
|
|
vim.cmd([[augroup nvim_ts_xmltag]])
|
|
vim.cmd([[autocmd!]])
|
|
vim.cmd([[autocmd FileType * call v:lua.require('nvim-ts-autotag.internal').attach()]])
|
|
vim.cmd([[autocmd BufDelete * lua require('nvim-ts-autotag.internal').detach(vim.fn.expand('<abuf>'))]])
|
|
vim.cmd([[augroup end]])
|
|
end
|
|
|
|
return M
|