When my active function is running, I have a specific updateTrigger that ensures certain actions are taken when the activeTextEditor in vscode changes:
const updateTrigger = () => {
if (vscode.window.activeTextEditor) {
updateDecorations(context);
pickupOutJumpPoints(context);
}
};
vscode.window.onDidChangeActiveTextEditor(
updateTrigger,
null,
context.subscriptions
);
The updateDecorations function is crucial in this process:
const PINLINEDECORATION = vscode.window.createTextEditorDecorationType({
gutterIconPath: PUSHPINPATH,
gutterIconSize: "contain",
rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed,
});
function updateDecorations(ctx: vscode.ExtensionContext): void {
const jps = getJumpPoints(ctx);
const editor = getEditor();
if (jps === undefined) {
return;
} else {
editor.setDecorations(
PINLINEDECORATION,
jps.map(function (point: JumpPoint): vscode.DecorationOptions {
return {
range: new vscode.Range(point.to.position, point.to.position),
hoverMessage: "$(alert)",
};
})
);
}
}
I am facing an issue where my decorations need to remain pinned into a single line, requiring me to reset the decorations after every text editor change. This results in icon artifacts. Is there a more efficient way to achieve the same pinned effect without encountering these artifacts?
To see an example of the artifact issue, you can watch this video demonstration: