Fixes flashing of inline conflict marker code lenses (#168598)

This commit is contained in:
Henning Dieterichs 2022-12-09 15:16:55 +01:00 committed by GitHub
parent f2ef1cce6e
commit 741f5b480a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View file

@ -85,11 +85,12 @@ export default class MergeConflictCodeLensProvider implements vscode.CodeLensPro
arguments: [conflict]
};
const range = document.lineAt(conflict.range.start.line).range;
items.push(
new vscode.CodeLens(conflict.range, acceptCurrentCommand),
new vscode.CodeLens(conflict.range.with(conflict.range.start.with({ character: conflict.range.start.character + 1 })), acceptIncomingCommand),
new vscode.CodeLens(conflict.range.with(conflict.range.start.with({ character: conflict.range.start.character + 2 })), acceptBothCommand),
new vscode.CodeLens(conflict.range.with(conflict.range.start.with({ character: conflict.range.start.character + 3 })), diffCommand)
new vscode.CodeLens(range, acceptCurrentCommand),
new vscode.CodeLens(range, acceptIncomingCommand),
new vscode.CodeLens(range, acceptBothCommand),
new vscode.CodeLens(range, diffCommand)
);
});

View file

@ -182,6 +182,11 @@ export class CodeLensHelper {
}
}
const codeLensDecorationOptions = ModelDecorationOptions.register({
collapseOnReplaceEdit: true,
description: 'codelens'
});
export class CodeLensWidget {
private readonly _editor: IActiveCodeEditor;
@ -218,7 +223,7 @@ export class CodeLensWidget {
helper.addDecoration({
range: codeLensData.symbol.range,
options: ModelDecorationOptions.EMPTY
options: codeLensDecorationOptions
}, id => this._decorationIds[i] = id);
// the range contains all lenses on this line
@ -277,7 +282,7 @@ export class CodeLensWidget {
this._data.forEach((codeLensData, i) => {
helper.addDecoration({
range: codeLensData.symbol.range,
options: ModelDecorationOptions.EMPTY
options: codeLensDecorationOptions
}, id => this._decorationIds[i] = id);
});
}