add log utils

This commit is contained in:
windwp 2021-04-20 15:52:30 +07:00
parent 6c4f0ffbcf
commit 586eedce4b
2 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,5 @@
local _, ts_utils = pcall(require, 'nvim-treesitter.ts_utils')
local log = require('nvim-ts-autotag._log')
local M={}
M.dump_node = function(node)
@ -17,4 +18,13 @@ M.is_close_empty_node = function(node)
return tag_name:match("%<%/%>$")
end
M.dump_node_text = function(target)
for node in target:iter_children() do
local node_type = node:type()
local text = ts_utils.get_node_text(node)
log.debug("type:" .. node_type .. " ")
log.debug(text)
end
end
return M

View File

@ -1,5 +1,7 @@
local ts = require 'nvim-treesitter.configs'
local log=require('nvim-ts-autotag._log')
if not _G.test_rename then
return
end
@ -218,6 +220,7 @@ local function Test(test_data)
-- autotag.renameTag()
helpers.feed(value.key, 'x')
helpers.feed("<esc>",'x')
vim.wait(10)
local result = vim.fn.getline(pos_before.linenr)
eq(after, result , "\n\n ERROR: " .. value.name .. "\n")
else
@ -228,6 +231,6 @@ local function Test(test_data)
end
describe('[rename tag]', function()
Test(run_data)
Test(run_data)
end)