I've recently started adding support for the Language Server Protocol (LSP) in a language project I'm working on, and it's a godsend. If you're not familiar with it, it's basically an editor- and language-agnostic protocol for implementing typical IDE behaviours like error highlighting, code completion, hover information, find references, etc. It solves the M*N problem in which every language would have to have a separate plugin tailored towards the APIs of every editor; now you just write either to be LSP compliant and it takes care of 90% of integration effort (writing the language server itself of course is still a lot of work).<p>Although it's still necessary to do a little plumbing work to integrate into each editor, this is largely boilerplate that differs little between languages. Most of the functionality resides in a JSON-RPC server implemented in your language of choice.<p>I've found it particularly useful when used in conjunction with the Monaco code editor [1] (the engine that powers Visual Studio Code), along with a supporting plugin for talking to a remote LSP server [2]. These make it possible to build interactive coding environments into a web app which include many of the typical editing features you're used to in IDEs.<p>It's great to see Apple along with other language vendors adopting this as a standard.<p>[1] <a href="https://github.com/Microsoft/monaco-editor" rel="nofollow">https://github.com/Microsoft/monaco-editor</a><p>[2] <a href="https://github.com/TypeFox/monaco-languageclient" rel="nofollow">https://github.com/TypeFox/monaco-languageclient</a>
Very excited to see this. We will use this project to add Swift support to Sourcegraph soon so you can get hovers, go-to-definition, find-references, etc., when browsing code on GitHub/GitLab/Bitbucket/Phabricator/Sourcegraph/etc.<p><a href="https://github.com/sourcegraph/sourcegraph/issues/979" rel="nofollow">https://github.com/sourcegraph/sourcegraph/issues/979</a>
LSP seems like an interesting concept, but it would be nice if it included more support for REPLs. I'm thinking of things like "evaluate highlighted section" or "recompile function under cursor".
> <i>SourceKit-LSP is built on top of sourcekitd 23 and clangd 23 for high-fidelity language support, and provides a powerful source code index as well as cross-language support.</i><p>That's pretty much been Apple's motto for a while: need language support for anything other than compiling the language, like IDEs or documentation generation? Why not add it <i>directly into the compiler?</i> This has pros and cons, but personally I like the direction Microsoft has gone: rewrite everything in JavaScript (actually TypeScript) so that it's super portable and more easily embeddable.