# Advanced GitHub Copilot Features: A Practical Guide
GitHub Copilot’s basic autocomplete is just the surface. If you’re only hitting Tab to accept single-line suggestions, you’re leaving significant productivity on the table. Copilot has evolved into a legitimate pair programmer with multi-line editing, chat integration, CLI tools, and configurable behavior that adapts to your codebase.
This guide covers the advanced features that working developers actually use—not the marketing fluff, but the commands and workflows that will change how you code.
## Tab to Accept, But Know When to Ctrl+Enter
The default behavior shows inline suggestions as you type. That’s fine for small completions, but Copilot can propose entire functions, classes, or boilerplate blocks.
**The difference:**
– **Tab** accepts the next word or line fragment
– **Ctrl+Enter** (or **Cmd+Enter** on Mac) opens the full suggestion in a dedicated panel where you can review the entire block before accepting
“`python
# Start typing this, then press Ctrl+Enter:
def calculate_metrics(data: list[dict], group_by: str) -> dict:
“`
Copilot will likely suggest the entire function—grouping logic, aggregation, return statement. Review it in the panel. If it’s wrong, press arrow keys to navigate alternatives. If it’s close but not quite right, edit within the panel before accepting.
This matters because inline suggestions truncate complex code. The full suggestion panel shows you the complete picture.
## Copilot Chat: AI-Assisted Refactoring in Your IDE
Copilot Chat isn’t a separate product—it’s integrated directly into VS Code, JetBrains IDEs, and Visual Studio. Access it via the chat panel or with **Ctrl+Shift+I** (VS Code).
Chat shines at three things:
**1. Explaining code:**
“`
@workspace explain this function’s time complexity
“`
**2. Generating tests:**
“`
@workspace write pytest tests for the User class
“`
**3. Refactoring in place:**
Select problematic code, then ask:
“`
refactor this to use a generator instead of building a list
“`
The key is the `@workspace` mention. It gives Chat context about your open files and project structure. Without it, you’re just chatting with a general-purpose LLM that doesn’t know your codebase.
“`javascript
// Select this block, then ask Chat to refactor:
const users = [];
for (const id of ids) {
const user = db.find(id);
users.push(user);
}
// Chat might suggest:
const users = ids.map(id => db.find(id));
// Or if memory matters:
function* userGenerator() {
for (const id of ids) {
yield db.find(id);
}
}
“`
**Limitation:** Chat can confidently suggest refactors that break tests. Always review, always run your test suite. Copilot is a starting point, not a guarantee.
## Context Is Everything: Feeding Copilot the Right Info
Copilot’s suggestions are only as good as its context window. Here’s how to maximize what it sees:
**1. Open related files before coding**
Need a new API endpoint? Open your existing controller, service, and model files first. Copilot reads all open tabs.
**2. Use docstrings and comments as spec**
“`typescript
// TODO: Implement rate limiter with sliding window algorithm
// – max 100 requests per minute per user_id
// – returns { allowed: boolean, retry_after: number }
// Uses Redis INCR with TTL for cleanup
“`
Copilot will generate code matching your spec. The more specific your comments, the closer the match.
**3. Leverage the fill-in-the-middle technique**
In VS Code, you can now provide prefix and suffix context. This is useful when inserting code in the middle of a file—Copilot sees what comes before and after, maintaining consistency.
**4. Reference documentation inline**
“`python
# Using pandas DataFrame. See: https://pandas.pydata.org/docs/
# Current columns: [‘user_id’, ‘event’, ‘timestamp’]
def get_user_events(df, user_id):
“`
This explicitly tells Copilot what libraries and columns exist.
## Keyboard Shortcuts That Actually Matter
Memorize these. They’re the difference between context-switching and flow state:
| Action | VS Code | JetBrains |
|——–|———|———–|
| Accept suggestion | Tab | Tab |
| Full suggestion panel | Ctrl+Enter | Alt+Shift+Enter |
| Open Copilot Chat | Ctrl+Shift+I | Ctrl+Shift+Space |
| Trigger inline chat | Ctrl+I | N/A |
| Dismiss suggestion | Esc | Esc |
| Next suggestion | Alt+] | Alt+] |
| Previous suggestion | Alt+[ | Alt+[ |
The **Alt+]** and **Alt+[** shortcuts cycle through multiple suggestions. Use them when the first option isn’t quite right.
## Custom Instructions: Making Copilot Speak Your Codebase’s Language
Create a `.github/copilot-instructions.md` file in your repository root. This file applies to all files in that repo.
“`markdown
[*.py]
# Use type hints for all function parameters and returns
# Prefer dataclasses over dictionaries for structured data
# Always include docstrings with Args and Returns sections
[*.js]
# Use JSDoc for documentation
# Prefer async/await over .then() chains
# Use const for everything except when reassignment is needed
[general]
# Never use var
# Always handle errors explicitly, don’t swallow exceptions
# Include logging statements for debugging
“`
The syntax is TOML-based. You can set language-specific rules and general rules.
**What works:**
– Enforcing specific patterns (type hints, const usage)
– Banning anti-patterns (var, bare except)
– Setting documentation standards
**What doesn’t work:**
– Complex architectural rules (“use domain-driven design”)
– Rules that require understanding business logic
– Instructions longer than a few hundred words (Copilot truncates)
Test your instructions by asking Copilot to generate code that should violate them. If it still violates them, the instruction is too vague or Copilot’s context window crowded it out.
## Copilot CLI: AI at the Terminal
Copilot CLI (`gh copilot`) brings the same AI assistance to your terminal. Install it with:
“`bash
gh extension install github/gh-copilot
“`
**Practical uses:**
“`bash
# Explain a command you’re about to run
gh copilot explain “git reset –hard HEAD~3”
# Suggest a command for a task
gh copilot suggest “undo the last git commit but keep the changes staged”
# Generate and execute
gh copilot execute “create a new branch called feature/auth and switch to it”
“`
The `explain` command is invaluable for destructive commands. Before running anything involving `rm -rf`, `git reset –hard`, or database operations, paste the command into Copilot CLI and ask what it does.
The `suggest` command generates a command, then asks for confirmation before executing. This is safer than letting AI run wild on your system.
**Limitation:** CLI suggestions can be wrong. Always review the command before it executes. Some shell environments may have compatibility issues—check the extension docs if you hit errors.
## Key Takeaways
– Use **Ctrl+Enter** for full multi-line suggestions instead of just Tab for single-line completions
– Leverage **Copilot Chat** with `@workspace` for context-aware refactoring and code generation
– Open related files before coding sessions—Copilot reads all open tabs for context
– Create a `.github/copilot-instructions.md` to enforce language-specific patterns across your repo
– Use **Copilot CLI** to explain and generate terminal commands, especially before destructive operations
## Next Steps
1. Open your IDE right now, press **Ctrl+Shift+I**, and ask Copilot to explain a function in your current project
2. Create the `.github/copilot-instructions.md` file with two or three rules specific to your codebase
3. Install the Copilot CLI extension and run `gh copilot explain` on the last command you ran that you weren’t fully confident about
Copilot isn’t magic—it’s a tool that rewards configuration and shortcuts. Spend 30 minutes learning these features, and you’ll recover that time within the first week.

