Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix halo effect removal in inline completions #237881

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export class InlineCompletionsModel extends Disposable {
private readonly _editorObs = observableCodeEditor(this._editor);

private readonly _acceptCompletionDecorationTimer = this._register(new MutableDisposable());
private readonly _acceptCompletionDecoration: IModelDecorationOptions = {
private readonly _acceptCompletionDecorationCollection = this._editor.createDecorationsCollection();
private readonly _acceptCompletionDecorationOptions: IModelDecorationOptions = {
description: 'inline-completion-accepted',
className: 'inline-completion-accepted',
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges
Expand Down Expand Up @@ -581,8 +582,6 @@ export class InlineCompletionsModel extends Disposable {
completion.source.addRef();
}

this._acceptCompletionDecorationTimer.clear();

editor.pushUndoStop();
if (completion.snippetInfo) {
editor.executeEdits(
Expand All @@ -605,8 +604,8 @@ export class InlineCompletionsModel extends Disposable {
editor.setSelections(selections, 'inlineCompletionAccept');

if (state.kind === 'inlineEdit') {
const acceptEditsDecorations = editor.createDecorationsCollection(modifiedRanges.map(r => ({ range: r, options: this._acceptCompletionDecoration })));
this._acceptCompletionDecorationTimer.value = disposableTimeout(() => acceptEditsDecorations.clear(), 2500);
this._acceptCompletionDecorationCollection.set(modifiedRanges.map(r => ({ range: r, options: this._acceptCompletionDecorationOptions })));
this._acceptCompletionDecorationTimer.value = disposableTimeout(() => this._acceptCompletionDecorationCollection.clear(), 2500);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ export const modifiedBorder = registerColor(
export const acceptedDecorationBackgroundColor = registerColor(
'inlineEdit.acceptedBackground',
{
light: transparent(modifiedChangedTextOverlayColor, 0.5),
dark: transparent(modifiedChangedTextOverlayColor, 0.5),
light: transparent(modifiedChangedTextOverlayColor, 0.75),
dark: transparent(modifiedChangedTextOverlayColor, 0.75),
hcDark: modifiedChangedTextOverlayColor,
hcLight: modifiedChangedTextOverlayColor
},
localize('inlineEdit.acceptedBackground', 'Background color for the accepted text after appying an inline edit.'),
localize('inlineEdit.acceptedBackground', 'Background color for the accepted text after applying an inline edit.'),
true
);

Expand Down
Loading