Rust
Table of Contents
The rust plugin of getkalem/plugins makes Kalem an editor for
Rust. It is a language plugin: a manifest, a syntax and settings. Its
own README lists the same and is kept with it.
1. What is followed
- The grammar of the highlighter is Sublime Text's own Rust syntax,
from sublimehq/Packages at
7f74b54(2026-02-11, MIT), unchanged: the current editions (asyncand.await, let chains, raw identifiers, C strings,use<'a>, every macro fragment specifier), format strings with named widths, and the#!line and TOML frontmatter of a single-file package. It takes.rsfiles andrustsource blocks from Kalem's built-in Rust syntax, which predatesasync. - The server is the oracle for everything else: rust-analyzer. Kalem shows what it says and changes nothing in it.
| Files | Language |
|---|---|
.rs, #! with cargo or rust-script |
Rust |
Cargo.toml is served by Taplo and crates-lsp (below) and highlighted
by Kalem's TOML; Cargo.lock stays Kalem's. A #! script without the
.rs extension is served but not colored as Rust.
2. The project
The root is the nearest folder up from the file with a Cargo.lock.
Cargo writes the lock where it puts the workspace's root, so a
workspace is one root and one server whatever member a file is in,
and a workspace inside another folder with a Cargo.toml is a root of
its own. A project never built has no lock yet: its file's folder is
the root, rust-analyzer finds the Cargo.toml above it, and its first
cargo metadata writes the lock. rust-analyzer runs in the root, so
rustup honors the project's rust-toolchain.toml. A file of the
standard library or of a dependency, reached by going to a
definition, is served by the rust-analyzer that named it.
A .rs file outside any Cargo project gets a server that answers
nothing until rust-analyzer's linkedProjects setting names it; a
.kalem/settings.toml in its folder can, read when Kalem starts on
that file (Kalem reads one such file a session, and the setting then
holds for every rust-analyzer of the session):
[plugins."org.kalem.rust".settings.rust-analyzer] linkedProjects = ["scratch.rs"]
3. Installing a server
| How |
|---|
rustup component add rust-analyzer: the toolchain's own, the one rust-toolchain.toml names |
brew install rust-analyzer |
A release from rust-lang/rust-analyzer, renamed rust-analyzer and put on the PATH |
kalem lsp status FILE says which is used, where it was found and its
version (rust-analyzer --version). rustup puts a rust-analyzer on
the PATH whether or not the component is installed; without it,
status says that it does not run and rustup's reason, and the editor
says that it did not start, with these ways to install it.
4. Cargo.toml
A Cargo.toml is served by two servers beside each other: Taplo
(brew install taplo) completes and documents its keys from
SchemaStore's Cargo schema and formats it, and crates-lsp (cargo
install crates-lsp --locked) completes a crate's versions and says
when a newer one is out or a crate does not exist, from crates.io.
Both need the network; either runs without the other, and kalem lsp
status Cargo.toml says which are found. Another .toml file stays
Kalem's TOML. Taplo 0.10 cannot read SchemaStore's catalog any more and
logs so; the plugin gives it the Cargo schema by name instead.
5. Known differences
Checked against rust-analyzer 1.99.0 (b940084d 2026-09-28) on Rust 1.99.0, with the plugin's corpus workspace and with Kalem's own repository.
- rust-analyzer gives its own diagnostics (type mismatches, names not
in snake case, unresolved imports, a file no module includes) only
when asked, after a file opens and after its changes; cargo's
(
cargo check, orclippyby the settingcheck.command) come when the project is loaded and after each save. An error both find, a type mismatch, is listed twice, fromrustcand from rust-analyzer, as VS Code lists it. - A completion does not add its
use: rust-analyzer offers an item not imported only to an editor that fetches the import when the item is taken, which Kalem does not do yet. - A rename is one undo step in each file it changes.
- rust-analyzer answers Format Document with no edits both when the
file is formatted and when rustfmt fails (not installed for the
toolchain, a syntax error): Kalem says it changed nothing, and its
log (
kalem lsp check --log) says why. - Kalem's own repository (24 crates): the first documentation and completion 78 s after opening, 3.2 GB of memory once loaded, 4.4 GB at the peak; completion in 7 to 90 ms after that; an edit sent to the server in under 1.3 ms meanwhile. Edits made while it indexes start the indexing over.
- Highlighting: the names a declaration gives (a struct's, a trait's,
a constant's, a label) have no color, since Kalem maps no
entity.name.structand kin to a color yet; a type of the project's own,Selfand a primitive have the keywords' color (storage.type), the standard library's types and variants (Option,Some) the types' color (support.type); every variable is colored. - Open Documentation in the Browser gives docs.rs's address for any crate, which docs.rs has only once the crate is published.
- rust-analyzer's state shows in the status bar only while it works
in part or not at all ("cargo check failed to start" for a project whose
dependencies Cargo cannot read). Enter in a
//or///comment goes on with it as rust-analyzer makes the new line, unless typing went on before it answered. Structural Search and Replace puts a placeholder's expression in parentheses in the replacement.
6. Not implemented
The test at the cursor, and rust-analyzer's Run and Run Test above
main and each test, wait for code lenses; the project's cargo run
and cargo test run with SPC p R and SPC p T, in the workspace's
root. No debugger: Kalem has none. rust-analyzer's syntax tree is not
offered (it answers it for VS Code's own view). Rust source blocks in
Org and Markdown are highlighted, not served.