Format Document
format-documentStages Roslyn formatting for a single document in the active transaction, optionally limited to a range, so changes can be reviewed before commit. Does not write files directly.
Instructions
Stages Roslyn formatting for one document in the active transaction, using its workspace formatting options. Use this for formatting; use rename-symbol or code actions for semantic transformations. Requires document and the current expectedSnapshot. Omit range to format the whole document, or provide a zero-based start and length within the document to select the region passed to the formatter. Already formatted text produces no change. Successful staging returns mutation details and a new snapshot for subsequent requests. Inspect transaction-preview, or transaction-review in approval-required mode, before transaction-commit; transaction-rollback discards the staged work. This tool does not write source files directly or create a Git commit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| range | No | The optional range to format. | |
| document | Yes | Target document. | |
| workspace | No | Provide workspaceId, alias, path, or any combination. | |
| expectedSnapshot | Yes | Echo the snapshot returned with the data or transaction state used to construct this request. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||