BT

Rust Language Server Available for Early Adopters

| by Sergio De Simone Follow 9 Followers on Jan 23, 2017. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

The Rust Language Server (RLS) aims to make it easier to build tools providing features such as code auto-complete, goto definition, reformatting, etc. RLS alpha is now available for early adopters to try on real projects and send feedback, writes Jonathan Turner, one of the main contributors to the project.

To gather information about the source code, the Rust Language Server uses both the Rust compiler and Racer, a tool meant to provide code completion for Rust code. The compiler is by definition the most authoritative source of information about a program, but, given the current lack of support for incremental compilation in Rust, it may be too slow. Racer, on the other hand, is almost always fast, says Turner, but has some limitations, such as not being able to handle macros, or only partially supporting generic types. For this reason, RLS queries both the compiler and Racer to provide the most accurate information it has available within a predefined allowed time. To make this process as efficient as possible, RLS does not control the compiler or Racer through a shell process but is linked with both.

The current release of RLS supports the following capabilities:

  • auto-completion
  • goto definition
  • goto symbol
  • find all references
  • rename/refactor
  • types on hover
  • how errors.

A key feature of RLS is it adopts Microsoft Language Server Protocol (LSP), which establishes a standard communication protocol between a client, e.g., an IDE or text editor, and a language server. This makes it possible to use RLS with a variety of IDEs or editors supporting Microsoft LSP, including Visual Studio Code, Eclipse Che, and emacs. In particular, RLS can be used with Microsoft Visual Studio Code by installing a plugin. Once the plugin is installed, Visual Studio Code will automatically start the language server and support advanced editing features for Rust.

While still in its early stages and not ready yet for real use, RLS should be able to run against most Cargo-based Rust projects, according to Turner. Developers can install it by executing the following commands:

git clone https://github.com/jonathandturner/rls
git clone https://github.com/jonathandturner/rls_vscode.git
cd rls_vscode
npm install
export RLS_ROOT=/Source/rls

And then starting VS Code. Required build-dependencies are a recent nightly rustc/cargo, git, python, node, and cmake.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT