Skip to content

[LSP] languageserver not working with vim/neovim+lsp plugins #1191

@Shihira

Description

@Shihira

The version I use is the prebuilt binary package downloaded from github release page, v1.30.1 omnisharp-mono.tar.gz. linux-x86_64 package behaves exactly the same. Here is the relevant configurations in my .vimrc:

let g:LanguageClient_serverCommands = {
    \ 'cs': ['mono', '/opt/omnisharp-roslyn/OmniSharp.exe', '--languageserver', '--verbose'],
\ }

let g:LanguageClient_rootMarkers = {
    \ 'cs': ['.git', '*.csproj'],
\ }

let g:deoplete#enable_at_startup = 1
let g:LanguageClient_loggingLevel = 'DEBUG'
let g:LanguageClient_loadSettings = 0

And here is the relevant log when error occurs:

17:31:24 INFO reader-cs src/vim.rs:379 <= Some("cs") {"protocolVersion":"2.0","method":"window/logMessage","params":{"type":4,"message":"Starting server..."}}
17:31:24 ERROR reader-cs src/vim.rs:384 Failed to deserialize output: data did not match any variant of untagged enum RawMessage

 Message: {"protocolVersion":"2.0","method":"window/logMessage","params":{"type":4,"message":"Starting server..."}}

Error: ErrorImpl { code: Message("data did not match any variant of untagged enum RawMessage"), line: 0, column: 0 }
...
17:31:24 INFO main src/vim.rs:90 => Some("cs") {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"completion":{"completionItem":{"commitCharactersSupport":null,"documentationFormat":null,"snippetSupport":false},"dynamicRegistration":null}}},"initializationOptions":null,"processId":24814,"rootPath":"/home/shihira/Program/Unity/Vitruvius","rootUri":"file:///home/shihira/Program/Unity/Vitruvius","trace":"off"},"id":9}
Unhandled Exception:
Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Boolean'. Path 'params.capabilities.textDocument.completion.dynamicRegistration', line 1, position 221. ---> System.InvalidCastException: Null object cannot be converted to a value type.
  at System.Convert.ChangeType (System.Object value, System.Type conversionType, System.IFormatProvider provider) [0x00029] in <cae080c8689e4af39d0ab2b313d012f5>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType (Newtonsoft.Json.JsonReader reader, System.Object value, System.Globalization.CultureInfo culture, Newtonsoft.Json.Serialization.JsonContract contract, System.Type targetType) [0x000aa] in <dc86da7fc46c487ba6c7ab826da479cc>:0 
   --- End of inner exception stack trace ---
...
17:31:37 WARN main src/languageclient.rs:1910 Failed to start language server automatically. timed out waiting on channel

I noticed the key "protocolVersion", which is usually "jsonrpc" in many other LSPs. Is it the reason why LanguageClient failed to deserialize it?
Another problem causes the server crashing. I believe this is about what's been mentioned and solved in OmniSharp/csharp-language-server-protocol#75. If that's true please merge them.

Thank you for your great work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions