Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/contrib/debug/common/replAccessibilityAnnouncer.ts
5292 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 { Disposable, MutableDisposable } from '../../../../base/common/lifecycle.js';
7
import { IAccessibilityService } from '../../../../platform/accessibility/common/accessibility.js';
8
import { ILogService } from '../../../../platform/log/common/log.js';
9
import { IWorkbenchContribution } from '../../../common/contributions.js';
10
import { IDebugService } from './debug.js';
11
12
export class ReplAccessibilityAnnouncer extends Disposable implements IWorkbenchContribution {
13
static ID = 'debug.replAccessibilityAnnouncer';
14
constructor(
15
@IDebugService debugService: IDebugService,
16
@IAccessibilityService accessibilityService: IAccessibilityService,
17
@ILogService logService: ILogService
18
) {
19
super();
20
const viewModel = debugService.getViewModel();
21
const mutableDispoable = this._register(new MutableDisposable());
22
this._register(viewModel.onDidFocusSession((session) => {
23
mutableDispoable.clear();
24
if (!session) {
25
return;
26
}
27
mutableDispoable.value = session.onDidChangeReplElements((element) => {
28
if (!element || !('originalExpression' in element)) {
29
// element was removed or hasn't been resolved yet
30
return;
31
}
32
const value = element.toString();
33
accessibilityService.status(value);
34
logService.trace('ReplAccessibilityAnnouncer#onDidChangeReplElements', element.originalExpression + ': ' + value);
35
});
36
}));
37
}
38
}
39
40