Skip to content

Commit

Permalink
close outline when last buffer delete close #1317
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed Oct 10, 2023
1 parent d76f9b7 commit 79f8072
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/lspsaga/symbol/outline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ function ot:parse(symbols, curline)
end
end
api.nvim_set_option_value('modifiable', false, { buf = self.bufnr })
api.nvim_buf_attach(self.main_buf, false, {
on_detach = function()
local data = vim.version().minor > 10 and require('lspsaga.symbol.head')
or require('lspsaga.symbol')
if vim.tbl_count(data) == 0 and api.nvim_win_is_valid(self.winid) then
vim.defer_fn(function()
api.nvim_buf_delete(self.bufnr, { force = true })
pcall(api.nvim_win_close, self.winid, true)
end, 0)
end
end,
})
end

function ot:collapse(node, curlnum)
Expand Down

0 comments on commit 79f8072

Please sign in to comment.