Cargo Extension

Tombi itself is written in Rust, and we want to make the Rust development experience even better 🦀

Experimentally, we provide additional features when editing Cargo.toml files.

Supported Features

Code Completion

The extension provides intelligent code completion for Cargo.toml files.

Workspace-Aware Dependency Completion

When a member crate belongs to a Cargo workspace, completion can suggest inheriting dependencies directly from [workspace.dependencies].

[dependencies]
ser # <- completion can insert `serde.workspace = true`

This also works in target-specific dependency tables such as [target.'cfg(unix)'.dependencies].

Crate Version Completion

Get version suggestions when specifying crate versions:

[dependencies]
serde = "1.0.130"  # <- version suggestions appear here
tokio = { version = "1.21.0" }  # <- also here

Features:

  • Fetches available versions from crates.io
  • Shows up to 100 versions sorted newest first
  • Works in all dependency sections (dependencies, dev-dependencies, build-dependencies, workspace.dependencies)
Crate Version Completion

Crate Feature Completion

Get feature suggestions when specifying crate features:

[dependencies]
serde = { version = "1.0", features = ["derive"] }  # <- feature suggestions
tokio = { version = "1.21", features = ["full", "net"] }  # <- in array

Features:

  • Fetches available features from:
    • crates.io for registry dependencies
    • Local Cargo.toml for path dependencies
    • Workspace Cargo.toml for workspace dependencies
  • Shows feature dependencies in documentation
  • Filters out already selected features
  • default feature shown first, features starting with _ shown last
🗒️Note

The extension is context-aware: when a dependency uses workspace = true, it looks up features from the workspace definition.

Crate Feature Completion

Path Completion

The extension also provides file and directory completion for common Cargo path fields, including:

  • [workspace].members, [workspace].exclude, and [workspace].default-members
  • dependency path fields
  • target paths such as [lib].path and [[bin]].path
  • file references such as readme, license-file, include, and exclude

Hover

For dependency entries, Tombi can enrich hover content with crate metadata.

[dependencies]
serde = "1.0" # <- crate name and description from crates.io
tombi-extension-cargo = { workspace = true } # <- metadata from the local workspace crate

Behavior:

  • workspace and local path dependencies show metadata from the referenced crate's Cargo.toml
  • registry dependencies can show crate metadata fetched from crates.io
  • in offline mode, remote crates.io lookups are skipped and only local workspace/path metadata is used

Inlay Hints

The extension can show inline hints for workspace-aware dependency values in Cargo.toml.

Current hints cover resolved dependency versions, default-features, and workspace-inherited values so you can inspect the effective dependency state without leaving the current Cargo.toml.

Go to Definition

For example, suppose you have a Cargo.toml like the one below:

Go to workspace/crate definition from dependencies

[dependencies]
serde = { workspace = true }
tombi-ast = { workspace = true }

In this case, when your cursor is on workspace, executing "Go to Definition" will navigate you to the corresponding entry in the workspace's Cargo.toml.

When your cursor is on the dependency key itself, Tombi first checks whether the workspace-managed dependency resolves to a local crate:

  • serde has no local Cargo.toml, so "Go to Definition" jumps to workspace.dependencies.serde in the workspace Cargo.toml.
  • tombi-ast resolves to a local workspace crate, so "Go to Definition" jumps to that crate's Cargo.toml and lands on the package.name value.
🗒️Note

"Go to Declaration" always uses the matching entry in the workspace Cargo.toml for workspace = true.

Go to crate definition from workspace.dependencies

[workspace.dependencies]
tombi-ast = { path = "crates/tombi-ast" }

In this case, when your cursor is on the dependency key, executing "Go to Definition" navigates to the target crate's Cargo.toml and lands on its package.name value when the workspace dependency resolves to a member or local path. When your cursor is on path, executing "Go to Definition" will navigate you to the crate definition.

Go to Declaration

[dependencies]
serde = { workspace = true }
tombi-ast = { workspace = true }

In this case, when your cursor is on workspace, executing "Go to Declaration" will navigate you to the corresponding entry in the workspace's Cargo.toml.

The table below describes the intended accessor-by-accessor split between Go to Definition, Go to Declaration, and Find References.

typeAccessorsGo to DefinitionGo to DeclarationFind References
dependencypackage.nameCurrent Cargo.toml at package.name-Usages of this package from member Cargo.toml files and workspace dependency entries
dependencyfeatures.*Current Cargo.toml at features.*-Usages of that feature from local features and dependency feature strings
dependencyfeatures.*.*Referenced feature definition in the same crate, or in the dependency crate's Cargo.toml--
dependencydependencies.*
dev-dependencies.*
build-dependencies.*
target.*.dependencies.*
target.*.dev-dependencies.*
target.*.build-dependencies.*
Dependency crate's Cargo.toml at package.name,
or the workspace Cargo.toml at workspace.dependencies.* when workspace = true,
or the current dependency entry when no more specific target exists
Workspace Cargo.toml at workspace.dependencies.* when workspace = true-
dependencyworkspace.dependencies.*Target crate's Cargo.toml at package.name when the workspace dependency resolves to a local crate,
or the current workspace.dependencies.* entry when it does not
-Dependency entries in member Cargo.toml files that use this workspace dependency
dependencydependencies.*.workspace
dev-dependencies.*.workspace
build-dependencies.*.workspace
target.*.dependencies.*.workspace
target.*.dev-dependencies.*.workspace
target.*.build-dependencies.*.workspace
Workspace Cargo.toml at the matching workspace.dependencies.* entryWorkspace Cargo.toml at the matching workspace.dependencies.* entry-
dependencydependencies.*.features.*
dev-dependencies.*.features.*
build-dependencies.*.features.*
target.*.dependencies.*.features.*
target.*.dev-dependencies.*.features.*
target.*.build-dependencies.*.features.*
Referenced dependency crate's Cargo.toml at features.*--
dependencydependencies.*.optional
dev-dependencies.*.optional
build-dependencies.*.optional
target.*.dependencies.*.optional
target.*.dev-dependencies.*.optional
target.*.build-dependencies.*.optional
Current dependency entry's optional field-Implicit feature usages generated from this optional dependency
memberworkspace.members
workspace.members.*
Member crate's Cargo.toml at package.name--
memberworkspace.default-members
workspace.default-members.*
Default member crate's Cargo.toml at package.name--
pathworkspace.dependencies.*.path
dependencies.*.path
dev-dependencies.*.path
build-dependencies.*.path
target.*.dependencies.*.path
target.*.dev-dependencies.*.path
target.*.build-dependencies.*.path
Referenced local crate's Cargo.toml at package.name--
pathbin.*.pathReferenced source file--

When Go to Definition returns the current location for a definition-site accessor, Tombi is intentionally signaling that there is no more specific definition target. In editors such as VS Code, this allows editor.gotoLocation.alternativeDefinitionCommand to take over and open the configured fallback, typically References.

Code Actions

When working with Cargo.toml files, additional code actions are available.

Inherit from Workspace

Convert package fields to inherit from workspace configuration.

Before

Inherit Dependency from Workspace

Convert dependencies to use workspace versions.

Before

Convert Dependency to Table Format

Transform simple string dependencies to table format for adding additional fields.

Before

Add to Workspace and Inherit Dependency

Promote versioned dependencies into the workspace while switching members to use the shared entry.

Before

The workspace entry keeps the original requirement, and the member now follows the workspace-managed version.

Update Dependency to Latest Version

Refresh the selected dependency requirement to the latest published version. Use this when the manifest already references a package and you want Tombi to rewrite just the version requirement without converting the dependency shape.

The extension enriches Cargo.toml with contextual document links so you can jump directly to related resources:

  • Entries in [workspace.members] and [workspace.default-members] open the corresponding member crate's Cargo.toml.
  • Dependencies in member Cargo.toml files surface links to the workspace definition (when workspace = true), local path Cargo.toml files, git repositories, custom registries, or crates.io when applicable.
  • [workspace.dependencies] entries provide quick access both to the workspace declaration and the external source (registry/git/crates.io).
  • Fields such as package.workspace, lints.workspace, and [bin] targets link back to their workspace counterparts or the referenced source file for faster navigation.