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

Add support to de-emphasize debuggers in run list #193157

Merged
merged 4 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ export class AdapterManager extends Disposable implements IAdapterManager {
this.initExtensionActivationsIfNeeded();

candidates.sort((first, second) => first.label.localeCompare(second.label));
candidates = candidates.filter(a => !a.isHiddenFromDropdown);

const suggestedCandidates: Debugger[] = [];
const otherCandidates: Debugger[] = [];
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ export interface IDebuggerContribution extends IPlatformSpecificAdapterContribut
configurationSnippets?: IJSONSchemaSnippet[];
variables?: { [key: string]: string };
when?: string;
hiddenWhen?: string;
deprecated?: string;
strings?: { [key in DebuggerString]: string };
}
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/debug/common/debugSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerE
type: 'string',
default: ''
},
hiddenWhen: {
description: nls.localize('vscode.extension.contributes.debuggers.hiddenWhen', "When this condition is true, this debugger type is hidden from the debugger list, but is still enabled."),
type: 'string',
default: ''
},
deprecated: {
description: nls.localize('vscode.extension.contributes.debuggers.deprecated', "Optional message to mark this debug type as being deprecated."),
type: 'string',
Expand Down
13 changes: 13 additions & 0 deletions src/vs/workbench/contrib/debug/common/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class Debugger implements IDebugger, IDebuggerMetadata {
private mainExtensionDescription: IExtensionDescription | undefined;

private debuggerWhen: ContextKeyExpression | undefined;
private debuggerHiddenWhen: ContextKeyExpression | undefined;

constructor(
private adapterManager: IAdapterManager,
Expand All @@ -45,6 +46,7 @@ export class Debugger implements IDebugger, IDebuggerMetadata {
this.merge(dbgContribution, extensionDescription);

this.debuggerWhen = typeof this.debuggerContribution.when === 'string' ? ContextKeyExpr.deserialize(this.debuggerContribution.when) : undefined;
this.debuggerHiddenWhen = typeof this.debuggerContribution.hiddenWhen === 'string' ? ContextKeyExpr.deserialize(this.debuggerContribution.hiddenWhen) : undefined;
}

merge(otherDebuggerContribution: IDebuggerContribution, extensionDescription: IExtensionDescription): void {
Expand Down Expand Up @@ -147,10 +149,21 @@ export class Debugger implements IDebugger, IDebuggerMetadata {
return this.debuggerWhen;
}

get hiddenWhen(): ContextKeyExpression | undefined {
return this.debuggerHiddenWhen;
}

get enabled() {
return !this.debuggerWhen || this.contextKeyService.contextMatchesRules(this.debuggerWhen);
}

get isHiddenFromDropdown() {
if (!this.debuggerHiddenWhen) {
return false;
}
return this.contextKeyService.contextMatchesRules(this.debuggerHiddenWhen);
}

get strings() {
return this.debuggerContribution.strings ?? (this.debuggerContribution as any).uiMessages;
}
Expand Down
Loading