Skip to main content

Начало работы с запросами на чат Copilot

Получите обзор способов использования Copilot Chat.

You can ask Copilot Chat specific questions about your project or general software questions. You can also ask Copilot Chat to write code, fix errors, write tests, and document code.

Use the tabs above to select the environment where you are using Copilot Chat.

Ask general software questions

You can ask Copilot Chat general software questions. For example:

  • tell me about nodejs web server frameworks
  • how can I create an Express app
  • what's the process for updating an npm package

Ask questions about files your project

You can ask Copilot Chat questions about the file that's currently displayed in the editor, or about files you have attached to your conversation in the Copilot Chat panel. To give Copilot the correct context:

  • Open the relevant file in the editor.
  • Click the paperclip icon in the Copilot Chat panel, then search for and select files you want to attach to the conversation.

For example:

  • how can I make this file run faster
  • how are these files related (with two or more attached files)
  • explain the getSearchReplaceRules function

Write code

You can ask Copilot to write code for you. For example:

  • write a TypeScript function to sum all numbers in a list
  • using the comments in this file, create appropriate Node JavaScript

When Copilot returns a code block, the response includes options to copy the code.

Fix, improve, and refactor code

If your active file contains an error, use the /fix slash command to ask Copilot to fix the error.

You can also make general requests to improve or refactor your code.

  • how would you improve the code in this file
  • translate this code to C#
  • add error handling to the main function

Write tests

Use the /tests slash command to ask Copilot to write tests for the active file or selected code. For example:

  • /tests
  • /tests using the Jest framework
  • /tests ensure the function rejects an empty list

The /tests slash command writes tests for existing code. If you prefer to write tests before writing code (test driven development), omit the /tests command. For example:

  • Add tests for a JavaScript function that should sum a list of integers