I know how to make a builder work with selections, but I can't work out what to put in place of my "something" comment
vscode.window.activeTextEditor.edit(builder => {
builder.replace(/* something */, "Hello world!");
});
The desired result is that the entire active document is replaced with "Hello world!"
Solved like this:
vscode.window.activeTextEditor.edit(builder => {
const doc = vscode.window.activeTextEditor.document;
builder.replace(new vscode.Range(doc.lineAt(0).range.start, doc.lineAt(doc.lineCount - 1).range.end), "Hello world!");
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With