Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate debug.autoExpandLazyVariables to enum format, enable it by default for screen reader users #221513

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/vs/workbench/contrib/debug/browser/debug.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { DisassemblyViewInput } from 'vs/workbench/contrib/debug/common/disassem
import { COPY_NOTEBOOK_VARIABLE_VALUE_ID, COPY_NOTEBOOK_VARIABLE_VALUE_LABEL } from 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands';
import { launchSchemaId } from 'vs/workbench/services/configuration/common/configuration';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import './debugSettingMigration';

const debugCategory = nls.localize('debugCategory', "Debug");
registerColors();
Expand Down Expand Up @@ -618,9 +619,15 @@ configurationRegistry.registerConfiguration({
description: nls.localize('debug.disassemblyView.showSourceCode', "Show Source Code in Disassembly View.")
},
'debug.autoExpandLazyVariables': {
type: 'boolean',
default: false,
description: nls.localize('debug.autoExpandLazyVariables', "Automatically show values for variables that are lazily resolved by the debugger, such as getters.")
type: 'string',
enum: ['auto', 'on', 'off'],
default: 'auto',
enumDescriptions: [
nls.localize('debug.autoExpandLazyVariables.auto', "When in screen reader optimized mode, automatically expand lazy variables."),
nls.localize('debug.autoExpandLazyVariables.on', "Always automatically expand lazy variables."),
nls.localize('debug.autoExpandLazyVariables.off', "Never automatically expand lazy variables.")
],
description: nls.localize('debug.autoExpandLazyVariables', "Controls if variables, such as getters, are automatically resolved and expanded by the debugger.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the "variables that are lazily resolved" was an important part of this description

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion: #221752

},
'debug.enableStatusBarColor': {
type: 'boolean',
Expand All @@ -636,3 +643,4 @@ configurationRegistry.registerConfiguration({
});

AccessibleViewRegistry.register(new DebugAccessibleView());

meganrogge marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 5 additions & 1 deletion src/vs/workbench/contrib/debug/browser/debugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { isDefined } from 'vs/base/common/types';
import { ITestService } from 'vs/workbench/contrib/testing/common/testService';
import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService';
import { LiveTestResult } from 'vs/workbench/contrib/testing/common/testResult';
import { IAccessibilityService } from 'vs/platform/accessibility/common/accessibility';

const TRIGGERED_BREAKPOINT_MAX_DELAY = 1500;

Expand Down Expand Up @@ -117,6 +118,7 @@ export class DebugSession implements IDebugSession, IDisposable {
@ILogService private readonly logService: ILogService,
@ITestService private readonly testService: ITestService,
@ITestResultService testResultService: ITestResultService,
@IAccessibilityService private readonly accessibilityService: IAccessibilityService,
) {
this._options = options || {};
this.parentSession = this._options.parentSession;
Expand Down Expand Up @@ -238,7 +240,9 @@ export class DebugSession implements IDebugSession, IDisposable {

get autoExpandLazyVariables(): boolean {
// This tiny helper avoids converting the entire debug model to use service injection
return this.configurationService.getValue<IDebugConfiguration>('debug').autoExpandLazyVariables;
const screenReaderOptimized = this.accessibilityService.isScreenReaderOptimized();
const value = this.configurationService.getValue<IDebugConfiguration>('debug').autoExpandLazyVariables;
return value === 'auto' && screenReaderOptimized || value === 'on';
}

setConfiguration(configuration: { resolved: IConfig; unresolved: IConfig | undefined }) {
Expand Down
22 changes: 22 additions & 0 deletions src/vs/workbench/contrib/debug/browser/debugSettingMigration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions, IConfigurationMigrationRegistry } from 'vs/workbench/common/configuration';

Registry.as<IConfigurationMigrationRegistry>(Extensions.ConfigurationMigration)
.registerConfigurationMigrations([{
key: 'debug.autoExpandLazyVariables',
migrateFn: (value: boolean) => {
let newValue: string | undefined;
if (value === true) {
newValue = 'on';
} else if (value === false) {
newValue = 'auto';
}
return [
['debug.autoExpandLazyVariables', { value: newValue }],
];
}
}]);
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ export interface IDebugConfiguration {
disassemblyView: {
showSourceCode: boolean;
};
autoExpandLazyVariables: boolean;
autoExpandLazyVariables: 'auto' | 'off' | 'on';
enableStatusBarColor: boolean;
showVariableTypes: boolean;
}
Expand Down
5 changes: 3 additions & 2 deletions src/vs/workbench/contrib/debug/test/browser/callStack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Constants } from 'vs/base/common/uint';
import { generateUuid } from 'vs/base/common/uuid';
import { ensureNoDisposablesAreLeakedInTestSuite } from 'vs/base/test/common/utils';
import { Range } from 'vs/editor/common/core/range';
import { TestAccessibilityService } from 'vs/platform/accessibility/test/common/testAccessibilityService';
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { NullLogService } from 'vs/platform/log/common/log';
Expand Down Expand Up @@ -41,7 +42,7 @@ export function createTestSession(model: DebugModel, name = 'mockSession', optio
}
};
}
} as IDebugService, undefined!, undefined!, new TestConfigurationService({ debug: { console: { collapseIdenticalLines: true } } }), undefined!, mockWorkspaceContextService, undefined!, undefined!, undefined!, mockUriIdentityService, new TestInstantiationService(), undefined!, undefined!, new NullLogService(), undefined!, undefined!);
} as IDebugService, undefined!, undefined!, new TestConfigurationService({ debug: { console: { collapseIdenticalLines: true } } }), undefined!, mockWorkspaceContextService, undefined!, undefined!, undefined!, mockUriIdentityService, new TestInstantiationService(), undefined!, undefined!, new NullLogService(), undefined!, undefined!, new TestAccessibilityService());
}

function createTwoStackFrames(session: DebugSession): { firstStackFrame: StackFrame; secondStackFrame: StackFrame } {
Expand Down Expand Up @@ -445,7 +446,7 @@ suite('Debug - CallStack', () => {
override get state(): State {
return State.Stopped;
}
}(generateUuid(), { resolved: { name: 'stoppedSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, mockWorkspaceContextService, undefined!, undefined!, undefined!, mockUriIdentityService, new TestInstantiationService(), undefined!, undefined!, new NullLogService(), undefined!, undefined!);
}(generateUuid(), { resolved: { name: 'stoppedSession', type: 'node', request: 'launch' }, unresolved: undefined }, undefined, model, undefined, undefined!, undefined!, undefined!, undefined!, undefined!, mockWorkspaceContextService, undefined!, undefined!, undefined!, mockUriIdentityService, new TestInstantiationService(), undefined!, undefined!, new NullLogService(), undefined!, undefined!, new TestAccessibilityService());
disposables.add(session);

const runningSession = createTestSession(model);
Expand Down
Loading