Available Code Commands
When you interact with code in your editor, you can access Sixth commands in two ways:Right-Click Context Menu
When you right-click on selected code, you’ll see:
Add to Sixth
The “Add to Sixth” command sends your selected code to the Sixth chat panel. This is perfect for:- Asking questions about specific code snippets
- Requesting improvements or optimizations
- Getting explanations of complex logic
- The file path (as a file mention)
- The selected code with proper formatting
- The programming language for accurate syntax highlighting
Lightbulb Menu (Code Actions)
When you see a lightbulb icon in your editor, click it to access these Sixth commands:
Fix with Sixth
The “Fix with Sixth” command appears in the lightbulb menu when your code has errors or warnings. This command:- Captures the selected code
- Identifies the errors or warnings from VSCode’s diagnostics
- Sends both to Sixth with a request to fix the issues
- Provides a solution that addresses the specific problems
Explain with Sixth
The “Explain with Sixth” command helps you understand complex code. When you select code and use this command from the lightbulb menu, Sixth:- Analyzes the selected code
- Provides a clear explanation of what the code does
- Breaks down complex logic into understandable parts
- Highlights important patterns or techniques used
Improve with Sixth
The “Improve with Sixth” command helps you enhance your code. When you select code and use this command from the lightbulb menu, Sixth:- Analyzes the selected code for potential improvements
- Suggests optimizations, refactorings, or better practices
- Explains the reasoning behind the suggested changes
- Provides improved code that maintains the original functionality
How to Use Code Commands
Using Sixth’s code commands is simple:For Right-Click Commands:
- Select the code you want to work with
- Right-click to open the context menu
- Choose “Add to Sixth”
- View the result in the Sixth chat panel
For Lightbulb Menu Commands:
- Select the code you want to work with
- Look for the lightbulb icon that appears in the editor gutter
- Click the lightbulb to see available actions
- Choose the appropriate Sixth command (Fix, Explain, or Improve)
- View the result in the Sixth chat panel
- Ask follow-up questions
- Request modifications to the solution
- Apply the changes back to your code
How It Works Under the Hood
When you use a code command, here’s what happens behind the scenes:- Code Selection: The extension captures your selected code and its context
-
Metadata Collection: Sixth gathers important metadata:
- File path and name
- Programming language
- Any associated diagnostics (errors/warnings)
- Surrounding code context when relevant
-
Command Processing:
- For “Add to Sixth,” the code is formatted and sent to the chat panel
- For “Fix with Sixth,” the code and diagnostics are analyzed and a fix is generated
- For “Explain with Sixth,” the code is analyzed to provide a clear explanation
- For “Improve with Sixth,” the code is analyzed for potential optimizations and improvements
-
Integration with Chat: The results appear in the Sixth chat panel, where you can:
- See the AI’s response
- Ask follow-up questions
- Apply suggested changes
Tips for Effective Use
- Select complete logical units: When possible, select entire functions, classes, or modules to give Sixth complete context
- Include imports: For language-specific help, include relevant imports so Sixth understands dependencies
- Combine with @ mentions: For complex issues, use code commands along with file or problem mentions for more context
- Use keyboard shortcuts: Speed up your workflow by assigning keyboard shortcuts to common code commands