Skip to main content

Editor Support

Rank ships a Language Server Protocol (LSP) server and a VS Code extension. Any editor that can spawn a Node process and communicate over stdio can use the server.

Supported features

FeatureDescription
DiagnosticsType errors and name errors appear as squiggles at the correct source location
HoverShows the inferred type of any identifier
Go-to-definitionJump to the binding declaration, including across module boundaries
CompletionIn-scope value names, type names, and language keywords
Syntax highlightingToken-level highlighting for .rank files

VS Code

Install

The extension is not yet published to the Marketplace. To install it locally from the repo:

cd packages/vscode
npm run package # produces rank-language-support-0.0.1.vsix
code --install-extension rank-language-support-0.0.1.vsix

Reload VS Code. Open any .rank file — the language ID rank is registered automatically and the language server starts in the background.

How it works

The extension spawns the @rank-lang/lsp server as a child process and communicates over stdio. The server calls directly into the Rank compiler pipeline, so diagnostics and type information are always consistent with what rank check reports.

Other LSP editors

The server entry point is packages/lsp/dist/server.js. It accepts no flags and communicates over stdio.

Neovim (via nvim-lspconfig):

require('lspconfig').configs.rank = {
default_config = {
cmd = { 'node', '/path/to/packages/lsp/dist/server.js', '--stdio' },
filetypes = { 'rank' },
root_dir = require('lspconfig.util').root_pattern('rank.toml'),
},
}
require('lspconfig').rank.setup {}

Helix (~/.config/helix/languages.toml):

[[language]]
name = "rank"
scope = "source.rank"
file-types = ["rank"]
language-servers = ["rank-lsp"]

[language-server.rank-lsp]
command = "node"
args = ["/path/to/packages/lsp/dist/server.js", "--stdio"]

Zed (.zed/settings.json):

{
"lsp": {
"rank": {
"binary": {
"path": "node",
"args": ["/path/to/packages/lsp/dist/server.js", "--stdio"]
}
}
}
}

Language ID

The language identifier is rank. Use this when configuring file-type associations or LSP settings in editors not listed above.

Browser editors

Browser-based editors should not embed @rank-lang/lsp — it is a Node stdio server and does not run in the browser. Instead, reuse the compiler-side query exports (hoverInfoAtPosition, findDefinitionAtPosition, completionItemsAtPosition) from a browser worker backed by the browser compiler host. See the Playground page for details on the browser compiler surface.