|
|
|
@ -7,18 +7,17 @@ local cur_dir = vim.fn.expand('%:p:h')
|
|
|
|
|
|
|
|
|
|
-- local ulog = require('go.utils').log
|
|
|
|
|
describe('should run lsp call hierarchy', function()
|
|
|
|
|
local status = require('plenary.reload').reload_module('navigator')
|
|
|
|
|
local status = require('plenary.reload').reload_module('guihua')
|
|
|
|
|
local status = require('plenary.reload').reload_module('lspconfig')
|
|
|
|
|
|
|
|
|
|
vim.cmd([[packadd navigator.lua]])
|
|
|
|
|
vim.cmd([[packadd guihua.lua]])
|
|
|
|
|
local status = require('plenary.reload').reload_module('navigator')
|
|
|
|
|
status = require('plenary.reload').reload_module('guihua')
|
|
|
|
|
status = require('plenary.reload').reload_module('lspconfig')
|
|
|
|
|
|
|
|
|
|
local path = cur_dir .. '/tests/fixtures/interface.go' -- %:p:h ? %:p
|
|
|
|
|
local cmd = " silent exe 'e " .. path .. "'"
|
|
|
|
|
vim.cmd(cmd)
|
|
|
|
|
vim.cmd([[cd %:p:h]])
|
|
|
|
|
local bufn = vim.fn.bufnr('')
|
|
|
|
|
vim.bo.filetype = 'go'
|
|
|
|
|
require('navigator').setup({
|
|
|
|
|
debug = true, -- log output, set to true and log path: ~/.local/share/nvim/gh.log
|
|
|
|
|
width = 0.75, -- max width ratio (number of cols for the floating window) / (window width)
|
|
|
|
@ -27,7 +26,6 @@ describe('should run lsp call hierarchy', function()
|
|
|
|
|
border = 'none',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
vim.bo.filetype = 'go'
|
|
|
|
|
-- allow gopls start
|
|
|
|
|
for _ = 1, 20 do
|
|
|
|
|
vim.wait(400, function() end)
|
|
|
|
@ -47,19 +45,25 @@ describe('should run lsp call hierarchy', function()
|
|
|
|
|
vim.fn.setpos('.', { bufn, 24, 15, 0 })
|
|
|
|
|
require('navigator.hierarchy').incoming_calls_panel()
|
|
|
|
|
|
|
|
|
|
vim.wait(300, function() end)
|
|
|
|
|
|
|
|
|
|
local panel = require('guihua.panel').debug()
|
|
|
|
|
eq(panel.name, 'Panel')
|
|
|
|
|
|
|
|
|
|
vim.wait(400, function() end)
|
|
|
|
|
vim.wait(500, function() end)
|
|
|
|
|
panel = require('guihua.panel').debug()
|
|
|
|
|
eq(panel.activePanel.sections[1].header[1], "──────────Call Hierarchy──────────")
|
|
|
|
|
eq(panel.activePanel.sections[1].nodes[1].name, "measure")
|
|
|
|
|
|
|
|
|
|
print(vim.inspect(panel))
|
|
|
|
|
-- eq(
|
|
|
|
|
-- panel.activePanel.sections[1].header[1],
|
|
|
|
|
-- '──────────Call Hierarchy──────────'
|
|
|
|
|
-- )
|
|
|
|
|
-- eq(panel.activePanel.sections[1].nodes[1].name, 'measure')
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
it('should show hierarchy', function()
|
|
|
|
|
vim.fn.setpos('.', { bufn, 24, 15, 0 })
|
|
|
|
|
require('navigator.hierarchy')._call_hierarchy()
|
|
|
|
|
local ret = require('navigator.hierarchy')._call_hierarchy()
|
|
|
|
|
vim.wait(400, function() end)
|
|
|
|
|
eq(ret, {})
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|