Core AI Commands
These are the primary AI-powered commands with dedicated keyboard shortcuts:Explain Code
- Shortcut:
Alt+Ctrl+N(Windows/Linux) orCmd+Ctrl+N(Mac) - Function: Analyzes and explains selected code or the current file
- Usage: Select code and press the shortcut, or use without selection to explain the entire file
Fix Code
- Shortcut:
Alt+Ctrl+X(Windows/Linux) orCmd+Ctrl+X(Mac) - Function: Identifies and fixes issues in selected code
- Usage: Select problematic code and press the shortcut for AI-powered fixes
Improve Code
- Shortcut:
Alt+Ctrl+I(Windows/Linux) orCmd+Ctrl+I(Mac) - Function: Suggests improvements and optimizations for selected code
- Usage: Select code and press the shortcut to get enhancement suggestions
Context Menu Commands
Right-click on code to access these commands when available:Code Analysis Commands
- Explain with Elastic: Available when code is selected
- Fix with Elastic: Available when code is selected
- Improve with Elastic: Available when code is selected
Reference Commands
- Add to References: Available when a reference provider is active
- Remove from References: Available when a reference provider is active
- Whether code is selected
- Whether a reference provider is available
- Current editor state
Command Palette Access
All Elastic Copilot commands are accessible through VS Code’s Command Palette (Ctrl+Shift+P or Cmd+Shift+P):
Core Commands
Elastic: Explain CodeElastic: Fix CodeElastic: Improve Code
Interface Commands
Elastic: New Task- Start a new conversationElastic: History- View conversation historyElastic: Account- Manage account settings
Advanced Commands
Elastic: Export Markdown- Export conversations to markdownElastic: Open File- Open files through AI assistanceElastic: Extract Text- Extract text from various sources
Memory Bank Integration
Commands work seamlessly with Memory Bank features:Context-Aware Commands
- Commands automatically include relevant context from Memory Bank
- Active context templates enhance command responses
- Product and technical context inform AI responses
Memory-Enhanced Shortcuts
- Keyboard shortcuts leverage stored project knowledge
- Commands adapt based on current project configuration
- Context switching affects command behavior
MCP Tool Integration
Commands can utilize MCP (Model Context Protocol) tools:Enhanced Capabilities
- Commands may trigger MCP tool usage automatically
- External tool integration through MCP servers
- Extended functionality beyond core AI features
Tool-Specific Commands
- Commands adapt when MCP tools are available
- Tool-specific shortcuts may become available
- Dynamic command enhancement based on connected tools
Browser Integration
Commands work with browser functionality:Web-Enhanced Commands
- Commands can incorporate web research
- Browser session context affects responses
- URL content integration in command responses
Best Practices
Effective Usage
- Select Specific Code: For targeted analysis, select the exact code you want to work with
- Use Context: Commands work better with relevant context from Memory Bank
- Combine Commands: Use multiple commands in sequence for comprehensive code improvement
- Leverage Shortcuts: Keyboard shortcuts are faster than menu navigation
Optimization Tips
- Configure Memory Bank: Set up project context for better command responses
- Use MCP Tools: Connect relevant tools to enhance command capabilities
- Maintain Context: Keep related files open for better contextual understanding
- Review Suggestions: Always review AI suggestions before implementing
Troubleshooting
Common Issues
Commands Not Appearing- Ensure Elastic Copilot is properly installed and activated
- Check that you’re in a supported file type
- Verify code selection if using selection-based commands
- Check for conflicting key bindings in VS Code settings
- Ensure the extension is active and properly loaded
- Restart VS Code if shortcuts stop responding
- Right-click directly on selected code
- Ensure code is properly selected
- Check that the file type is supported
Performance Optimization
- Use specific code selections rather than entire files when possible
- Ensure Memory Bank is properly configured for your project
- Keep related context files accessible for better responses
Customization
Key Bindings
You can customize keyboard shortcuts in VS Code:- Open Command Palette (
Ctrl+Shift+P) - Search for “Preferences: Open Keyboard Shortcuts”
- Search for “Elastic” commands
- Modify shortcuts as needed
Context Menu
Context menu items are automatically managed based on:- Current selection state
- Available reference providers
- Active MCP tools
- Extension configuration