SmiteshP / nvim-navbuddy

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

module 'nvim-navic.lib' not found #27

Closed arnaupv closed 1 year ago

arnaupv commented 1 year ago

I'm having problems loading the nvim-navic

That's my current configuration using LazyVim instead of Packer Plugin manager:

$ cat lua/plugins/lsp.lua
return {
  {
    "neovim/nvim-lspconfig",
    ---@class PluginLspOpts
    opts = {
      ---@type lspconfig.options
      servers = {
        -- pyright will be automatically installed with mason and loaded with lspconfig
        -- https://alpha2phi.medium.com/modern-neovim-debugging-and-testing-8deda1da1411
        --
        clangd = {},
        pyright = {
          on_attach = function(client, bufnr)
            require("nvim-navic").attach(client, bufnr)
            require("nvim-navbuddy").attach(client, bufnr)
          end,
          settings = {
            python = {
              analysis = {
                typeCheckingMode = "off",
                autoSearchPaths = true,
                useLibraryCodeForTypes = true,
                diagnosticMode = "workspace",
              },
            },
          },
        },
      },
    },
  },
  -- nav-buddy
  {
    "SmiteshP/nvim-navbuddy",
    dependencies = {
      { "neovim/nvim-lspconfig" },
      { "SmiteshP/nvim-navic" },
      { "MunifTanjim/nui.nvim" },
    },
  },
  -- nav-navic
  {
    "SmiteshP/nvim-navic",
    dependencies = {
      { "neovim/nvim-lspconfig" },
    },
  }
}

and this is the error: image

I've tried to remove the .lib from line https://github.com/SmiteshP/nvim-navbuddy/blob/master/lua/nvim-navbuddy/init.lua#L1 getting instead

local navic = require("nvim-navic")

but then I get this, looks like I'm having problems loading the nvim-navic plugin image

Is this a problem with the Lazy plugin manager or with navic plugin itself?

EpiCanard commented 1 year ago

Hello, It seems it doesn't find navic.lib maybe your version is too old ? What is the commit for nvim-navic in your lazy-lock.json ?

If it is the last version you should have 27124a773d362628b114cd12016e743dab4ccf3e If not, try to do an Update with lazy :Lazy => Update (U)

arnaupv commented 1 year ago

Hi, thanks a lot for the hint, indeed I was not using the last nvim-navic version. This part has been fixed now, but I'm still facing problems that I do not know how to tackle. image I've checked and I'm currently using the last version of navbuddy - a0e36447f39442436dfbd371d7daea5c2dc9ec58

SmiteshP commented 1 year ago

Seems like its still not able to find the lib. Can you once try by removing both nvim-navic and nvim-navbuddy both and reinstall again.

sf8193 commented 1 year ago

try event='LspAttach' in your lazy config

arnaupv commented 1 year ago

Hi guys! First, thanks a lot to @Jxstxs for adding the extra doc https://github.com/SmiteshP/nvim-navbuddy/commit/e476bd9c49c3f2d9b09cd9366a894c92c42a70e4

It ended up working for me with the following config:

  {
    "neovim/nvim-lspconfig",
    ---@class PluginLspOpts
    opts = {
      ---@type lspconfig.options
      servers = {
        -- pyright will be automatically installed with mason and loaded with lspconfig
        -- https://alpha2phi.medium.com/modern-neovim-debugging-and-testing-8deda1da1411
        --
        clangd = {},
        pyright = {
          settings = {
            python = {
              analysis = {
                typeCheckingMode = "off",
                autoSearchPaths = true,
                useLibraryCodeForTypes = true,
                diagnosticMode = "workspace",
              },
            },
          },
        },
      },
    },
  },
  {
    "SmiteshP/nvim-navbuddy",
    dependencies = {
      { "neovim/nvim-lspconfig" },
      { "SmiteshP/nvim-navic" },
      { "MunifTanjim/nui.nvim" },
      { "numToStr/Comment.nvim" },
    },
    opts = {
      lsp = { auto_attach = true },
    },
  },