I am developing a VS Code extension that fetches inserts code into the selected area.
I insert code as follows, and then set the decoration
await editor.edit((editBuilder) => {
editBuilder.replace(range, currentText);
const decorationType = vscode.window.createTextEditorDecorationType({
backgroundColor: "#007500",
});
editor.setDecorations(decorationType, [range]);
});
However, If I go to next line, the decoration extends to anything I add there and anything I add afterwards as well.
How do I make sure the decoration only extends to the range I originally selected?