haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 211 forks source link

LanguageClient error - "haskell-lsp: no handler for" (NeoVim) #1614

Closed andregpss closed 4 years ago

andregpss commented 4 years ago

I'm using HIE on NeoVim v0.4.3, on Ubuntu Linux (over WSK Windows 10), but LanguageClient plug-in is not working.

However, Coc plugin is working perfectly (code completion showing documentation). HLintis also working.

The error below is shown everytime i open a .hs file:

[LC] [Error] haskell-lsp:no handler for. Object (fromList [("jsonrpc",String "2.0"),("params",Object (fromList [("textDocument",Object (fromList [("uri",String "file:///mnt/c/Users/Me/Project/ServerMain.hs")]))])),("method",String "textDocument/codeLens"),("id",Number 2.0)])
"## Output channel: languegeserver.haskell"

When i press F5, LanguageClient menu appears, but all comands shows the same message:

[LC] Not found!

I updated HIE project on 27-jan-2020. I compiled it for GHC-8.6.5. This is the GHC version i use.

On init.vim, the LanguageClientconfiguration is:

set rtp+=~/.vim/pack/XXX/start/LanguageClient-neovim
let g:LanguageClient_serverCommands = { 'haskell': ['hie-wrapper', '--lsp'] }
let g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml']
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
map <Leader>lk :call LanguageClient#textDocument_hover()<CR>
map <Leader>lg :call LanguageClient#textDocument_definition()<CR>
map <Leader>lr :call LanguageClient#textDocument_rename()<CR>
map <Leader>lf :call LanguageClient#textDocument_formatting()<CR>
map <Leader>lb :call LanguageClient#textDocument_references()<CR>
map <Leader>la :call LanguageClient#textDocument_codeAction()<CR>
map <Leader>ls :call LanguageClient#textDocument_documentSymbol()<CR>
call plug#begin()
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}}
Plug 'neovimhaskell/haskell-vim'
Plug 'preservim/nerdtree' 
Plug 'liuchengxu/vista.vim' 
Plug 'itchyny/lightline.vim'
Plug 'nbouscal/vim-stylish-haskell'
Plug 'autozimu/LanguageClient-neovim', { 
    \ 'branch': 'next',
    \ 'do': './install.sh'
    \ } 
call plug#end()
Avi-D-coder commented 4 years ago

You should use Coc or LanguageClient-neovim, not both. I advise Coc.

andregpss commented 4 years ago

You should use Coc or LanguageClient-neovim, not both. I advise Coc.

@Avi-D-coder But how can i know the type definition of a variable using only Coc? I think LAnguageClient has more features than Coc, isnt it? Why did you advise Coc? Thanks.

Avi-D-coder commented 4 years ago

Coc is a complete LSP implementation based on vscodes's implementation, it supports more features than LCN.

See the example Coc config and it's wiki.

Avi-D-coder commented 4 years ago

I'm going to close this, since the issue is due to using two clients at once. If you have any questions or the issue occurs when using a single client just add a comment.

andregpss commented 4 years ago

Ok. I uninstalled LanguageClient from NeoVim. I did not know that Coc is so powerful, and that we can set so much parameters to the coc config. I think it is a good idea to put the link to Coc config on the HIE installation settings.