Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

activate winbar symbols when opening file #1489

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions lua/lspsaga/symbol/head.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ end

function symbol:register_module()
local group = api.nvim_create_augroup('LspsagaSymbols', { clear = true })
api.nvim_create_autocmd('FileType', {
group = group,
callback = function(args)
local winbar
if config.symbol_in_winbar.enable then
winbar = require('lspsaga.symbol.winbar')
winbar.init_winbar(args.buf)
end
self:buf_watcher(args.buf, group)
end,
})
api.nvim_create_autocmd('LspAttach', {
group = group,
callback = function(args)
Expand All @@ -176,20 +187,13 @@ function symbol:register_module()

self:do_request(args.buf, args.data.client_id)

local winbar
if config.symbol_in_winbar.enable then
winbar = require('lspsaga.symbol.winbar')
winbar.init_winbar(args.buf)
end
self:buf_watcher(args.buf, group)

if config.implement.enable and client.supports_method('textDocument/implementation') then
require('lspsaga.implement').start()
end
end,
})

api.nvim_create_autocmd('LspDetach', {
api.nvim_create_autocmd({ 'LspDetach', 'BufDelete', 'BufWipeout' }, {
group = group,
callback = function(args)
if self[args.buf] then
Expand Down
14 changes: 9 additions & 5 deletions lua/lspsaga/symbol/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ end

function symbol:register_module()
local group = api.nvim_create_augroup('LspsagaSymbols', { clear = true })
api.nvim_create_autocmd('FileType', {
group = group,
callback = function(args)
if config.symbol_in_winbar.enable then
require('lspsaga.symbol.winbar').init_winbar(args.buf)
end
end,
})
api.nvim_create_autocmd('LspAttach', {
group = group,
callback = function(args)
Expand All @@ -195,17 +203,13 @@ function symbol:register_module()
end
self:do_request(args.buf, args.data.client_id)

if config.symbol_in_winbar.enable then
require('lspsaga.symbol.winbar').init_winbar(args.buf)
end

if config.implement.enable and client.supports_method('textDocument/implementation') then
require('lspsaga.implement').start()
end
end,
})

api.nvim_create_autocmd('LspDetach', {
api.nvim_create_autocmd({ 'LspDetach', 'BufDelete' }, {
group = group,
callback = function(args)
if self[args.buf] then
Expand Down