swift icon indicating copy to clipboard operation
swift copied to clipboard

[SR-1878] Support the VSCode Language Protocol for Swift

Open akyrtzi opened this issue 10 years ago • 2 comments

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).

akyrtzi avatar Jun 22 '16 22:06 akyrtzi

Comment by Christophe Braud (JIRA)

It's will be a great asset!
Any news about this ticket?

swift-ci avatar Apr 19 '17 18:04 swift-ci

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.

swift-ci avatar Apr 19 '17 18:04 swift-ci