SmiteshP / nvim-navbuddy

A simple popup display that provides breadcrumbs feature using LSP server
Apache License 2.0
759 stars 30 forks source link

navbuddy failing to open #25

Closed sf8193 closed 1 year ago

sf8193 commented 1 year ago

hello,

Thanks for the plugin, i've quickly come to love it.

I've had problems today with it, however. I've confirmed that nvim-navic is working because it is part of my lualine setup. However, when i try to use navbuddy through a couple of different ways i get the same issue with all of them. They all fail with

Error executing Lua callback: ....local/share/nvim/lazy/nvim-navic/lua/nvim-navic/lib.lua:257: attempt to index local 'client' (a number value) stack traceback: ....local/share/nvim/lazy/nvim-navic/lua/nvim-navic/lib.lua:257: in function 'request_symbol' ...share/nvim/lazy/nvim-navbuddy/lua/nvim-navbuddy/init.lua:164: in function 'make_request' ...share/nvim/lazy/nvim-navbuddy/lua/nvim-navbuddy/init.lua:176: in function 'request' ...share/nvim/lazy/nvim-navbuddy/lua/nvim-navbuddy/init.lua:239: in function 'open' ...share/nvim/lazy/nvim-navbuddy/lua/nvim-navbuddy/init.lua:273: in function <...share/nvim/lazy/nvim-navbuddy/lua/nvim -navbuddy/init.lua:272>

My setup that was working had this in my on attach function

local navic = require("nvim-navic")
local navbuddy = require("nvim-navbuddy")
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
    if client.server_capabilities.documentSymbolProvider then
        navic.attach(client, bufnr)
        navbuddy.attach(client, bufnr)
    end

I have since tried doing auto-attach, as a config which also didn't work. Using the lua command to open nav-buddy also errors with the same issue

Perry3D commented 1 year ago

If you are using the lazy plugin manager, try to add this line to the lazy config of navbuddy:

event = 'LspAttach
sf8193 commented 1 year ago

that works -- why does navbuddy need this when navic doesn't?