Here are some critical hints that may help developers of editors or language plugins in adopting SourceKit-LSP:
- Remember that SourceKit-LSP is at an early stage:
- It is not yet a complete or necessarily accurate reflection of the LSP.
- Logs from
stdErr
may be insufficient for debugging your interaction withsourcekit-lsp
. - Currently, you have to open a document before sending document-based requests.
- You can use
sourcekit-lsp
with Swift packages but not (yet) with Xcode projects. - Don't attempt to use
sourcekit-lsp
in a sandboxed context:- As with most developer tooling,
sourcekit-lsp
relies on other system- and language tools that it would not be allowed to access from within an app sandbox.
- As with most developer tooling,
- Strictly adhere to the format specification of LSP packets, including their header- and content part.
- Piece LSP packets together from the
stdOut
data:sourcekit-lsp
outputs LSP packets tostdOut
, but: Single chunks of data output do not correspond to single packets.stdOut
rather delivers a stream of data. You have to buffer that stream in some form and detect individual LSP packets in it.
- Provide the current system environment variables to
sourcekit-lsp
:sourcekit-lsp
must read some current environment variables of the system, so don't wipe them all out when providing modified or additional variables.