1
>
/*---------------------------------------------------------------------------------------------
aiRelatedInformation.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { CancellationToken } from '../../../../base/common/cancellation.js';
7
>
import { IDisposable } from '../../../../base/common/lifecycle.js';
8
>
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
9
>
10
>
export const IAiRelatedInformationService = createDecorator<IAiRelatedInformationService>('IAiRelatedInformationService');
11
>
12
>
export enum RelatedInformationType {
13
>
SymbolInformation = 1,
14
>
CommandInformation = 2,
15
>
SearchInformation = 3,
16
>
SettingInformation = 4
17
>
}
18
>
19
>
interface RelatedInformationBaseResult {
20
>
type: RelatedInformationType;
21
>
weight: number;
22
>
}
23
>
24
>
export interface CommandInformationResult extends RelatedInformationBaseResult {
25
>
type: RelatedInformationType.CommandInformation;
26
>
command: string;
27
>
}
28
>
29
>
export interface SettingInformationResult extends RelatedInformationBaseResult {
30
>
type: RelatedInformationType.SettingInformation;
31
>
setting: string;
32
>
}
33
>
34
>
export type RelatedInformationResult = CommandInformationResult | SettingInformationResult;
35
>
36
>
export interface IAiRelatedInformationService {
37
>
readonly _serviceBrand: undefined;
38
>
39
>
isEnabled(): boolean;
40
>
getRelatedInformation(query: string, types: RelatedInformationType[], token: CancellationToken): Promise<RelatedInformationResult[]>;
41
>
registerAiRelatedInformationProvider(type: RelatedInformationType, provider: IAiRelatedInformationProvider): IDisposable;
42
>
}
43
>
44
>
export interface IAiRelatedInformationProvider {
45
>
provideAiRelatedInformation(query: string, token: CancellationToken): Promise<RelatedInformationResult[]>;
46
>
}