Review GitHub Copilot's code improvement features

Completed

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 chat modes:

  • Ask mode: Use the Ask mode to ask questions about your codebase or technology concepts. You can use Ask mode explain code, suggest revisions or fixes, or provide information related to the codebase.
  • Edit mode: Use the Edit mode to make edits across multiple files in your codebase. You can use Edit mode to refactor code, add comments, or make other changes to your code.
  • Agent mode: Use the Agent mode to start an agentic coding workflow. You can use Agent mode to run commands, execute code, or perform other tasks in your workspace.

Important

When you use the Chat view in Agent mode, 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 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.