Sourcekit-lsp Linux crash

I installed swift on ubuntu 18.04. Works so far. Then ran sourckit-lsp, looked frozen, pressed enter and received an error.

$ sourcekit-lsp

Fatal error: fatal error encountered decoding message MessageDecodingError(code: LanguageServerProtocol.ErrorCode(rawValue: -32700), message: "expected \':\' in message header", id: nil, messageKind: LanguageServerProtocol.MessageDecodingError.MessageKind.unknown): file /home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-18_04/sourcekit-lsp/Sources/LanguageServerProtocolJSONRPC/JSONRPCConnection.swift, line 191
Illegal instruction (core dumped)

Interestingly however, I downloaded the sourcekit extension for VSCode and I seem to get syntax highlighting and jump to definition. I figured it would be using my system sourcekit-lsp so it must be working in some manner?

Any tips on how to fix this error?

I want to get to the point of developing so I can contribute towards "Background Indexing" which is apparently not a feature of sourcekit-lsp currently, but first step I figure is just trying this working on Linux as-is.

Thanks

The sourcekit-lsp executable is meant to be executed by a tool that uses the language server protocol, and it communicates over stdin/stdout, so when you typed into your console you were providing it input that it didn't understand. This is expected.

When you use SourceKit-LSP with VSCode, it is VSCode that launches the executable and speaks LSP over pipes. You don't generally launch it yourself.

Hope that helps!

Edit: if your goal is just to sanity check the executable can run, you can print the help message sourcekit-lsp --help

1 Like

Thanks for the info, this definitely helps! Will continue my efforts :)

Terms of Service

Privacy Policy

Cookie Policy