diff --git a/extensions/merge-conflict/src/codelensProvider.ts b/extensions/merge-conflict/src/codelensProvider.ts index 391c737a606..73eeddfb109 100644 --- a/extensions/merge-conflict/src/codelensProvider.ts +++ b/extensions/merge-conflict/src/codelensProvider.ts @@ -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) ); }); diff --git a/src/vs/editor/contrib/codelens/browser/codelensWidget.ts b/src/vs/editor/contrib/codelens/browser/codelensWidget.ts index 120eae969a3..ebdd3a70b69 100644 --- a/src/vs/editor/contrib/codelens/browser/codelensWidget.ts +++ b/src/vs/editor/contrib/codelens/browser/codelensWidget.ts @@ -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); }); }