[SR-1878] Support the VSCode Language Protocol for Swift
| Previous ID | SR-1878 |
| Radar | None |
| Original Reporter | @akyrtzi |
| Type | New Feature |
Additional Detail from JIRA
| Votes | 4 |
| Component/s | Source Tooling |
| Labels | New Feature |
| Assignee | None |
| Priority | Medium |
md5: 3e2ced5da25ff6979d0677d45e737c89
Issue Description:
VSCode supports server extensions that implement a language-agnostic protocol, the protocol is described here:
https://github.com/Microsoft/vscode-languageserver-protocol
AFAICT, an extension can start a language 'server' by just invoking an executable and communicating with it via stdin/stdout. We could create a tool executable that implements the json-rpc protocol by reading the json requests from stdin and outputting responses in stdout.
It can use libIDE for the underlying Swift functionality, like providing code-completion.
We also need to investigate a way to be able to get compiler arguments that should be associated with a particular swift file (like the proper search paths). An idea for that would be to extend SwiftPM/llbuild and get it to output a "compilation database" like the one that CMake generates and is used by clang tools (see http://clang.llvm.org/docs/JSONCompilationDatabase.html).
Comment by Christophe Braud (JIRA)
It's will be a great asset!
Any news about this ticket?
Comment by Ryan Lovelett (JIRA)
I have implemented a language server. It is available on GitHub. I also have a plugin for VSCode.
NOTE: I don't have the full protocol implemented. It does however support reading SwiftPM packages and extracting the correct arguments to send to SourceKit.