Skip to content

Commit

Permalink
Add requestUuid for inline edits (#237549)
Browse files Browse the repository at this point in the history
  • Loading branch information
benibenj authored Jan 9, 2025
1 parent 2327683 commit 9cd58e4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/vs/editor/common/languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2407,6 +2407,12 @@ export interface IInlineEdit {

export interface IInlineEditContext {
triggerKind: InlineEditTriggerKind;

/**
* @experimental
* @internal
*/
requestUuid?: string;
}

export enum InlineEditTriggerKind {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class InlineEditsAdapter extends Disposable {
const inlineEdits = await Promise.all(allInlineEditProvider.map(async provider => {
const result = await provider.provideInlineEdit(model, {
triggerKind: InlineEditTriggerKind.Automatic,
requestUuid: context.requestUuid
}, token);
if (!result) { return undefined; }
return { result, provider };
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/api/common/extHostLanguageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,8 @@ class InlineEditAdapter {
async provideInlineEdits(uri: URI, context: languages.IInlineEditContext, token: CancellationToken): Promise<extHostProtocol.IdentifiableInlineEdit | undefined> {
const doc = this._documents.getDocument(uri);
const result = await this._provider.provideInlineEdit(doc, {
triggerKind: this.languageTriggerKindToVSCodeTriggerKind[context.triggerKind]
triggerKind: this.languageTriggerKindToVSCodeTriggerKind[context.triggerKind],
requestUuid: context.requestUuid,
}, token);

if (!result) {
Expand Down
2 changes: 2 additions & 0 deletions src/vscode-dts/vscode.proposed.inlineEdit.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ declare module 'vscode' {
* Describes how the inline edit was triggered.
*/
triggerKind: InlineEditTriggerKind;

requestUuid?: string;
}

export enum InlineEditTriggerKind {
Expand Down

0 comments on commit 9cd58e4

Please sign in to comment.