Beginner

Basic Usage

Learn to use the chat panel, inline chat, quick chat, and provide context effectively with participants and variables. This is the foundation for everything else in this course.

Chat Panel Overview

The chat panel is your primary interface for extended conversations with Copilot. Open it with Ctrl+Shift+I (Windows/Linux) or Cmd+Shift+I (Mac).

The panel consists of:

  • Message input — Type your questions or commands at the bottom
  • Conversation history — Previous messages and responses scroll above
  • Code blocks — AI responses with code include copy/insert/apply buttons
  • New chat button — Start a fresh conversation (or use /clear)

Asking Questions About Code

The simplest way to use Copilot Chat is to ask questions. Select some code in your editor, then open the chat panel and ask about it. Copilot automatically uses your selection as context.

Example Questions
// General questions
What does this function do?
How can I make this code more efficient?
What design pattern is this using?

// Specific questions
Why does this regex match empty strings?
What happens if the input array is empty?
Is this code thread-safe?
Context matters: Copilot Chat automatically includes the active file as context. For better answers, select the specific code you are asking about before typing your question.

Using @workspace for Project-Wide Context

The @workspace participant gives Copilot knowledge about your entire project. It can search across files, understand your project structure, and answer questions that span multiple files.

@workspace Examples
@workspace Where is the user authentication handled?

@workspace What database ORM does this project use?

@workspace List all API endpoints in this project

@workspace How are environment variables configured?

@workspace What testing framework is used and where are the tests?
💡
How @workspace works: When you use @workspace, Copilot Chat creates an index of your project files. It uses this index to find relevant files and include them as context. For large projects, this may take a moment on first use.

Using @vscode for Editor Help

The @vscode participant specializes in VS Code itself. Use it when you need help with editor features, settings, extensions, or workflows.

@vscode Examples
@vscode How do I set up a custom keyboard shortcut?

@vscode What is the setting to auto-format on save?

@vscode How do I configure the integrated terminal to use zsh?

@vscode What extensions do you recommend for Python development?

Using #file and #selection for Context

Context variables let you explicitly point Copilot Chat at specific code. This is essential when you want to reference code that is not currently visible or selected.

#file — Reference Any File

Type #file followed by the file path. VS Code will show an autocomplete dropdown of files in your workspace.

#file Examples
// Reference a specific file for context
Write a test for the UserService class in #file:src/services/user.service.ts

// Compare two files
What are the differences between #file:src/v1/api.ts and #file:src/v2/api.ts?

// Ask about configuration
Explain the build configuration in #file:webpack.config.js

#selection — Use Selected Text

When you have text selected in the editor, you can reference it explicitly with #selection. This is especially useful in inline chat.

#selection Examples
// Refactor selected code
Refactor #selection to use the strategy pattern

// Explain selection
Explain #selection line by line

// Convert selected code
Convert #selection from JavaScript to TypeScript

Inline Chat for Quick Edits

Inline chat (Ctrl+I / Cmd+I) opens a small input field directly in your editor. This is the fastest way to make targeted changes to your code.

Common inline chat workflows:

  1. Select Code, Then Modify

    Select a block of code, press Ctrl+I, and describe the change: "Add error handling" or "Convert to async/await".

  2. Place Cursor, Then Generate

    Place your cursor where you want new code, press Ctrl+I, and describe what to generate: "Create a function that validates email addresses".

  3. Review and Accept

    Copilot shows a diff preview. Press Enter to accept, Escape to reject, or refine your prompt.

Inline chat shortcut: After selecting code, you can also right-click and choose "Copilot → Start Inline Chat" from the context menu.

Quick Chat

Quick chat (Ctrl+Shift+Alt+L) opens a lightweight popup at the top of your editor. It is designed for fast, one-off questions where you do not need a full conversation history.

Quick Chat Examples
// Quick syntax lookups
How do I destructure nested objects in JavaScript?

// Quick command help
What is the git command to stash untracked files?

// Quick conversions
Convert 1680px to rem

Understanding Responses

Copilot Chat responses often include code blocks with action buttons:

Button Action
Copy Copy the code block to your clipboard
Insert at Cursor Insert the code at your current cursor position in the editor
Insert into New File Create a new file with the code block contents
Run in Terminal Execute the code as a terminal command (for shell commands)

You can also continue the conversation by asking follow-up questions. Copilot Chat remembers the context of your current session, so you can iterate on solutions without repeating yourself.

💡 Try It: Chat Panel Exploration

Open a source file in your project and try each of these interactions:

Practice using all three chat modes (panel, inline, quick chat) until you feel comfortable switching between them. Each mode has its strengths.