Copilot on VSCode Flashcards
Reference and terminology on GitHub Copilot integration into VS Code (32 cards)
What are the 4 different ways to initiate a chat conversation with Copilot ?
- Chat view
- Inline Chat
- Quick Chat
- Copilot Edits view
There are many use cases for Copilot in VS Code. List 7 use cases involving direct code generation
- Code completions in the editor
- Iterate on large changes across multiple files using multi-turn chat conversation
- Provide guidance and support for common coding tasks and challenge, which can be tailored to the current workspace or project context
- Improve code understanding by explaining selected code
- Suggestions for code refactoring and improvements
- Generate a new workspace with scaffolding for the project structure based on a specific tech stack
- Generate scaffolding for a new Juypter notebook
There are many use cases for Copilot in VS Code. List 5 use cases related to debugging and testing
- Propose bug fixes
- Propose fixes for failing tests and terminal command errors
- Configure testing framework setup
- Generate unit test cases for this testing framework based on specific context
- Generate test cases for edge cases and boundary conditions
There are many use cases for Copilot in VS Code. List 6 use cases that does not involve direct code generation.
- Generate code documentation for selected code snippet
- Suggestions for terminal or shell related commands / functionality
- New rename suggestions for source code symbols
- Semantic search results
- Generate commit messages and PR descriptions
- Get help on relevant VS Code commands
What is the purpose of adding chat context to a chat prompt in the Chat view ?
To help Copilot give you the best and most relevant answers by scoping the response to a specific context
What is automatically added as context to the chat prompt in the Chat view ?
The currently active editor
If a block of code selected in the editor, only that selection is added as context.
List the 3 ways to add context to your chat prompt
1) Use the paperclip button icon in any of the chat interactions, then select the specific type of context from a Quick Pick
2) Drag and drop editor tabs, or files or folders from the Explorer view, Search view, or editor breadcrumb onto the Chat view.
3) Use chat variables by typing the # character
What is Inline Chat and how is it helpful ?
Inline Chat enables you to have a chat conversation with Copilot directly from the editor.
Allows preview code suggestions (modifications / refactoring) in-place within your code, which can be useful for quickly iterating on code changes.
Where is another common location that inline Chat is available at and how is it used ?
In the terminal to help you answer questions related to the terminal and shell commands, using the @terminal chat participant
Where is the Chat view located by default ?
The Secondary Sidebar
When Copilot chat returns source code in a code block, state 2 features of this block
a) Depending on the language extension, the code block in the chat response might support IntelliSense, which enables you get information about methods and symbols by hovering over them
b) Hovering over the code block presents various options such Smart Apply generated code block in Active Editor, Insert generated code block at Cursor, and Copy.
When would you use Quick Chat ?
If you want to ask Copilot a quick question and don’t want to start a full Chat view session or open Inline Chat in your editor
What are multi-turn conversations and how are they possible ?
Iterating and prompting Copilot to improve on initial suggestions
This is possible since Copilot has both the context of the generated code and chat conversation history
What are smart actions and how are they accessed ?
Actions to obtain specific help from Copilot without using a prompt. They are accessed from the editor context menu when a block of code is highlighted.
Give the 5 types of smart actions available through the editor context menu?
- Explain
- Fix
- Review and Comment
- Generate Docs
- Generate Tests
How is the Fix smart action alternatively accessed and how does it appear?
From the context menu that appears when the cursor is positioned on a term or statement where an error or issue has been flagged.
It appears as Fix using Copilot
What other Copilot feature is the Fix Smart action a shortcut for ?
Inline chat with the /fix slash command
What does a Code Action icon (small lightbulb) with an additional sparkle at its edge mean?
It provides a comprehensive list of options code fix or code refactoring, including Copilot smart actions
What are chat participants and how are they accessed?
They are domain experts (context-specific components) integrated with the Copilot environment which enable Copilot Chat to interact with various aspects of the user’s workflow.
Accessed by typing @ followed by the participant name
List the 4 main built-in chat participants and the knowledge/context that they possess
- @workspace has context about the code in your workspace
- @vscode knows about commands and features in the VS Code editor
- @terminal has context about the integrated terminal shell and its contents
- @github has knowledge about your GitHub repositories, issues, pull requests, and topics
1.1.21 Where else can additional chat participants be obtained from?
Extensions from the VS Marketplace
1.1.22 How do chat participants provide shortcuts to specific functionality?
Through slash commands
1.1.23 How do you include slash commands in a chat prompt? Give a simple example
Start with the participant followed by the slash / and finally the command, for e.g. @workspace /fix
1.1.24 Give 3 common built-in slash commands for the @workspace participant ?
- @workspace /explain (or /explain): explain how the selected code works
- @workspace /fix (or /fix): propose a fix for the problems in the selected code
- @workspace /new (or /new): scaffold code for a new workspace or new file