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.28k stars 55 forks source link

`lsp_installer = true` does not work #137

Closed dyuri closed 2 years ago

dyuri commented 2 years ago

Hi,

the lsp_installer option does not seem to work for me.

With the following configuration no LSP is loaded/configured:

call plug#begin()
  Plug 'neovim/nvim-lspconfig'
  Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
  Plug 'williamboman/nvim-lsp-installer'

  Plug 'ray-x/guihua.lua', { 'do': 'cd lua/fzy && make' }
  Plug 'ray-x/navigator.lua'
call plug#end()

lua << EOF
require'navigator'.setup({
  lsp_installer = true,
  debug = true
})
EOF

BUT if I explicitly provide the path for the installed LSP it works as expected:

" loading plugins ...

lua << EOF
require'navigator'.setup({
  debug = true,
  lsp = {
    gopls = {
      cmd = { '/home/dyuri/.local/share/nvim/lsp_servers/go/gopls' }
    }
  }
})
EOF

I'd love it not to configure manually the lsp servers after installing them via lsp-installer, what am I doing wrong?

Also using the option debug = true does not create the ~/.local/share/nvim/gh.log for me, so I can't really check those logs and can't see anything related when starting nvim via nvim -V10nvim.log.

ray-x commented 2 years ago

I am trying to reproduce the issue. But seems lspistall failed to install gopls with following messages: (Note: go.mod exists and I am using go 1.18beta1)

◍ gopls (failed)                                                                                                                           │
}                 │        go: go.mod file not found in current directory or any parent directory.                                                                │
~                 │                'go get' is no longer supported outside a module.                                                                              │
~                 │                To build and install a command, use 'go install' with a version,                                                               │
~                 │                like 'go install example.com/cmd@latest'                                                                                       │
~                 │                For more information, see https://golang.org/doc/go-get-install-deprecation                                                    │
~                 │                or run 'go help get' or 'go help install'.  
ray-x commented 2 years ago

btw, the log should be in ~/.cache/nvim/gh.log. I will need to update the README

dyuri commented 2 years ago

It's the same for all the other lsps, like pyright, jedi_language_server or tsserver (there are the ones I've tried).

Thanks, ~/.cache/nvim/gh.log do exist, I'm gonna try to debug my issue further later.

dyuri commented 2 years ago

Based on the logs, it finds the installed LSPs under ~/.local/share/nvim/lsp_servers, but still, it says:

lsp not installed for client pyright nil
...
lsp not installed for client jedi_language_server nil
dyuri commented 2 years ago

Here's the log: https://gist.github.com/dyuri/2e177df9f49311f45cc9c0d0d12a5865

ray-x commented 2 years ago

look like lsp-installer no longer send cmd options. It is always a bummer to integrate 3rd party plugins that have unstable API. Should work now.

dyuri commented 2 years ago

Thanks for looking at it!

cj commented 2 years ago

@ray-x I am getting an error now attempt to call method 'get_default_options' (a nil value) I think these two lines https://github.com/ray-x/navigator.lua/commit/45e0698d00e4c163ac2d11ca1c6a6c4258e51322#diff-00b77219d23ea80e50cffcbb60acf1c800d65e0e9c247c5da1430ec03bcfba74R548-R549 need to be moved inside the if installed and installer_cfg then

ray-x commented 2 years ago

Thanks, that was fixed.