Skip to content

Copilot

Copilot is the AI assistant built into the Structured Text editor. It can explain a piece of code, write documentation comments for it, or propose a refactoring — without leaving the editor.

It is multi-provider: Anthropic, OpenAI and Google are supported. An API key is required, and it is set once per organization.

Every action works on the code you have selected. If nothing is selected, the action is applied to the whole file instead.

The file you are editing is always sent as context, so Copilot can see how the selected lines fit into the rest of the program even when you select only a few.

All three are available from the editor’s right-click menu and from a keyboard shortcut.

ActionShortcutWhere the answer appears
ExplainCtrl / Cmd + EIn the chat panel
Document thisCtrl / Cmd + IAs a diff in the editor
RefactorCtrl / Cmd + UAs a diff in the editor

Opens the chat panel and answers there. The code you selected stays highlighted in the editor while you read, so you can follow along. Nothing in your file is changed.

Use this to understand unfamiliar code, or to check what a block actually does before you edit it.

These two change code, so they do not answer in the chat. They work quietly and then show the result as a diff in the editor: your current code on one side, Copilot’s proposal on the other.

  • Document this adds documentation comments to the selected code.
  • Refactor proposes a rewrite of the selected code.

Nothing is written to your file until you accept it.

When a diff appears you have two choices:

  • Accept — the proposal replaces the code in the file. The change is applied to the project file, exactly as if you had typed it.
  • Reject — the diff is discarded and your code is left untouched.
  • No API key is configured. Copilot needs the organization API key described above. Without it, requests cannot be sent.
  • The file is large. The whole file is sent as context, so a very large program takes longer to answer.
  • Nothing was selected and the file is empty. With no selection Copilot falls back to the whole file, and an empty file gives it nothing to work on.