ray-x / navigator.lua

Code analysis & navigation plugin for Neovim. Navigate codes like a breeze🎐 Exploring LSP and 🌲Treesitter symbols a piece of 🍰 Take control like a boss 🦍
MIT License
1.3k stars 58 forks source link

I get an error like that when I open Cpp or js/ts project, which could be happened just using mason with navigator. #233

Closed ancion closed 2 years ago

ancion commented 2 years ago

Error detected while processing FileType Autocommands for "": Error executing lua callback: ...pack/packer/start/mason.nvim/lua/mason-registry/init.lua:68: Cannot find package "nil". stack traceback: [C]: in function 'error' ...pack/packer/start/mason.nvim/lua/mason-registry/init.lua:68: in function 'get_package' .../start/navigator.lua/lua/navigator/lspclient/clients.lua:454: in function 'lsp_startup' .../start/navigator.lua/lua/navigator/lspclient/clients.lua:639: in function 'setup' .../start/navigator.lua/lua/navigator/lspclient/clients.lua:683: in function 'on_filetype' ...m/site/pack/packer/start/navigator.lua/lua/navigator.lua:260: in function <...m/site/pack/packer/start/navigator.lua/lua/navigator.lua:259> Error detected while processing BufEnter Autocommands for "": Error executing lua callback: ...pack/packer/start/mason.nvim/lua/mason-registry/init.lua:68: Cannot find package "nil". stack traceback: [C]: in function 'error' ...pack/packer/start/mason.nvim/lua/mason-registry/init.lua:68: in function 'get_package' .../start/navigator.lua/lua/navigator/lspclient/clients.lua:454: in function 'lsp_startup' .../start/navigator.lua/lua/navigator/lspclient/clients.lua:639: in function 'setup' .../start/navigator.lua/lua/navigator/lspclient/clients.lua:683: in function 'on_filetype' ...m/site/pack/packer/start/navigator.lua/lua/navigator.lua:260: in function <...m/site/pack/packer/start/navigator.lua/lua/navigator.lua:259>

ray-x commented 2 years ago

Do you have a minimum init.lua for me to reproduce? You can try this:

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local Plugin_folder
local plugin_folder = function()
  if Plugin_folder then
    return Plugin_folder
  end
  local host = os.getenv("HOST_NAME")
  if host and (host:find("Ray") or host:find("ray")) then
    Plugin_folder = [[~/github/ray-x/]] -- vim.fn.expand("$HOME") .. '/github/'
  else
    Plugin_folder = [[ray-x/]]
  end
  return Plugin_folder
end

local path = plugin_folder()
local package_root = "/tmp/nvim/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"

vim.g.coq_settings = {
  ["auto_start"] = "shut-up",
}

local function load_plugins()
  print("load plugins")
  -- general setup
  require("packer").startup({
    function(use)
      use("junnplus/lsp-setup.nvim")
      use("wbthomason/packer.nvim")

      use("nvim-lua/plenary.nvim")
      use("williamboman/mason.nvim")
      use({
        "williamboman/mason-lspconfig.nvim",
        config = function()
          require("mason").setup()
          require("mason-lspconfig").setup({})
        end,
      })

      use({
        Plugin_folder .. "navigator.lua",
        requires = {
          { "ray-x/guihua.lua", run = "cd lua/fzy && make" },
          { Plugin_folder .. "nvim-lspconfig" },
          { "nvim-treesitter/nvim-treesitter" },
        },
        config = function()
          require("navigator").setup({
            debug = true,
            lsp_signature_help = true,
            mason = true,
            lsp = {
              tsserver = {
                single_file_support = true,
              },
            },
          })
        end,
      })
    end,
    config = {
      package_root = package_root,
      compile_path = install_path .. "/plugin/packer_compiled.lua",
    },
  })
end
if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system({
    "git",
    "clone",
    "https://github.com/wbthomason/packer.nvim",
    install_path,
  })
  load_plugins()
  require("packer").sync()
else
  load_plugins()
end

vim.cmd("colorscheme murphy")
ancion commented 2 years ago

I pull latest commit that may fix this bug. The error not occur at all.

ray-x commented 2 years ago

I am happy to close it for now. If you saw it again, fee free to reopen.