Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/sessions/contrib/agentFeedback/browser/nullAgentFeedbackService.contribution.ts
13401 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
import { Emitter } from '../../../../base/common/event.js';
7
import { Disposable } from '../../../../base/common/lifecycle.js';
8
import { URI } from '../../../../base/common/uri.js';
9
import { IRange } from '../../../../editor/common/core/range.js';
10
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
11
import { IAgentFeedback, IAgentFeedbackChangeEvent, IAgentFeedbackNavigationBearing, IAgentFeedbackService, INavigableSessionComment } from './agentFeedbackService.js';
12
import { IAgentFeedbackContext } from './agentFeedbackEditorUtils.js';
13
import { ICodeReviewSuggestion } from '../../codeReview/browser/codeReviewService.js';
14
15
/**
16
* No-op implementation of {@link IAgentFeedbackService} used on web,
17
* where the full agent feedback UI (editor overlay, hover, attachments)
18
* is not wired up. The changes view model still depends on the service
19
* being registered, so we expose a service that reports no feedback.
20
*/
21
class NullAgentFeedbackService extends Disposable implements IAgentFeedbackService {
22
23
declare readonly _serviceBrand: undefined;
24
25
readonly onDidChangeFeedback = this._register(new Emitter<IAgentFeedbackChangeEvent>()).event;
26
readonly onDidChangeNavigation = this._register(new Emitter<URI>()).event;
27
28
addFeedback(sessionResource: URI, resourceUri: URI, range: IRange, text: string, _suggestion?: ICodeReviewSuggestion, _context?: IAgentFeedbackContext, _sourcePRReviewCommentId?: string): IAgentFeedback {
29
return {
30
id: '',
31
text,
32
resourceUri,
33
range,
34
sessionResource,
35
};
36
}
37
38
removeFeedback(_sessionResource: URI, _feedbackId: string): void { }
39
updateFeedback(_sessionResource: URI, _feedbackId: string, _text: string): void { }
40
getFeedback(_sessionResource: URI): readonly IAgentFeedback[] { return []; }
41
getMostRecentSessionForResource(_resourceUri: URI): URI | undefined { return undefined; }
42
async revealFeedback(_sessionResource: URI, _feedbackId: string): Promise<void> { }
43
async revealSessionComment(): Promise<void> { }
44
getNextFeedback(): IAgentFeedback | undefined { return undefined; }
45
getNextNavigableItem<T extends INavigableSessionComment>(): T | undefined { return undefined; }
46
setNavigationAnchor(): void { }
47
getNavigationBearing(_sessionResource: URI): IAgentFeedbackNavigationBearing { return { activeIdx: -1, totalCount: 0 }; }
48
clearFeedback(): void { }
49
async addFeedbackAndSubmit(): Promise<void> { }
50
}
51
52
registerSingleton(IAgentFeedbackService, NullAgentFeedbackService, InstantiationType.Delayed);
53
54