mirror of
https://github.com/windwp/nvim-ts-autotag.git
synced 2024-12-28 07:19:16 -06:00
fix: Don't auto tag fragment if not in jsx (#210)
This commit is contained in:
parent
dc5e1687ab
commit
0cb76eea80
@ -37,6 +37,13 @@ end
|
||||
|
||||
---@return boolean
|
||||
function M.is_react_fragment()
|
||||
local node = vim.treesitter.get_node()
|
||||
|
||||
-- Bail out if the treesitter doesn't recognize `<>` as jsx_opening_element
|
||||
if not node or node:type() ~= "jsx_opening_element" then
|
||||
return false
|
||||
end
|
||||
|
||||
local line = vim.fn.getline(".")
|
||||
local col = vim.fn.col(".") - 2
|
||||
local strpart = vim.fn.strpart(line, col)
|
||||
|
@ -255,6 +255,15 @@ local data = {
|
||||
before = [[<input| ]],
|
||||
after = [[<input>| ]],
|
||||
},
|
||||
{
|
||||
name = "28 typescriptreact not close fragment in generic argument delimeters",
|
||||
filepath = "./sample/index.tsx",
|
||||
filetype = "typescriptreact",
|
||||
linenr = 1,
|
||||
key = [[>]],
|
||||
before = [[type Foo = Bar<| ]],
|
||||
after = [[type Foo = Bar<>]],
|
||||
},
|
||||
}
|
||||
|
||||
local autotag = require("nvim-ts-autotag")
|
||||
|
Loading…
Reference in New Issue
Block a user