Function
replaceContent
(
document: vscode.TextDocument,
content: string,
)
Source from the content-addressed store, hash-verified
| 219 | } |
| 220 | |
| 221 | export async function replaceContent( |
| 222 | document: vscode.TextDocument, |
| 223 | content: string, |
| 224 | ): Promise<void> { |
| 225 | const edit = new vscode.WorkspaceEdit(); |
| 226 | edit.replace(document.uri, TextEditor.getDocumentRange(document), content); |
| 227 | const isApplied = await vscode.workspace.applyEdit(edit); |
| 228 | |
| 229 | if (!isApplied) throw new Error(`Failed to replace content`); |
| 230 | } |