Review GitHub Copilot's code improvement features
GitHub Copilot includes several features that you can use to analyze, refactor, and improve an existing codebase.
GitHub Copilot tools for implementing code improvements
Visual Studio Code provides easy access to the following GitHub Copilot features:
- Chat view: Have an AI assistant on the side to help you at any time.
- Inline chat: Start an inline chat conversation directly from the editor for help while you're coding.
- Smart actions: Run smart actions to complete certain tasks without even having to write a prompt.
Chat view
The Chat view is a dedicated panel in Visual Studio Code that allows you to interact with GitHub Copilot Chat. You can use the Chat view to submit prompts, receive suggestions, and implement updates to your codebase. The Chat view provides a user-friendly interface for managing chat conversations and accessing GitHub Copilot's features. The Chat view includes the following built-in agents:
- Agent: Use the Agent to autonomously plan and implement changes across files, run terminal commands, and invoke tools.
- Plan: Use the Plan agent to create a structured, step-by-step implementation plan before writing any code. When the plan looks right, hand it off to an implementation agent to execute it.
- Ask: Use Ask to answer questions about coding concepts, your codebase, or VS Code itself without making file changes.
Important
When you use the Agent, GitHub Copilot may make multiple premium requests to complete a single task. Premium requests can be used by user-initiated prompts and follow-up actions GitHub Copilot takes on your behalf. The total premium requests used will depend on the complexity of the task, the number of steps involved, and the model selected.
Inline chat
Suggestions generated using the inline chat feature are displayed directly in the code editor. Suggestions appear as updates to your code, without natural language explanations or guidance. The suggested updates are presented like a commit in Git. The deleted code isn't displayed by default, but can be shown inline with the updates.
You can review the suggestions, evaluate their relevance, and accept or reject them directly in the code editor. Inline chat provides a quick way to see how your code can be improved and make changes without switching to a separate panel.
Fix smart action
The Fix smart action is a contextual action that can be used to fix coding errors without writing a prompt.
Review and Comment smart action
The Review and Comment smart action provides a way to review and analyze your code. It can help you identify areas for improvement, suggest refactoring updates, and provide guidance on best practices. This code review feature is integrated into the Chat view and allows you to submit prompts related to code review tasks. You can use the code review feature to analyze specific files, classes, or methods in your codebase. The suggestions generated by the code review feature can help you improve the quality, reliability, performance, and security of your code.
Summary
GitHub Copilot can be used to analyze, refactor, and improve an existing codebase. The Chat view, inline chat, and smart actions provide various ways to interact with GitHub Copilot and implement code improvements. By using these features, you can enhance the quality of your code and streamline your development process.