Code Actions
Quick fixes to update dependencies with semver-aware labels.
Table of contents
- Overview
- Using Code Actions
- Semver Labels
- Bulk Updates
- Smart Defaults
- Version Constraints
- Workflow Tips
- Troubleshooting
Overview
Code actions provide one-click updates for your dependencies. They understand semantic versioning and label updates so you can make informed decisions.
Using Code Actions
Trigger Code Actions
- Place your cursor on a dependency line
- Press
Cmd+.(Mac) orCtrl+.(Linux/Windows) - Select an update action from the menu
Alternatively, click the lightbulb icon that appears in the gutter.
Available Actions
When an update is available, you’ll see options like:
Update tokio to 1.36.0 (· patch)Update serde to 2.0.0 (⚠ MAJOR)
Semver Labels
Code actions include semver labels to help you understand the impact:
| Label | Meaning | Safety |
|---|---|---|
⚠ MAJOR |
Breaking changes | Review changelog before updating |
+ minor |
New features, backwards compatible | Generally safe |
· patch |
Bug fixes only | Recommended |
* prerelease |
Experimental version | Use with caution |
Major Updates
Update dependency to 2.0.0 (⚠ MAJOR)
Major updates may include breaking API changes. Always:
- Read the changelog
- Check migration guides
- Test thoroughly after updating
Minor Updates
Update dependency to 1.5.0 (+ minor)
Minor updates add features without breaking existing code. Generally safe to apply.
Patch Updates
Update dependency to 1.4.3 (· patch)
Patch updates contain only bug fixes. These are the safest updates.
Prerelease Updates
Update dependency to 2.0.0-beta.1 (* prerelease)
Prerelease versions are for testing new features. Not recommended for production.
Bulk Updates
Update All Dependencies
When multiple dependencies have updates available, a bulk action appears:
Update all dependencies (5 packages)
This updates all packages to their latest versions in one action.
Bulk updates apply all changes at once. Review the changes carefully, especially for major version updates.
Smart Defaults
Dependi prioritizes updates intelligently:
- Patch updates are shown first (safest)
- Minor updates are offered next
- Major updates require explicit selection
This encourages safer update practices while still making major updates accessible.
Version Constraints
Code actions respect your version constraint syntax:
| Original | Action | Result |
|---|---|---|
"1.0.0" |
Update to 1.0.5 | "1.0.5" |
"^1.0.0" |
Update to 1.5.0 | "^1.5.0" |
"~1.0.0" |
Update to 1.0.5 | "~1.0.5" |
">=1.0" |
Update to 1.5.0 | ">=1.5.0" |
Workflow Tips
Safe Update Strategy
- Start with patch updates - they’re low risk
- Apply minor updates next
- Handle major updates individually with testing
CI Integration
After updating, run your CI pipeline to catch any issues:
# Run tests
cargo test
# Check for breaking changes
cargo clippy
Lockfile Updates
After applying code actions, update your lockfile:
# Rust
cargo update
# Node.js
npm install
# Python
pip install -r requirements.txt
Troubleshooting
No Code Actions Appearing
- Ensure cursor is on a dependency line
- Check that the package has available updates
- Verify inlay hints are showing (same data source)
Action Not Applying
- Check file is saved
- Verify syntax is correct
- Look for conflicting edits
Wrong Version Suggested
- Clear cache:
rm -rf ~/.cache/dependi/ - Restart Zed
- Check if registry has newer version