mirror of
https://github.com/windwp/nvim-ts-autotag.git
synced 2024-12-28 21:19:16 -06:00
chore: formatting and clarification comment
This commit is contained in:
parent
2553ac5520
commit
33a38a53b1
@ -11,8 +11,8 @@ function M.is_react_file()
|
||||
elseif ft ~= "javascript" then
|
||||
return false
|
||||
end
|
||||
-- If we are in a `javascript` file, then check the content to see if the
|
||||
-- current file counts as a react file
|
||||
-- If we are in a `javascript` file, then check the content to see if the
|
||||
-- current file counts as a react file
|
||||
local ok, buf_parser = pcall(vim.treesitter.get_parser)
|
||||
if not ok then
|
||||
return false
|
||||
@ -24,7 +24,7 @@ function M.is_react_file()
|
||||
end
|
||||
|
||||
local root = tree[1]:root()
|
||||
local queries = { 'jsx_element', 'jsx_self_closing_element' }
|
||||
local queries = { "jsx_element", "jsx_self_closing_element" }
|
||||
|
||||
for _, query in ipairs(queries) do
|
||||
if M.node_exists(root, query) then
|
||||
@ -35,8 +35,6 @@ function M.is_react_file()
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
---@return boolean
|
||||
function M.is_react_fragment()
|
||||
local line = vim.fn.getline(".")
|
||||
@ -63,8 +61,6 @@ function M.node_exists(node, query)
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
M.get_node_text = function(node)
|
||||
local _, txt = pcall(get_node_text, node, vim.api.nvim_get_current_buf())
|
||||
return vim.split(txt, "\n") or {}
|
||||
|
@ -145,7 +145,7 @@ local data = {
|
||||
linenr = 12,
|
||||
key = [[>]],
|
||||
before = [[<|<div></div>]],
|
||||
after = [[<>|</><div></div>]]
|
||||
after = [[<>|</><div></div>]],
|
||||
},
|
||||
{
|
||||
name = "17 javascript autoclose fragment",
|
||||
@ -154,7 +154,7 @@ local data = {
|
||||
linenr = 12,
|
||||
key = [[>]],
|
||||
before = [[<|<div></div>]],
|
||||
after = [[<>|</><div></div>]]
|
||||
after = [[<>|</><div></div>]],
|
||||
},
|
||||
{
|
||||
name = "18 vue auto close tag",
|
||||
|
Loading…
Reference in New Issue
Block a user