Show Dynamic Configuration Providers with No Context

This PR adds support to show dynamic configurations when a file is not
selected.

The changes introduces a new method to the Debugger class called
hasDynamicConfigurationProviders. It utilizes the existing
ConfigurationManager.hasDebugConfigurationProvider but passing Dynamic
TiggerKind instead of Initial.
This commit is contained in:
Andrew Wang
2023-10-26 15:30:25 -07:00
parent 9ea20d5e24
commit c7474e2dc1
3 changed files with 8 additions and 3 deletions
@@ -341,9 +341,10 @@ export class AdapterManager extends Disposable implements IAdapterManager {
// Or if a breakpoint can be set in the current file (good hint that an extension can handle it)
if ((!languageLabel || gettingConfigurations || (model && this.canSetBreakpointsIn(model))) && candidates.length === 0) {
await this.activateDebuggers('onDebugInitialConfigurations');
candidates = this.debuggers
.filter(a => a.enabled)
.filter(dbg => dbg.hasInitialConfiguration() || dbg.hasConfigurationProvider());
.filter(dbg => dbg.hasInitialConfiguration() || dbg.hasDynamicConfigurationProviders() || dbg.hasConfigurationProvider());
}
if (candidates.length === 0 && languageLabel) {
@@ -904,7 +904,7 @@ export interface IConfigurationManager {
*/
onDidSelectConfiguration: Event<void>;
hasDebugConfigurationProvider(debugType: string): boolean;
hasDebugConfigurationProvider(debugType: string, triggerKind?: DebugConfigurationProviderTriggerKind): boolean;
getDynamicProviders(): Promise<{ label: string; type: string; pick: () => Promise<{ launch: ILaunch; config: IConfig } | undefined> }[]>;
registerDebugConfigurationProvider(debugConfigurationProvider: IDebugConfigurationProvider): IDisposable;
@@ -7,7 +7,7 @@ import * as nls from 'vs/nls';
import { isObject } from 'vs/base/common/types';
import { IJSONSchema, IJSONSchemaMap, IJSONSchemaSnippet } from 'vs/base/common/jsonSchema';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IConfig, IDebuggerContribution, IDebugAdapter, IDebugger, IDebugSession, IAdapterManager, IDebugService, debuggerDisabledMessage, IDebuggerMetadata } from 'vs/workbench/contrib/debug/common/debug';
import { IConfig, IDebuggerContribution, IDebugAdapter, IDebugger, IDebugSession, IAdapterManager, IDebugService, debuggerDisabledMessage, IDebuggerMetadata, DebugConfigurationProviderTriggerKind } from 'vs/workbench/contrib/debug/common/debug';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import * as ConfigurationResolverUtils from 'vs/workbench/services/configurationResolver/common/configurationResolverUtils';
@@ -176,6 +176,10 @@ export class Debugger implements IDebugger, IDebuggerMetadata {
return !!this.debuggerContribution.initialConfigurations;
}
hasDynamicConfigurationProviders(): boolean {
return this.debugService.getConfigurationManager().hasDebugConfigurationProvider(this.type, DebugConfigurationProviderTriggerKind.Dynamic);
}
hasConfigurationProvider(): boolean {
return this.debugService.getConfigurationManager().hasDebugConfigurationProvider(this.type);
}