Skip to content

Neovim LSP support #20

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

Closed
gasacchi opened this issue Jan 4, 2021 · 14 comments
Closed

Neovim LSP support #20

gasacchi opened this issue Jan 4, 2021 · 14 comments

Comments

@gasacchi
Copy link

gasacchi commented Jan 4, 2021

Hi, I currently using neovim nightly build.
can i use this plugin with https://github.com/neovim/nvim-lspconfig ?
Thanks

@ryyppy
Copy link
Member

ryyppy commented Jan 6, 2021

Only if the vim LSP client supports node-ipc communication.. we don't have a stdout, nor socket option.

Use the settings as stated in the coc vim config part in the README and let me know how it went!

@amiralies
Copy link
Collaborator

it just supports stdout AFAIK.
I think we need to support stdout (many language clients communicate via stdout only) and it should be trivial to implement.

@gasacchi
Copy link
Author

yes, i try to look on lspconfig in the repo it seems only support stdout. well i'm going to use coc for now, btw thank for response 😄

@WhyThat
Copy link

WhyThat commented Apr 1, 2021

Just for your information you can now configure the builtin LSP thanks to rescript-lang/rescript-vscode#88
Steps:

  • git clone https://github.com/rescript-lang/rescript-vscode
  • cd rescript-vscode
  • npm install
  • npm run compile
  • cd analysis && make
  • Add this wherever you configure your LSPs
local lsp = require'lspconfig'
local configs = require'lspconfig/configs'
local rescriptLspPath = '~/repos/rescript-vscode/server/out/server.js'

if not lsp.rescriptlsp then
  configs.rescriptlsp = {
    default_config = {
      cmd = {'node', rescriptLspPath, '--stdio'};
      filetypes = {"rescript"};
      root_dir = lsp.util.root_pattern('bsconfig.json');
      settings = {};
    };
  }
end
lsp.rescriptlsp.setup{
  -- with your configurations
}

@amiralies
Copy link
Collaborator

rescript supported is added to nvim-lspconfig so assuming you have latest lspconfig version setup is trivial

require'lspconfig'.rescriptls.setup {
  cmd = {
    'node',
    '<path to server.js>',
    '--stdio'
  }
}

@rocinant3
Copy link

For the third day I have been trying to integrate Rescript support on pure LSP (Not COC!) In neovim.
But nothing comes out (the LspInfo command confirms the presence of the client, but there is no support from him)!
Tried options with vs-code-lang-server and the official vim-rescript plugin. My config:

call plug#begin()
         Plug 'nvim-lua/completion-nvim'
         Plug 'rescript-lang/vim-rescript'
         Plug 'neovim/nvim-lspconfig'
         Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()

set number

" LSP
lua require('lspconfig').pyright.setup{}
lua require('lspconfig').rescriptls.setup{cmd={'node','~/.config/nvim/plugged/vim-rescript/server/out/server.js','--stdio'}}
 
" Completion
 " lua require('lspconfig').pyright.setup{on_attach=require('completion').on_attach}
 " lua require('lspconfig').rescriptls.setup{on_attach=require('completion').on_attach}

set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
set shortmess+=c
let g:completion_enable_auto_popup = 1


" Use completion-nvim in every buffer
 autocmd BufEnter * lua require('completion').on_attach()

Can anyone help?

@amiralies
Copy link
Collaborator

@rocinant3 can you try pointing to server with absolute path?
/home/<username>/.config/......
instead of
~/.config/...

@rocinant3
Copy link

@amiralies, seems works!, thank you

image

But what about auto-completion?
There is an instruction in my config (usually works with all languages)
lua require('lspconfig').rescriptls.setup{on_attach=require('completion').on_attach}

But in this case nvim crashed with error:

An error was encountered while processing the FileType Autocommand for "rescript":
E5108: Error executing lua Vim:E928: String required
E5108: Error executing lua Vim:E928: String required

@amiralies
Copy link
Collaborator

I'm not sure if its related with rescript's config.
I use nvim-compe and it just works.

@rocinant3
Copy link

Solved a problem! Everything is working. Thanks again
image

@barkanido
Copy link

@rocinant3 can I ask how?

@amiralies
Copy link
Collaborator

@barkanido It depends on your config. do you have exact same problem as above?

@barkanido
Copy link

Eventually it was a bug in the lsp client that was fix fixed

@mununki mununki mentioned this issue Nov 1, 2021
@mununki
Copy link
Member

mununki commented Nov 1, 2021

@amiralies I finally made it works thanks! But the go-to definition seems not working. Should I add the pattern in the configuration additionally?

My current configuration

nvim_lsp.rescriptls.setup {
  cmd = {
    'node',
    '/Users/woonki/.local/share/nvim/plugged/vim-rescript/server/out/server.js',
    '--stdio'
  }
}

Sorry for interrupting you. I missed some basic stuff by mistake. It works perfectly! Thank you for great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants