Table of Contents
Introduction
GitHub Copilot Chat offers multiple view modes for interacting with Copilot. Each mode has different characteristics and is suited for different scenarios when creating unit tests. Understanding these modes helps you choose the best approach for your needs.
Key Point: Different chat view modes offer different experiences - Editor View for full conversations, Inline View for quick context-aware interactions, and Terminal View for command-line focused tasks.
Chat View Modes Overview
Copilot Chat has three main view modes:
1. Editor View
Full chat panel in editor with complete conversation history
2. Inline View
Context-aware chat that appears inline in code
3. Terminal View
Chat in terminal context for command-line tasks
Editor View Mode
Editor View provides a full chat experience in a dedicated panel:
Characteristics
- Full conversation history visible
- Code blocks with syntax highlighting
- Can apply code directly from chat
- Multi-turn conversations
- Dedicated panel in editor
- Persistent across sessions
Accessing Editor View
- Press
Ctrl+Shift+I(Windows/Linux) orCmd+Shift+I(Mac) - Command Palette → "GitHub Copilot: Open Chat"
- Click Copilot icon in sidebar
- Right-click → "Open Copilot Chat"
Creating Tests in Editor View
- Select code in editor
- Open Editor View chat
- Type: "Write unit tests for the selected function"
- Review generated tests in chat
- Apply code directly from chat
- Continue conversation to refine tests
Best For
- Complex test generation requiring multiple iterations
- When you need full conversation history
- Generating multiple test files
- Detailed discussions about test requirements
- When working with multiple functions
Inline View Mode
Inline View provides context-aware chat directly in your code:
Characteristics
- Context-aware based on selection
- Appears inline in code
- Quick explanations or modifications
- Less intrusive
- Focused on specific code
- Supports multi-turn conversations
Accessing Inline View
- Press
Ctrl+I(Windows/Linux) orCmd+I(Mac) - Right-click → "Ask Copilot"
- Command Palette → "GitHub Copilot: Inline Chat"
Creating Tests in Inline View
- Select function or class
- Press
Ctrl+IorCmd+I - Type: "Write unit tests for this function"
- Review generated tests
- Refine through conversation
- Apply when satisfied
Best For
- Quick test generation for specific functions
- When you want to stay focused on code
- Context-aware test creation
- Iterative refinement of tests
- Less disruptive workflow
Terminal View Mode
Terminal View provides chat in terminal context:
Characteristics
- Command-line assistance
- Script generation
- Terminal-related questions
- Test execution commands
- CI/CD related tasks
Accessing Terminal View
- Open integrated terminal
- Right-click in terminal
- Select "Ask Copilot"
- Or use command palette
Creating Tests in Terminal View
- Ask for test generation commands
- Request test execution scripts
- Generate test setup commands
- Create test configuration
- Get help with test runners
Best For
- Test execution commands
- Test setup scripts
- CI/CD test configuration
- Test runner help
- Command-line test operations
Creating Tests in Each Mode
Comparison of test creation approaches:
Editor View - Full Conversation
- Select code
- Open Editor View (
Ctrl+Shift+I) - Request: "Write comprehensive unit tests for the selected function"
- Review tests in chat panel
- Continue conversation: "Add edge case tests"
- Apply code from chat
Inline View - Quick and Context-Aware
- Select function
- Press
Ctrl+IorCmd+I - Type: "Write unit tests"
- Review inline
- Refine: "Add null checks"
- Apply directly
Terminal View - Command Focused
- Open terminal
- Ask: "How do I run Jest tests?"
- Get test execution commands
- Request: "Generate test setup script"
- Use commands in terminal
Choosing the Right Mode
Select the appropriate mode based on your needs:
Use Editor View When:
- You need full conversation history
- Creating complex test suites
- Working with multiple functions
- Need detailed discussions
- Want persistent chat
Use Inline View When:
- Quick test generation for specific code
- Want to stay focused on code
- Need context-aware suggestions
- Prefer less intrusive interface
- Working on single function
Use Terminal View When:
- Need test execution commands
- Setting up test environment
- Creating test scripts
- CI/CD configuration
- Command-line focused tasks
Best Practices
1. Match Mode to Task
- Use Editor View for complex test suites
- Use Inline View for quick function tests
- Use Terminal View for commands and scripts
- Switch modes as needed
- Combine modes for comprehensive workflow
2. Provide Clear Context
- Select relevant code before requesting tests
- Specify testing framework
- Mention specific requirements
- Include project context
- Reference existing test patterns
3. Iterate and Refine
- Start with basic request
- Review generated tests
- Ask for modifications
- Add specific test cases
- Refine until satisfied
4. Review and Test
- Always review generated tests
- Verify test logic
- Run tests immediately
- Fix any issues
- Ensure tests are maintainable
Exam Key Points
- Three chat view modes: Editor View, Inline View, Terminal View
- Editor View: Full chat panel, conversation history, best for complex test suites
- Inline View: Context-aware, appears inline, best for quick function tests
- Terminal View: Command-line focused, best for test execution and scripts
- Editor View access: Ctrl+Shift+I / Cmd+Shift+I
- Inline View access: Ctrl+I / Cmd+I
- Terminal View: Right-click in terminal → "Ask Copilot"
- Each mode has different characteristics and use cases
- Choose mode based on task complexity and workflow needs
- Can switch between modes as needed
- All modes support multi-turn conversations
- Best practices: match mode to task, provide clear context, iterate and refine, review and test
- Editor View best for complex test generation with full history
- Inline View best for quick, context-aware test creation
- Terminal View best for test commands and scripts
0 Comments