Compare commits

..

39 Commits

Author SHA1 Message Date
cecb6f2175
refactor!: ADD FORK DEPRECATION NOTICE -- USE UPSTREAM! 2024-05-19 21:37:35 -05:00
e4f9252120
Revert "docs: replace Sponsor in README with Fork Status"
This reverts commit 9b90325db132106218ea6438e7db4f89b436c3f2.
2024-05-19 07:13:42 -05:00
6d690fc131
fix: remove hanging end 2024-05-19 07:03:37 -05:00
209162fde6
ci: use nvim 0.10.0 2024-05-19 07:02:57 -05:00
262a48b242
Revert 14e1f22 'ci: use self-hosted runner' 2024-05-19 07:02:57 -05:00
f655badbb1
Revert 1aff7cb 'ci: add Lint stage' 2024-05-19 07:02:57 -05:00
c43a896ebe
ci: add Lint stage 2024-05-19 07:02:57 -05:00
43669cf7b9
docs!: require >= nvim 0.9.5 2024-05-19 07:02:57 -05:00
ca9ba06e83
refactor: private did_setup opt in Setup 2024-05-19 07:02:56 -05:00
dcbae6df1e
docs: update README setup example 2024-05-19 07:02:56 -05:00
e8ae6e8df3
fix: correctly check for legacy setup 2024-05-19 07:02:56 -05:00
57e7c6c27b
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-19 07:02:56 -05:00
de4f720e00
feat!: overhaul the config setup
This deprecates the old setup layout

Closes https://github.com/PriceHiller/nvim-ts-autotag/issues/5
2024-05-19 07:02:56 -05:00
a14fc79546
fix: correctly attach to supported buffers
Closes https://github.com/PriceHiller/nvim-ts-autotag/issues/7
2024-05-19 07:02:56 -05:00
8e3a7aa96f
refactor: simplify internal setup 2024-05-19 07:02:56 -05:00
ea02d622c3
feat!: remove hard dependency on nvim-treesitter
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.
2024-05-19 07:02:34 -05:00
6c8f07b102
refactor: remove useless/empty function 2024-05-19 07:02:10 -05:00
a4d19476c8
refactor: use vim.keymap.set for bindings 2024-05-19 07:02:10 -05:00
ef6f6e0d48
style: remove stylua ignores 2024-05-19 07:02:10 -05:00
7f91215f15
ci: use self-hosted runner 2024-05-19 07:02:10 -05:00
3925ec3f34
ci: update os to ubuntu-24.04 2024-05-19 07:02:10 -05:00
9d9d0a812e
ci: install tree-sitter-cli 2024-05-19 07:02:09 -05:00
03cc1b52ff
ci: remove old test cruft 2024-05-19 07:02:07 -05:00
9191009088
fix: force a full reparse of ts source
PERF: This will impact performance, something to keep an eye on.

Prior to this commit, some parsers like php were failing in tests. By
forcing a full reparse, the php parser among others get the correct
tree.
2024-05-19 07:01:59 -05:00
1299cbc639
test: improve treesitter setup 2024-05-19 07:01:47 -05:00
8c1895066c
refactor: move .luarc.json to toplevel 2024-05-19 07:01:46 -05:00
fe3dbcc277
test: actually call nvim-treesitter.configs setup 2024-05-19 07:01:46 -05:00
c16ff16926
test: use sync install for ts parsers 2024-05-19 07:01:46 -05:00
20491dc57e
fix: reparse source if the node has changes 2024-05-19 07:01:46 -05:00
Yussef Dalton
99af6de7cd
Add Blade filetype
The only thing that's missing is it doesn't indent properly when you
close a tag, but otherwise it closes properly.
2024-05-19 07:01:46 -05:00
a33dc74d47
ci: use neovim nightly 2024-05-19 07:01:42 -05:00
ee56a21770
test: overhaul test setup and make commands 2024-05-19 07:01:20 -05:00
a6728af239
refactor: migrate plugin/ file to lua from vimscript 2024-05-19 07:01:03 -05:00
4466bdcfeb
style: format with stylua 2024-05-19 07:01:00 -05:00
ae27db72e4
fix(svelte): use correct close tag patterns
See https://github.com/windwp/nvim-ts-autotag/pull/167

Co-authored-by: "roy.crippen4" <roy.crippen4@archarithms.com>
2024-05-19 07:00:45 -05:00
Léo DEVILLE
42c89e163b
Add twig filetype
See https://github.com/windwp/nvim-ts-autotag/pull/169

Signed-off-by: Price Hiller <price@orion-technologies.io>
Co-authored-by: Ystri0n <164430108+Ystri0n@users.noreply.github.com>
2024-05-19 07:00:45 -05:00
0121209f76
docs: use correct option: skip_tags -> skip_tag
See https://github.com/windwp/nvim-ts-autotag/pull/170

Co-authored-by: nicoqh <nicoqh@gmail.com>
2024-05-19 07:00:45 -05:00
9b90325db1
docs: replace Sponsor in README with Fork Status 2024-05-19 07:00:45 -05:00
8ff2824168
fix: update tag patterns to support new XML TS tags 2024-05-19 07:00:45 -05:00
9 changed files with 18 additions and 36 deletions

View File

@ -115,8 +115,6 @@ vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
}
)
```
## Contributors
Thank [@PriceHiller](https://github.com/PriceHiller) for his work on this plugin.
## Sponsor
If you find this plugin useful, please consider sponsoring the project.

View File

@ -31,6 +31,10 @@ function M.init()
})
end
vim.notify(
"[nvim-ts-autotag]: Go back to upstream https://github.com/windwp/nvim-ts-autotag and stop using the fork. The fork author is now a maintainer upstream and the primary owner is back. This fork will see no more updates on this branch.",
vim.log.levels.WARN
)
M.setup = require("nvim-ts-autotag.config.plugin").setup
return M

View File

@ -1,5 +1,3 @@
local utils = require("nvim-ts-autotag.utils")
---@alias nvim-ts-autotag.FiletypeConfigPattern string[] A single array of patterns
---@alias nvim-ts-autotag.FiletypeConfig.filetype string The supported filetype for a given Filetype Config
@ -85,7 +83,7 @@ function FiletypeConfig:extend(filetype, patterns)
new.filetype = filetype
for pat_key, pats in pairs(patterns or {}) do
for _, pat in ipairs(pats) do
if not utils.list_contains(new.patterns[pat_key], pat) then
if not vim.list_contains(new.patterns[pat_key], pat) then
table.insert(new.patterns[pat_key], pat)
end
end

View File

@ -91,13 +91,13 @@ local function setup_tag_configs()
TagConfigs:add(base_cfg:extend("templ", {
start_tag_pattern = { "tag_start" },
start_name_tag_pattern = { "element_identifier", "name" },
start_name_tag_pattern = { "element_identifier" },
end_tag_pattern = { "tag_end" },
end_name_tag_pattern = { "element_identifier", "name" },
close_tag_pattern = { "tag_end" },
close_name_tag_pattern = { "element_identifier", "name" },
end_name_tag_pattern = { "element_identifier" },
close_tag_pattern = { "erroneous_end_tag" },
close_name_tag_pattern = { "erroneous_end_tag_name" },
element_tag = { "element" },
skip_tag_pattern = { "quoted_attribute_value", "tag_end", "attribute", "value" },
skip_tag_pattern = { "quoted_attribute_value", "tag_end" },
}))
end

View File

@ -214,7 +214,7 @@ local function check_close_tag(close_slash_tag)
})
if tag_node ~= nil then
local tag_name = get_tag_name(tag_node)
if tag_name ~= nil and utils.list_contains(ts_tag.skip_tag_pattern, tag_name) then
if tag_name ~= nil and vim.list_contains(ts_tag.skip_tag_pattern, tag_name) then
return false
end
if tag_node ~= nil then

View File

@ -7,25 +7,6 @@ M.get_node_text = function(node)
return vim.split(txt, "\n") or {}
end
-- Stolen from nvim `0.10.0` for `0.9.5` users
--- Checks if a list-like table (integer keys without gaps) contains `value`.
---
---
---@param t table Table to check (must be list-like, not validated)
---@param value any Value to compare
---@return boolean `true` if `t` contains `value`
M.list_contains = function(t, value)
vim.validate({ t = { t, "t" } })
--- @cast t table<any,any>
for _, v in ipairs(t) do
if v == value then
return true
end
end
return false
end
M.verify_node = function(node, node_tag)
local txt = get_node_text(node, vim.api.nvim_get_current_buf())
if txt:match(string.format("^<%s>", node_tag)) and txt:match(string.format("</%s>$", node_tag)) then

View File

@ -72,7 +72,7 @@ local compare_text = function(linenr, text_after, name, cursor_add, end_cursor)
end
return true
end
local islist = vim.islist or vim.tbl_islist
M.Test_withfile = function(test_data, cb)
for _, value in pairs(test_data) do
it("test " .. value.name, function()
@ -82,7 +82,7 @@ M.Test_withfile = function(test_data, cb)
linenr = value.linenr,
colnr = 0,
}
if not islist(value.before) then
if not vim.islist(value.before) then
value.before = { value.before }
end
for index, text in pairs(value.before) do
@ -95,7 +95,7 @@ M.Test_withfile = function(test_data, cb)
end
end
end
if not islist(value.after) then
if not vim.islist(value.after) then
value.after = { value.after }
end
vim.bo.filetype = value.filetype or "text"

View File

@ -7,9 +7,8 @@ local M = {}
local function search_dir_up(test_file)
-- This is the path of the directory of the current file
local cur_dir = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p")
local uv = vim.uv or vim.loop
---@diagnostic disable-next-line: param-type-mismatch
while not uv.fs_stat(cur_dir .. "/" .. test_file, nil) and cur_dir ~= "/" do
while not vim.uv.fs_stat(cur_dir .. "/" .. test_file, nil) and cur_dir ~= "/" do
cur_dir = vim.fn.fnamemodify(cur_dir, ":h")
end
if cur_dir == "/" then

View File

@ -6,7 +6,9 @@ M.paths = path_utils
--- Register the main plugin (`nvim-ts-autotag`) on the runtimepath if it hasn't already been
--- registered
M.rtp_register_ts_autotag = function()
vim.opt.runtimepath:append(path_utils.static.ts_autotag_dir())
if not vim.list_contains(vim.opt.runtimepath, path_utils.static.ts_autotag_dir()) then
vim.opt.runtimepath:append(path_utils.static.ts_autotag_dir())
end
end
return M