Language Servers for Everybody

By , · 4 minute read

At Stardog, we’re all about making it easy to unify data. That’s why we’ve just open sourced a set of tools to make working with Stardog even easier than before.

Within the past year, we’ve been developing – and using in our products (Stardog Studio) – fast, error-tolerant, spec-compliant, and editor-agnostic parsers for Stardog languages (SPARQL, Turtle, and SMS2, with support for other languages to come). At the same time, we’ve also been developing language servers that talk to these parsers. These are the core tools that power the language intelligence features that we’ve so far built into Stardog Studio. As of today, those same tools can also provide similar features to any editor or IDE of your choice, so long as it supports the Language Server Protocol. The payoff is that you can work deftly with Stardog languages just about anywhere.

Read on for the details; or, if you just want to get straight to the code, you can find our parsers here, our language servers here, and our Visual Studio Code extensions here.

Stick to the Protocol

In early 2015 Microsoft released Visual Studio Code, their open source, cross-platform code editor. It has since taken the editor/IDE world by storm. One factor responsible for its success has been its reliance on the Language Server Protocol for all of its language intelligence capabilities.

The Language Server Protocol (LSP) is basically just a description of JSON-based communication between editors/IDEs and servers providing language-related features (autocompletion, diagnostics, hover helpers, and so on). Although this protocol was initially developed by Microsoft, it is now developed in the open as a standard backed by collaborators including Red Hat, Codenvy (developers of Eclipse Che), Sourcegraph, and Microsoft itself. The protocol has proven to be a success, and is now supported by a growing number of editors/IDEs, including Eclipse, IntelliJ (and other JetBrains products), Emacs, Atom, Sublime Text, Neovim, the Visual Studio editors themselves, and others.

Basically, it’s the real deal.

The nitty-gritty technical details of the LSP are beyond the scope of this blog post, but one of its main selling points is that it totally decouples language intelligence features from editors/IDEs. Instead of having to implement tool-specific plugins to add language intelligence features, developers using the LSP can implement just one editor-agnostic server capable of providing intelligence to any client – any editor/IDE – that conforms to the protocol. At that point, any editor that knows how to locate the language server, send it some JSON, and respond appropriately to whatever JSON it receives in return can immediately support the relevant language with no additional work required.

And that’s exactly where the real benefit of the Stardog language servers comes in.

You can now install our language servers for SPARQL, Turtle, and SMS2 in order to quickly get Stardog language intelligence in any LSP-supporting environment you’d like. That means you can have Stardog language support in Emacs, IntelliJ, VSCode, and many other places. In case it’s not clear how exactly to set this up, we’ve provided some details in our repo, and have released some open source VSCode extensions that adds our language servers to Visual Studio Code.

It’s Even Better with Studio

Of course, within Stardog Studio, we’ve already done the integration work for you, so you’ll continue to get the language intelligence provided by these servers out of the box. Batteries included! And because Studio knows a bit more about your connected Stardog instances than our standalone language servers, it can also provide some more sophisticated language intelligence features, such as better syntax highlighting and the ability to present most the most frequently occurring predicates and classes in your databases as autocomplete suggestions. Since it also offers a number of other features – data loading, virtual graph management, DB administration features, and more – it’s still our go-to tool for working with Stardog. You can grab the latest version right here.

What’s Next

Keep an eye on our GitHub repo–and, hey, maybe give us a star while you’re at it?–and on Stardog Studio. We’ve got lots of different enhancements on our roadmap, including more autocompletion intelligence, better diagnostics, support for R2RML, and more.

In the meantime, we also welcome your feedback. Our goal is to ensure a powerful user experience for building apps with Stardog. If you have a vision for what that looks like for your team, we encourage you to share it with us, either on our community forum or (if the feedback is specific to our new language servers) on our GitHub repo.


Top