Fast Apply
Fast Apply is a powerful feature that allows you to quickly apply AI-generated code changes to your files with minimal effort. It streamlines the process of incorporating AI suggestions into your codebase.
How does Fast Apply work?
Fast Apply analyzes the AI-generated code suggestions and automatically applies them to the appropriate locations in your files. It uses intelligent matching to:
- Identify the correct insertion points
- Handle code formatting and indentation
- Resolve potential conflicts
- Maintain code structure and syntax
Prerequisites
- VS Code version 1.93 or later
- Trae Plugin installed and activated
- An active project with code files
Using Fast Apply
Basic Usage
- Generate AI suggestions: Use any of Trae's AI capabilities to generate code suggestions
- Review suggestions: The AI will present code changes with Fast Apply options
- Apply changes: Click the Fast Apply button to automatically apply the changes
- Verify results: Review the applied changes in your editor
Fast Apply Options
Apply All: Applies all suggested changes across multiple files at once.
Apply Selected: Allows you to choose specific changes to apply while ignoring others.
Preview Changes: Shows a diff view of what will be changed before applying.
Undo Changes: Reverts the last Fast Apply operation if needed.
Smart Conflict Resolution
When Fast Apply encounters potential conflicts, it will:
- Highlight conflicts: Show areas where changes might conflict with existing code
- Suggest resolutions: Provide options for resolving conflicts
- Allow manual review: Let you manually resolve complex conflicts
- Preserve existing code: Ensure your existing code isn't accidentally overwritten
Supported Operations
Fast Apply supports various types of code changes:
Code Generation
- Function implementations
- Class definitions
- Variable declarations
- Import statements
Code Modifications
- Refactoring existing functions
- Adding new methods to classes
- Updating variable assignments
- Modifying configuration files
Code Formatting
- Automatic indentation correction
- Code style consistency
- Syntax formatting
Best Practices
- Review before applying: Always review AI suggestions before using Fast Apply
- Use version control: Commit your changes before applying large modifications
- Test after applying: Run tests to ensure applied changes work correctly
- Start small: Begin with small changes to understand how Fast Apply works
Configuration
You can customize Fast Apply behavior in VS Code settings:
- Open VS Code settings (
Ctrl+,on Windows/Linux,Cmd+,on macOS) - Search for "Trae Fast Apply"
- Configure options such as:
- Auto-apply threshold
- Conflict resolution behavior
- Backup creation settings
- Formatting preferences
Keyboard Shortcuts
- Apply suggestion:
Ctrl+Enter(Windows/Linux),Cmd+Enter(macOS) - Preview changes:
Ctrl+Shift+P(Windows/Linux),Cmd+Shift+P(macOS) - Undo last apply:
Ctrl+Z(Windows/Linux),Cmd+Z(macOS)
Safety Features
Fast Apply includes several safety features to protect your code:
- Automatic backups: Creates backups before applying changes
- Undo functionality: Allows you to revert changes if needed
- Conflict detection: Identifies potential issues before applying
- Syntax validation: Ensures applied code maintains valid syntax
Troubleshooting
If Fast Apply isn't working as expected:
- Check file permissions: Ensure files are writable
- Verify syntax: Make sure the target file has valid syntax
- Review conflicts: Check for merge conflicts or overlapping changes
- Restart VS Code: Sometimes a restart resolves temporary issues
For additional support, refer to the Support documentation or FAQs.