Copilot
Copilot
Section titled “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.
What Copilot works on
Section titled “What Copilot works on”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.
The three actions
Section titled “The three actions”All three are available from the editor’s right-click menu and from a keyboard shortcut.
| Action | Shortcut | Where the answer appears |
|---|---|---|
| Explain | Ctrl / Cmd + E | In the chat panel |
| Document this | Ctrl / Cmd + I | As a diff in the editor |
| Refactor | Ctrl / Cmd + U | As a diff in the editor |
Explain
Section titled “Explain”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.
Document this and Refactor
Section titled “Document this and Refactor”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.
Accepting or rejecting a proposal
Section titled “Accepting or rejecting a proposal”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.
If an action does nothing
Section titled “If an action does nothing”- 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.