[英]How to fix VScode gutter indicator artifacts when the text editor is changed?
In my active function:在我的活动功能中:
const updateTrigger = () => {
if (vscode.window.activeTextEditor) {
updateDecorations(context);
pickupOutJumpPoints(context);
}
};
vscode.window.onDidChangeActiveTextEditor(
updateTrigger,
null,
context.subscriptions
);
updateDecorations:更新装饰品:
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)",
};
})
);
}
}
Because i need my decorations to remain pinned into a single line, I'm having to reset decorations after every text editor change, this creates icon artifacts, is there a better way to achieve the same pinned effect?因为我需要我的装饰保持固定在一行中,所以每次文本编辑器更改后我都必须重置装饰,这会产生图标工件,有没有更好的方法来实现相同的固定效果?
Artifact demonstration: https://i.gyazo.com/383d8e5979e72131e3b61a33ca8769ae.mp4神器演示: https : //i.gyazo.com/383d8e5979e72131e3b61a33ca8769ae.mp4
默认情况下,装饰遵循这条线,所以如果你想要“固定到第 8 行”,即使“第 8 行的内容移动到第 9 行”(老实说,我还没有看到用例),那么你所拥有的就可以了👍🏻
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.