Use Code Explain feature to understand existing code using Copilot in Power Pages for Visual Studio Code

Copilot in Power Pages for Visual Studio Code is a chat-based assistant that helps you write and optimize code. We are excited to announce Explain code feature support which will allow you to ask Copilot to explain the meaning and functionality of Power Pages code snippet.

Feature capabilities

You can use Copilot explain feature in two ways:

  1. Using in-context menu or
  2. Using chat panel.

1. Using the in-context menu

The in-context menu is a convenient way to access Copilot features from the code editor. To use Explain from the in-context menu, follow these steps:

  • Select the lines of code you want to understand from the code editor.
  • Right-click to access the in-context menu.
  • Select Copilot in Power Pages and choose Explain.
  • Copilot will record the selected lines of code in the chat panel and provide a response explaining the code to you.

explain code using in-context menu

2. Using the chat panel

The chat panel is where you can interact with Copilot directly by typing commands or questions. To use Explain from the chat panel, follow these steps:

  • Select the lines of code you want to understand from the code editor.
  • Type Explain selected code in the Copilot chat panel and press Enter.
  • Copilot will record the selected lines of code in the chat panel and provide a response explaining the code to you.

You can also directly ask Copilot to explain any code snippet by adding the code in the prompt. For example, you can ask Explain the following code {% include 'Page Copy'%}.

Copilot will parse the code and provide a response explaining what it does and how it works.

Explain code using copilot chat

We are looking forward to your feedback

Copilot in Power Pages is a feature that helps you code faster and more creatively. Your feedback is crucial in shaping the future of this feature. We want to hear from you!

See documentation here for a detailed overview.

Thank you,

Neeraj Nandwana