autozimu / LanguageClient-neovim

Language Server Protocol (LSP) support for vim and neovim.
MIT License
3.55k stars 273 forks source link

Issues registering with deoplete #26

Closed NickeZ closed 7 years ago

NickeZ commented 7 years ago

When I try to use LanguageClient with deoplete it doesn't work. I looked into the code and made a small diff but I can't troubleshoot it any further becuase I don't really know any details. It works fine with NCM.

I use latest master of both plugins. CheckHealth reports that everything is fine.

diff --git a/rplugin/python3/LanguageClient/LanguageClient.py b/rplugin/python3/LanguageClient/LanguageClient.py
index 8dfd904..64f6402 100644
--- a/rplugin/python3/LanguageClient/LanguageClient.py
+++ b/rplugin/python3/LanguageClient/LanguageClient.py
@@ -277,7 +277,7 @@ class LanguageClient:
                 cm_refresh='LanguageClient_completionManager_refresh'))
             logger.info("register completion manager source ok.")
         except Exception as ex:
-            logger.warn("register completion manager source failed.")
+            logger.warn("register completion manager source failed. %s", ex)
     @neovim.autocmd('BufReadPost', pattern="*")
     @args(warn=False)
23:48:17 WARNING  register completion manager source failed. b'Error calling function.'
$ cat ~/.local/share/nvim/rplugin.vim
" python3 plugins
call remote#host#RegisterPlugin('python3', '/home/niklas/.config/nvim/plugged/LanguageClient-neovim/rplugin/python3/LanguageClient', [
      \ {'sync': v:true, 'name': 'LanguageClient_alive', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_completionItem/resolve', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_completionManager_refresh', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_exit', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentDocumentSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkTextDocumentReferences', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_FZFSinkWorkspaceSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'CursorMoved', 'opts': {'pattern': '*', 'eval': 'line(''.'')'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_initialize', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_registerServerCommands', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_setLoggingLevel', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClientStart', 'opts': {}, 'type': 'command'},
      \ {'sync': v:false, 'name': 'LanguageClientStop', 'opts': {}, 'type': 'command'},
      \ {'sync': v:false, 'name': 'TextChanged', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'TextChangedI', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_completion', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_definition', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_didClose', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'BufReadPost', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'BufWritePost', 'opts': {'pattern': '*'}, 'type': 'autocmd'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_documentSymbol', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_hover', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_references', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_rename', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_textDocument_signatureHelp', 'opts': {}, 'type': 'function'},
      \ {'sync': v:false, 'name': 'LanguageClient_workspace_symbol', 'opts': {}, 'type': 'function'},
     \ ])
call remote#host#RegisterPlugin('python3', '/home/niklas/.config/nvim/plugged/deoplete.nvim/rplugin/python3/deoplete', [
      \ {'sync': v:true, 'name': '_deoplete', 'opts': {}, 'type': 'function'},
     \ ])
" ruby plugins
" python plugins
autozimu commented 7 years ago

The line in diff is used only by neovim-completion-manager, not related to deoplete at all. (Also the oneline log.)

If you need to see all the messages between language server, change https://github.com/autozimu/LanguageClient-neovim/blob/master/rplugin/python3/LanguageClient/logger.py#L10 to logger.setLevel(logging.DEBUG).

One more thing, deoplete and neovim-completion-manager might not work well when both turned on.

The information provided is too limited. If you need more help from me, please provide minimal vimrc, test project, complete log and reproduction steps.

NickeZ commented 7 years ago

I was switching back and forth trying both, so you mean that I might have had some NCM stuff still around when I was testing deoplete? I'll try some more. I kind of assumed that cm#register was a convention among completion managers and that all implemented that function.

autozimu commented 7 years ago

They use different approaches.

When you have deoplete installed, it will try pick source from this plugin.

For neovim-completion-manager though, this plugin will always try register itself as a source. Obviously, when the neovim-completion-manger is not available, it will fail and generate a warning, which can be ignored if you don't use neovim-completion-manger.

autozimu commented 7 years ago

Any updates regarding this?

I'd like to close this if it has been resolved or not relevant anymore.

autozimu commented 7 years ago

Closing as lack of response.