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.
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 hereFeatures:
- 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 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 arrayFeatures:
- Fetches available features from:
- crates.io for registry dependencies
- Local
Cargo.tomlfor path dependencies - Workspace
Cargo.tomlfor workspace dependencies
- Shows feature dependencies in documentation
- Filters out already selected features
defaultfeature shown first, features starting with_shown last
The extension is context-aware: when a dependency uses workspace = true, it looks up features from the workspace definition.
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 workspace definition or to the crate definition managed by the workspace.
In the example above, for serde (an external crate), you'll be navigated to the workspace definition, while for tombi-ast (a crate managed by the workspace), you'll be navigated to the crate definition.
If you consistently want to navigate to the workspace's Cargo.toml, use "Go to Declaration".
Go to crate definition from workspace.dependencies
[workspace.dependencies]
tombi-ast = { path = "crates/tombi-ast" }In this case, 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 crate definition.
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
[package]
version = "1.0.0"
authors = ["John Doe"]
# After applying "Inherit from workspace"
[package]
version.workspace = true
authors.workspace = trueInherit Dependency from Workspace
Convert dependencies to use workspace versions:
# Before
[dependencies]
serde = "1.0"
# After applying "Inherit dependency from workspace"
[dependencies]
serde = { workspace = true }Convert Dependency to Table Format
Transform simple string dependencies to table format for adding additional fields:
# Before
[dependencies]
serde = "1.0"
# After applying "Convert to table format"
[dependencies]
serde = { version = "1.0" }Add to Workspace and Inherit Dependency
Promote versioned dependencies into the workspace while switching members to use the shared entry:
# Before
# Workspace Cargo.toml
[workspace.dependencies]
# (serde not present)
# Member Cargo.toml
[dependencies]
serde = "1.0"
# After applying "Add to Workspace and Inherit Dependency"
[workspace.dependencies]
serde = "1.0"
[dependencies]
serde = { workspace = true }The workspace entry keeps the original requirement, and the member now follows the workspace-managed version.
Document Links
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'sCargo.toml. - Dependencies in member manifests surface links to the workspace definition (when
workspace = true), local path manifests, 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.