Skip to content

Fixes https://github.com/microsoft/vscode-copilot/issues/14335 #243801

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

Merged
merged 1 commit into from
Mar 17, 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 @@ -120,6 +120,15 @@ export class InlineCompletionsModel extends Disposable {
this._jumpedToId.set(undefined, undefined);
}
}));

const inlineEditSemanticId = this.inlineEditState.map(s => s?.inlineCompletion.semanticId);

this._register(autorun(reader => {
const id = inlineEditSemanticId.read(reader);
if (id) {
this._editor.pushUndoStop();
}
}));
}

public debugGetSelectedSuggestItem(): IObservable<SuggestItemInfo | undefined> {
Expand Down Expand Up @@ -196,6 +205,7 @@ export class InlineCompletionsModel extends Disposable {
return true;
},
}, (reader, changeSummary) => {
this._source.clearOperationOnTextModelChange.read(reader); // Make sure the clear operation runs before the fetch operation
this._noDelaySignal.read(reader);
this.dontRefetchSignal.read(reader);
this._onlyRequestInlineEditsSignal.read(reader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ export class InlineCompletionsSource extends Disposable {
) {
super();

this._register(this._textModel.onDidChangeContent((e) => {
this._updateOperation.clear();
}));
this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);
}

public readonly clearOperationOnTextModelChange = derived(this, reader => {
this._versionId.read(reader);
this._updateOperation.clear();
return undefined; // always constant
});

private _log(entry:
{ sourceId: string; kind: 'start'; requestId: number; context: unknown } & IRecordableEditorLogEntry
| { sourceId: string; kind: 'end'; error: any; durationMs: number; result: unknown; requestId: number } & IRecordableLogEntry
Expand Down
Loading