Keyboard Shortcuts
You can trigger Ghost Text by writing a comment expressing what you want.
- To enable inline chat, press
Command
+I
. - To open Chat View, press
Command
+Shift
+I
. - To make a quick chat, press
Shift
+Option
+Command
+I
. - To accept all the Ghost text, press
Tab
. - To accept the Ghost by word, press
Command
+Right Arrow
.
Copilot - Predefined Actions
From helping you write commit messages or pull requests descriptions, renaming code symbols, fixing errors in the editor, to semantic search that helps you find relevant files.
Export Chat: export all prompts and responses for a chat session in a JSON
- Active the chat you want to export.
- Open the command palette (
Command
+Shift
+P
). - Search for
Chat: Export Chat
.
Others:
@workspace
: use the whole project workspace as the basis to answer this request.#FILENAME
: pointing copilot to a specific file/explain
: explain the selected code/doc
: add documentation comment for this symbol./tests
: generate unit tests for the selected code/fix
: propose a fix for the problems in the selected code
Various Chat Modes
Ask mode is great for asking questions about your codebase, coding and general technology concepts.
- Best for: Understanding of your codebase, brainstorming, Q&A
- Context Level: Diverse
- Change Level: Low
Edit Mode is optimized for making code edits across multiple files
- Best for: Refactoring, add new features, fix bugs, unit tests, improve code quality or performance
- Context Level: High
- Change Level: Medium
⭐️ Edit Mode VS Agent Mode:
- Edit scope: you might use edit mode if your request involves only code edits and you know the precise scope for the changes.
- Duration: agent mode involves multiple steps to process a request, so it might take longer to get a response. For example, to determine the relevant context and files to edit, determine the plan of action, and more.
- Non-deterministic: agent mode evaluates the outcome of the generated edits and might iterate multiple times. As a result, agent mode can be more non-deterministic than edit mode.
- Request quota: in agent mode, depending on the complexity of the task, one prompt might result in many requests to the backend.
Copilot Context Control
By providing the right context, you can get more relevant and accurate responses.
- By default, the currently selected text and the file name of the active editor are used as context.
- For
ask mode
oredit mode
, the active file is used as context. - For
agent mode
, the agent tools automatically determine if the active file needs to be added to the context.
#-mentions
Symbol #
enables you to refer to specific context in your codebase.
- Simply add
#codebase
in your prompt to enable code search for your entire workspace. - Reference Web Content
#fetch
: type#fetch
followed by a URL of the page you want to reference.- Example: Update the asp.net app to .net 9 #fetch https://learn.microsoft.com/en-us/aspnet/core/migration/80-90"
- Reference Github Repositories
#githubRepo
:#githubRepo
followed by the URL of theUsername/repository name
.- Example: Add unit tests for my app. Use the same test setup and structure as #githubRepo rust-lang/rust
@-mentions
This symbol is used to invoke a specific chat participant.
Example: @terminal what are the top 5 largest files in the current directory
Interact with Embeded Browser
Scenario: While you are developing a web application, you want to do a tiny change in the UI, to make it into the context, you can use the embeded browser to quickly reference the specific UI.
- Open the Simple Browser Show:
Command
+Shift
+P
->Simple Browser: Show
- Enter the URL of your web application.
http://localhost:4000/
- Click and select the specific UI you want to reference.
Other Features
- Define your own chat modes: Link