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
5267 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
declare readonly _serviceBrand: undefined;
12
13
public readonly onDidChangeChatModes = Event.None;
14
15
constructor(
16
private readonly _modes: { builtin: readonly IChatMode[]; custom: readonly IChatMode[] } = { builtin: [ChatMode.Ask], custom: [] }
17
) { }
18
19
getModes(): { builtin: readonly IChatMode[]; custom: readonly IChatMode[] } {
20
return this._modes;
21
}
22
23
findModeById(id: string): IChatMode | undefined {
24
return this._modes.builtin.find(mode => mode.id === id) ?? this._modes.custom.find(mode => mode.id === id);
25
}
26
27
findModeByName(name: string): IChatMode | undefined {
28
return this._modes.builtin.find(mode => mode.name.get() === name) ?? this._modes.custom.find(mode => mode.name.get() === name);
29
}
30
31
}
32
33