autozimu / LanguageClient-neovim

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

languageclient doesn't start the language server on my vimrc #1191

Open YaLTeR opened 3 years ago

YaLTeR commented 3 years ago

Describe the bug

For some reason LanguageClient has stopped working on my vimrc. On min-vimrc.vim it works fine. I think I tried about everything at this point like moving the settings between the two and commenting out all other plugins, but it just doesn't work on my regular vimrc. It seems that bin/languageclient runs fine, but then it just sits there doing nothing and doesn't start the actual language server, when I use my vimrc. :LanguageClientStart seems to do nothing, and calling LanguageClient functions says the language server isn't running. If I use settings like these, there's no /tmp/LanguageClient.log or any messages whatsoever (unless of course I use min-vimrc.vim where it works fine). Wrapper server also does nothing (except when I use min-vimrc.vim).

let g:LanguageClient_loggingLevel = 'DEBUG'
let g:LanguageClient_loggingFile = "/tmp/LanguageClient.log"

I'm a bit out of ideas at this point. I ran languageclient through a script like wrapper-server.sh, here's its output if it helps: wrapper-lc.log

I recorded straces with min-vimrc.vim and with my vimrc, I couldn't quite see what the issue is from it, but I could see that languageclient never execves anything with my vimrc. In fact when all other plugins are commented out there's no other execve in the log.

Environment

martskins commented 3 years ago

Can you share your vimrc? I'm pretty sure this has to be some misconfiguration.Meanwhile, I'll see to edit the sync_settings function so that the logging level and file are parsed and configured before anything else so that it can output errors correctly.

martskins commented 3 years ago

@YaLTeR this branch should be a little more helpful: https://github.com/autozimu/LanguageClient-neovim/pull/1192

It's not ideal, as it doesn't tell you exactly what is wrong, but it tells you the value, so maybe that helps track the error down.

YaLTeR commented 3 years ago

@YaLTeR this branch should be a little more helpful: #1192

With this branch I got the log!

14:18:53 ERROR unnamed src/language_server_protocol.rs:108 missing field signText 14:18:53 WARN unnamed src/language_server_protocol.rs:2863 Failed to start language server automatically. missing field signText

Oh, I guess something changed in the new version.

martskins commented 3 years ago

Yeah that might be either g:LanguageClient_diagnosticsDisplay or g:LanguageClient_codeLensDisplay. Let me know what you had there before, maybe we can do something to allow backwards compatibility.

YaLTeR commented 3 years ago

I had this:

let g:LanguageClient_diagnosticsDisplay = {
      \   1: {
      \     "name": "Error",
      \     "texthl": "SpellBad",
      \   },
      \   2: {
      \     "name": "Warning",
      \     "texthl": "SpellCap",
      \   },
      \   3: {
      \     "name": "Information",
      \     "texthl": "SpellCap",
      \   },
      \   4: {
      \     "name": "Hint",
      \     "texthl": "SpellCap",
      \   },
      \ }

I removed it in favor of modifying the default highlights and now it works.

martskins commented 3 years ago

I see. Yeah, we should probably allow partial settings for those like you had. I'll see if I can find some time to create a PR for that.

YaLTeR commented 3 years ago

Or at least complain loudly :)

fragilelambda commented 3 years ago

+1 meet same issue, I use a complete settings for diagnosticsDisplay, then everything goes fine.

iaamhg commented 2 years ago

in my case it is the following var set, hope there were more obvious hint of the cause~

 "let g:LanguageClient_diagnosticsList = v:null                                                       1 "let g:LanguageClient_hoverPreview = 'preview'