From 33a38a53b160e382a7b61e096e7835bc833e9e6d Mon Sep 17 00:00:00 2001 From: "roy.crippen4" Date: Sun, 14 Jul 2024 17:36:32 -0400 Subject: [PATCH] chore: formatting and clarification comment --- lua/nvim-ts-autotag/utils.lua | 10 +++------- tests/specs/closetag_spec.lua | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lua/nvim-ts-autotag/utils.lua b/lua/nvim-ts-autotag/utils.lua index 0fdd0b7..6b5fbdc 100644 --- a/lua/nvim-ts-autotag/utils.lua +++ b/lua/nvim-ts-autotag/utils.lua @@ -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 {} diff --git a/tests/specs/closetag_spec.lua b/tests/specs/closetag_spec.lua index c2bda45..4e2284d 100644 --- a/tests/specs/closetag_spec.lua +++ b/tests/specs/closetag_spec.lua @@ -145,7 +145,7 @@ local data = { linenr = 12, key = [[>]], before = [[<|
]], - after = [[<>|
]] + after = [[<>|
]], }, { name = "17 javascript autoclose fragment", @@ -154,7 +154,7 @@ local data = { linenr = 12, key = [[>]], before = [[<|
]], - after = [[<>|
]] + after = [[<>|
]], }, { name = "18 vue auto close tag",