Added seperate commands for openening and closing the outline window

This commit is contained in:
Oliver Leete
2021-04-24 14:42:22 +01:00
parent 16f380fca3
commit 0559843c7b
3 changed files with 23 additions and 0 deletions

View File

@@ -10,6 +10,10 @@ local M = {}
local function setup_commands()
vim.cmd("command! " .. "SymbolsOutline " ..
":lua require'symbols-outline'.toggle_outline()")
vim.cmd("command! " .. "SymbolsOutlineOpen " ..
":lua require'symbols-outline'.open_outline()")
vim.cmd("command! " .. "SymbolsOutlineClose " ..
":lua require'symbols-outline'.close_outline()")
end
local function setup_autocmd()
@@ -190,6 +194,19 @@ function M.toggle_outline()
end
end
function M.open_outline()
if M.state.outline_buf == nil then
vim.lsp.buf_request(0, "textDocument/documentSymbol", getParams(),
handler)
end
end
function M.close_outline()
if M.state.outline_buf ~= nil then
vim.api.nvim_win_close(M.state.outline_win, true)
end
end
function M.setup(opts)
config.setup(opts)
setup_commands()