← 返回首页
Using C++ Development Tools with GitHub Copilot Chat

Documentation

Topics Overview Overview Linux macOS Windows VS Code for the Web Raspberry Pi Network Additional Components Uninstall VS Code Tutorial Copilot Quickstart User Interface Personalize VS Code Install Extensions Tips and Tricks Intro Videos Overview Setup Quickstart Overview Language Models Context Tools Agents Customization Trust & Safety Overview Agents Tutorial Agents Window Planning Memory Tools Subagents Local Agents Copilot CLI Cloud Agents Third-Party Agents Overview Chat Sessions Add Context Inline Chat Review Edits Checkpoints Artifacts Panel Debug Chat Interactions Prompt Examples Overview Instructions Prompt Files Custom Agents Agent Skills Language Models MCP Hooks Plugins Context Engineering Customize AI Test-Driven Development Edit Notebooks with AI Test with AI Test Web Apps with Browser Tools Debug with AI MCP Dev Guide OpenTelemetry Monitoring Inline Suggestions Smart Actions Best Practices Security Troubleshooting FAQ Cheat Sheet Settings Reference MCP Configuration Workspace Context Display Language Layout Keyboard Shortcuts Settings Settings Sync Extension Marketplace Extension Runtime Security Themes Profiles Overview Voice Interactions Command Line Interface Telemetry Basic Editing IntelliSense Code Navigation Refactoring Snippets Overview Multi-Root Workspaces Workspace Trust Tasks Debugging Debug Configuration Testing Port Forwarding Integrated Browser Overview Quickstart Staging & Committing Branches & Worktrees Repositories & Remotes Merge Conflicts Collaborate on GitHub Troubleshooting FAQ Getting Started Tutorial Terminal Basics Terminal Profiles Shell Integration Appearance Advanced Overview Enterprise Policies AI Settings Extensions Telemetry Updates Overview JavaScript JSON HTML Emmet CSS, SCSS and Less TypeScript Markdown PowerShell C++ Java PHP Python Julia R Ruby Rust Go T-SQL C# .NET Swift Working with JavaScript Node.js Tutorial Node.js Debugging Deploy Node.js Apps Browser Debugging Angular Tutorial React Tutorial Vue Tutorial Debugging Recipes Performance Profiling Extensions Tutorial Transpiling Editing Refactoring Debugging Quick Start Tutorial Run Python Code Editing Linting Formatting Debugging Environments Testing Python Interactive Django Tutorial FastAPI Tutorial Flask Tutorial Create Containers Deploy Python Apps Python in the Web Settings Reference Getting Started Navigate and Edit Refactoring Formatting and Linting Project Management Build Tools Run and Debug Testing Spring Boot Modernizing Java Apps Application Servers Deploy Java Apps GUI Applications Extensions FAQ Intro Videos GCC on Linux GCC on Windows GCC on Windows Subsystem for Linux Clang on macOS Microsoft C++ on Windows Build with CMake CMake Tools on Linux CMake Quick Start C++ Dev Tools for Copilot Editing and Navigating Debugging Configure Debugging Refactoring Settings Reference Configure IntelliSense Configure IntelliSense for Cross-Compiling FAQ Intro Videos Get Started Navigate and Edit IntelliCode Refactoring Formatting and Linting Project Management Build Tools Package Management Run and Debug Testing FAQ Overview Node.js Python ASP.NET Core Debug Docker Compose Registries Deploy to Azure Choose a Dev Environment Customize Develop with Kubernetes Tips and Tricks Overview Jupyter Notebooks Data Science Tutorial Python Interactive Data Wrangler Quick Start Data Wrangler PyTorch Support Azure Machine Learning Manage Jupyter Kernels Jupyter Notebooks on the Web Data Science in Microsoft Fabric Foundry Toolkit Overview Foundry Toolkit Copilot Tools Create Agents Models Playground Agent Builder Agent Inspector Evaluation Tool Catalog Fine-Tuning (Automated Setup) Fine-Tuning (Project Template) Model Conversion Tracing Profiling (Windows ML) FAQ File Structure Manual Model Conversion Manual Model Conversion on GPU Setup Environment Without Foundry Toolkit Template Project Migrating from Visualizer to Agent Inspector Overview Getting Started Resources View Deployment VS Code for the Web - Azure Containers Azure Kubernetes Service Kubernetes MongoDB Remote Debugging for Node.js Overview SSH Dev Containers Windows Subsystem for Linux GitHub Codespaces VS Code Server Tunnels SSH Tutorial WSL Tutorial Tips and Tricks FAQ Overview Tutorial Attach to Container Create Dev Container Advanced Containers devcontainer.json Dev Container CLI Tips and Tricks FAQ Default Keyboard Shortcuts Default Settings Substitution Variables Tasks Schema
Copy as Markdown

On this page there are 3 sections

Using C++ Development Tools with GitHub Copilot Chat

Refactoring and making updates in C++ code often requires tracking down edits across multiple files and having knowledge of your build configuration.

GitHub Copilot Chat can use the C++ tools built into VS Code to provide context-aware assistance for your C++ projects. By using code understanding and CMake tools, Copilot can understand your codebase structure, dependencies, and build configurations to give you more accurate, helpful, and fast responses.

This guide covers the available tools and how to use them effectively with AI agents to accomplish tasks such as:

  • Navigate and understand complex C++ codebases
  • Refactor code with full context awareness
  • Configure and build projects efficiently

Prerequisites

These extensions are available as part of the C/C++ Extension Pack.

You can enable/disable any of these tools at any point by navigating to the Tools option in chat and selecting the respective tool you'd like to enable/disable.

Note

Only enable relevant tools to your development workflow to avoid context bloat. You can disable other tools, such as tools installed through MCP, via the same dialog.

C++ code understanding tools

The C++ extension provides tools that use language services to give Copilot Chat deep understanding of your code structure, symbols, and relationships. Ensure you have configured with IntelliSense to take advantage of these tools.

To enable these tools, select the Enable Cpp Code Editing Tools setting in your VS Code user settings.

Get Symbol Information (GetSymbolInfo_CppTools)

What it does: Retrieves detailed information about symbols (functions, classes, variables, etc.) in your codebase, including their definitions, types, and documentation.

Example Use Case: Optimize memory performance and ensure non-breaking changes

Get Symbol References (GetSymbolReferences_CppTools)

What it does: Finds all references to a specific symbol throughout your codebase, showing where functions, classes, or variables are used.

Example Use Case: Add additional functionality to existing functions

Note

You can control the maximum number of symbol references returned by the tool by adjusting the symbol references limit setting in VS Code.

Get Symbol Call Hierarchy (GetSymbolCallHierarchy_CppTools)

What it does: Shows the call hierarchy for functions, revealing both incoming calls (who calls this function) and outgoing calls (what this function calls).

Example Use Case: Dependency analysis for module migration

CMake Tools Integration

CMake tools allow Copilot Chat to understand your build configuration, targets, and dependencies, enabling build-aware assistance.

CMake Build (Build_CMakeTools)

What it does: Builds your CMake project using the current configuration and selected target.

Example Use Case: Resolving build errors

Run CTest (RunCTest_CMakeTools)

What it does: Runs test suite defined by CTest in your project

Example Use Case: Fix code according to unit tests

Tips for Effective Prompts

  • Be specific: Identify the exact symbol, file, or component you're asking about (for example, "refactor the getConfig() function" rather than "make this faster")
  • Reference context: Ask Copilot Chat to consider specific files, functions, or modules when analyzing changes
  • Directly reference tools: Directly reference relevant tools using # in chat to ensure invocation.
  • Use custom instructions: Set up custom instructions to guide Copilot Chat. See example custom instructions for improving call rates of C++ tools documented in the awesome-copilot repo.
  • Leverage latest models: Use the latest AI models that support tool-calling for the most accurate code understanding and tool usage
  • Optimize tool performance: Only enable relevant tools to your development workflow to avoid context bloat

When to Use Each Tool

Symbol Information: Use when you need to understand the structure of existing code or verify properties before making changes.

Symbol References: Use when refactoring to identify all usages and ensure changes don't break existing code.

Call Hierarchy: Use when analyzing dependencies, understanding call chains, or planning module migrations.

CMake Build: Use when troubleshooting build issues or verifying that changes compile successfully.

CTest: Use when validating changes against your test suite or debugging test failures.