local ts = require("nvim-treesitter.configs") ts.setup({ ensure_installed = _G.ts_filetypes, highlight = { use_languagetree = false, enable = true, }, fold = { enable = false }, }) local data = { { name = "html rename open tag", filepath = "./sample/index.html", filetype = "html", linenr = 10, key = [[ciwlala]], before = [[ dsadsa ]], after = [[ dsadsa ]], }, { name = "html rename open tag with attr", filepath = "./sample/index.html", filetype = "html", linenr = 10, key = [[ciwlala]], before = [[ dsadsa ]], after = [[ dsadsa ]], }, { name = "html rename close tag with attr", filepath = "./sample/index.html", filetype = "html", linenr = 10, key = [[ciwlala]], before = [[
dsadsa ]], after = [[ dsadsa ]], }, { name = "html not rename close tag on char <", filepath = "./sample/index.html", filetype = "html", linenr = 10, key = [[i<]], before = [[
dsadsa |/button> ]], after = [[
dsadsa <|/button> ]], }, { name = "html not rename close tag with not valid", filepath = "./sample/index.html", filetype = "html", linenr = 12, key = [[ciwlala]], before = { [[]], }, after = [[
]], -- [[
"]] -- }, -- after = [[
]] -- }, { name = "html not rename close tag with not valid", filepath = "./sample/index.html", filetype = "html", linenr = 12, key = [[ciwlala]], before = { [[
]], }, after = [[
]], }, { name = "typescriptreact rename open tag", filepath = "./sample/index.tsx", filetype = "typescriptreact", linenr = 12, key = [[ciwlala]], before = [[ dsadsa
]], after = [[ dsadsa ]], }, { name = "typescriptreact rename open tag with attr", filepath = "./sample/index.tsx", filetype = "typescriptreact", linenr = 12, key = [[ciwlala]], before = [[ dsadsa
]], after = [[ dsadsa
]], }, { name = "typescriptreact rename close tag with attr", filepath = "./sample/index.tsx", filetype = "html", linenr = 12, key = [[ciwlala]], before = [[
dsadsa ]], after = [[ dsadsa ]], }, { name = "17 typescriptreact nested indentifer ", filepath = "./sample/index.tsx", filetype = "typescriptreact", linenr = 12, key = [[ciwlala]], before = [[ ]], after = [[ ]], }, { name = "18 rename empty node ", filepath = "./sample/index.tsx", filetype = "typescriptreact", linenr = 12, key = [[ilala]], before = [[<|>
]], after = [[
]], }, { name = "19 rename start tag on svelte ", filepath = "./sample/index.svelte", filetype = "svelte", linenr = 18, key = [[ciwlala]], before = [[<|data>]], after = [[]], }, { name = "20 rename end tag on svelte ", filepath = "./sample/index.svelte", filetype = "svelte", linenr = 18, key = [[ciwlala]], before = [[]], after = [[]], }, { name = "21 rescript rename open tag", filepath = "./sample/index.res", filetype = "rescript", linenr = 12, key = [[ciwlala]], before = [[ dsadsa
]], after = [[ dsadsa ]], }, { name = "22 rescript rename open tag with attr", filepath = "./sample/index.res", filetype = "rescript", linenr = 12, key = [[ciwlala]], before = [[ dsadsa
]], after = [[ dsadsa ]], }, { name = "23 rescript rename close tag with attr", filepath = "./sample/index.res", filetype = "rescript", linenr = 12, key = [[ciwlala]], before = [[
dsadsa ]], after = [[ dsadsa ]], }, { name = "24 test check rename same with parent", filepath = "./sample/index.tsx", filetype = "typescriptreact", linenr = 12, key = "ciwkey", before = { "", " ", "", " ", "", }, after = { "", " ", "", " ", "", }, }, { name = "25 rename start have same node with parent", filepath = "./sample/index.tsx", filetype = "typescriptreact", linenr = 12, key = [[ciwlala]], before = { "
", " ", " test ", "
", "
", }, after = { "
", " ", " test ", " ", "
", }, }, { name = "26 rename should not rename tag on attribute node", filepath = "./sample/index.tsx", filetype = "typescriptreact", linenr = 12, key = [[ciwlala]], before = { "
", '', '
', '
', "
", "
", "
", }, after = { "
", '', '
', '
', "
", "
", "
", }, }, { name = "eruby rename open tag", filepath = "./sample/index.html.erb", filetype = "eruby", linenr = 10, key = [[ciwlala]], before = [[ dsadsa ]], after = [[ dsadsa ]], }, { name = "eruby rename open tag with attr", filepath = "./sample/index.html.erb", filetype = "eruby", linenr = 10, key = [[ciwlala]], before = [[ dsadsa ]], after = [[ dsadsa ]], }, { name = "eruby rename close tag with attr", filepath = "./sample/index.html.erb", filetype = "eruby", linenr = 10, key = [[ciwlala]], before = [[
dsadsa ]], after = [[ dsadsa ]], }, { name = "eruby not rename close tag on char <", filepath = "./sample/index.html.erb", filetype = "eruby", linenr = 10, key = [[i<]], before = [[
dsadsa |/button> ]], after = [[
dsadsa <|/button> ]], }, { name = "eruby not rename close tag with not valid", filepath = "./sample/index.html.erb", filetype = "eruby", linenr = 12, key = [[ciwlala]], before = { [[]], }, after = [[]], }, after = [[
]], }, { name = "eruby not rename tag-like ruby string", filepath = "./sample/index.html.erb", filetype = "eruby", linenr = 12, key = [[ciwlala]], before = { [[<%=
%>]], }, after = [[<%=
%>]], }, } local autotag = require("nvim-ts-autotag") autotag.test = true local run_data = _G.Test_filter(data) describe("[rename tag]", function() _G.Test_withfile(run_data, { cursor_add = 0, before_each = function(value) end, }) end)