Skip to content

Commit

Permalink
Merge pull request #193157 from WardenGnaw/dev/waan/deemphasizeDebuggers
Browse files Browse the repository at this point in the history
Add support to de-emphasize debuggers in run list
  • Loading branch information
roblourens authored Sep 18, 2023
2 parents 1e47994 + f47b1f3 commit 347abe1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
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

0 comments on commit 347abe1

Please sign in to comment.