Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/chat/test/common/mockChatModeService.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
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
7
import { Event } from '../../../../../base/common/event.js';
8
import { ChatMode, IChatMode, IChatModeService } from '../../common/chatModes.js';
9
10
export class MockChatModeService implements IChatModeService {
11
readonly _serviceBrand: undefined;
12
13
private _modes: { builtin: readonly IChatMode[]; custom: readonly IChatMode[] } = { builtin: [ChatMode.Ask], custom: [] };
14
15
public readonly onDidChangeChatModes = Event.None;
16
17
getModes(): { builtin: readonly IChatMode[]; custom: readonly IChatMode[] } {
18
return this._modes;
19
}
20
21
findModeById(id: string): IChatMode | undefined {
22
return this._modes.builtin.find(mode => mode.id === id) ?? this._modes.custom.find(mode => mode.id === id);
23
}
24
25
findModeByName(name: string): IChatMode | undefined {
26
return this._modes.builtin.find(mode => mode.name === name) ?? this._modes.custom.find(mode => mode.name === name);
27
}
28
}
29
30