Skip to content

Commit e1e851c

Browse files
authored
Update inline completions data structure (microsoft#253027)
update completions data
1 parent aae9b00 commit e1e851c

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,23 @@ export class InlineCompletionsModel extends Disposable {
205205
return undefined;
206206
}
207207

208+
let reason: string = '';
209+
if (changeSummary.provider) {
210+
reason += 'providerOnDidChange';
211+
} else if (changeSummary.inlineCompletionTriggerKind === InlineCompletionTriggerKind.Explicit) {
212+
reason += 'explicit';
213+
}
214+
if (changeSummary.changeReason) {
215+
reason += reason.length > 0 ? `:${changeSummary.changeReason}` : changeSummary.changeReason;
216+
}
217+
208218
const requestInfo: InlineSuggestRequestInfo = {
209219
editorType: this.editorType,
210220
startTime: Date.now(),
211221
languageId: this.textModel.getLanguageId(),
212-
reason: changeSummary.inlineCompletionTriggerKind === InlineCompletionTriggerKind.Explicit ? 'Explicit' : changeSummary.changeReason,
222+
reason,
213223
};
224+
214225
let context: InlineCompletionContextWithoutUuid = {
215226
triggerKind: changeSummary.inlineCompletionTriggerKind,
216227
selectedSuggestionInfo: suggestItem?.toSelectedSuggestionInfo(),

src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ export class MainThreadLanguageFeatures extends Disposable implements MainThread
617617
this._registrations.set(handle, this._languageFeaturesService.completionProvider.register(selector, provider));
618618
}
619619

620-
$registerInlineCompletionsSupport(handle: number, selector: IDocumentFilterDto[], supportsHandleEvents: boolean, extensionId: string, groupId: string | undefined, yieldsToExtensionIds: string[], displayName: string | undefined, debounceDelayMs: number | undefined, eventHandle: number | undefined): void {
620+
$registerInlineCompletionsSupport(handle: number, selector: IDocumentFilterDto[], supportsHandleEvents: boolean, extensionId: string, extensionVersion: string, groupId: string | undefined, yieldsToExtensionIds: string[], displayName: string | undefined, debounceDelayMs: number | undefined, eventHandle: number | undefined): void {
621621
const provider: languages.InlineCompletionsProvider<IdentifiableInlineCompletions> = {
622622
provideInlineCompletions: async (model: ITextModel, position: EditorPosition, context: languages.InlineCompletionContext, token: CancellationToken): Promise<IdentifiableInlineCompletions | undefined> => {
623623
return this._proxy.$provideInlineCompletions(handle, model.uri, position, context, token);
@@ -667,6 +667,7 @@ export class MainThreadLanguageFeatures extends Disposable implements MainThread
667667
disjointReplacements: lifetimeSummary.disjointReplacements,
668668
sameShapeReplacements: lifetimeSummary.sameShapeReplacements,
669669
extensionId,
670+
extensionVersion,
670671
partiallyAccepted: lifetimeSummary.partiallyAccepted,
671672
superseded: reason.kind === InlineCompletionEndOfLifeReasonKind.Ignored && !!reason.supersededBy,
672673
reason: reason.kind === InlineCompletionEndOfLifeReasonKind.Accepted ? 'accepted'
@@ -1297,6 +1298,7 @@ export class MainThreadDocumentRangeSemanticTokensProvider implements languages.
12971298
type InlineCompletionEndOfLifeEvent = {
12981299
id: string;
12991300
extensionId: string;
1301+
extensionVersion: string;
13001302
shown: boolean;
13011303
shownDuration: number;
13021304
shownDurationUncollapsed: number;
@@ -1325,6 +1327,7 @@ type InlineCompletionsEndOfLifeClassification = {
13251327
comment: 'Inline completions ended';
13261328
id: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier for the inline completion request' };
13271329
extensionId: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The identifier for the extension that contributed the inline completion' };
1330+
extensionVersion: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The version of the extension that contributed the inline completion' };
13281331
shown: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the inline completion was shown to the user' };
13291332
shownDuration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown' };
13301333
shownDurationUncollapsed: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration for which the inline completion was shown without collapsing' };

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ export interface MainThreadLanguageFeaturesShape extends IDisposable {
480480
$emitDocumentSemanticTokensEvent(eventHandle: number): void;
481481
$registerDocumentRangeSemanticTokensProvider(handle: number, selector: IDocumentFilterDto[], legend: languages.SemanticTokensLegend): void;
482482
$registerCompletionsProvider(handle: number, selector: IDocumentFilterDto[], triggerCharacters: string[], supportsResolveDetails: boolean, extensionId: ExtensionIdentifier): void;
483-
$registerInlineCompletionsSupport(handle: number, selector: IDocumentFilterDto[], supportsHandleDidShowCompletionItem: boolean, extensionId: string, yieldToId: string | undefined, yieldsToExtensionIds: string[], displayName: string | undefined, debounceDelayMs: number | undefined, eventHandle: number | undefined): void;
483+
$registerInlineCompletionsSupport(handle: number, selector: IDocumentFilterDto[], supportsHandleDidShowCompletionItem: boolean, extensionId: string, extensionVersion: string, yieldToId: string | undefined, yieldsToExtensionIds: string[], displayName: string | undefined, debounceDelayMs: number | undefined, eventHandle: number | undefined): void;
484484
$emitInlineCompletionsChange(handle: number): void;
485485
$registerSignatureHelpProvider(handle: number, selector: IDocumentFilterDto[], metadata: ISignatureHelpProviderMetadataDto): void;
486486
$registerInlayHintsProvider(handle: number, selector: IDocumentFilterDto[], supportsResolve: boolean, eventHandle: number | undefined, displayName: string | undefined): void;

src/vs/workbench/api/common/extHostLanguageFeatures.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,6 +2568,7 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF
25682568
this._transformDocumentSelector(selector, extension),
25692569
adapter.supportsHandleEvents,
25702570
ExtensionIdentifier.toKey(extension.identifier.value),
2571+
extension.version,
25712572
metadata?.groupId ? ExtensionIdentifier.toKey(metadata.groupId) : undefined,
25722573
metadata?.yieldTo?.map(extId => ExtensionIdentifier.toKey(extId)) || [],
25732574
metadata?.displayName,

0 commit comments

Comments
 (0)