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

Run DebugConfigurationProviders for the result type of another DebugConfigurationProvider #143054

Merged

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Feb 14, 2022

This enables chaining DebugConfigurationProviders with two or more type changes (one type change is already supported) and calling DebugConfigurationProvider's resolveConfigurationsByProviders callback when providers are chained.

This can be tested manually be defining two different configuration providers and having one return a configuration with the 'type' of the next one and ensuring that the second callback is called.

This PR fixes #142135
Fixes #110889

…onfigurationProvider

This enables chaining `DebugConfigurationProvider`s with two or more `type` changes (one `type` change is already supported) and calling `DebugConfigurationProvider`'s `resolveConfigurationsByProviders` callback when providers are chained.

Fixes microsoft#142135

I'm not sure where to add tests, so I would appreciate any pointers.
@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Feb 14, 2022
@weinand weinand added this to the On Deck milestone Mar 14, 2022
@jkoritzinsky
Copy link
Member Author

I've added some tests for this code. @weinand anything else you'd like me to do for this PR?

@@ -119,22 +118,34 @@ export class ConfigurationManager implements IConfigurationManager {
}

async resolveConfigurationByProviders(folderUri: uri | undefined, type: string | undefined, config: IConfig, token: CancellationToken): Promise<IConfig | null | undefined> {
// activate debuggers early for the provided type in case any '*' typed debug configuration providers are activated
// based on the provided type.
await this.adapterManager.activateDebuggers('onDebugResolve', type);
Copy link
Member

Choose a reason for hiding this comment

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

This seems unnecessary since the first resolveDebugConfigurationForType will activate the type

Copy link
Member

Choose a reason for hiding this comment

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

Is this just so you do the filter once below instead of inside resolveDebugConfigurationForType? I would probably keep it as it was before. Most debug calls won't hit this more than once, and even for the ones that do an await costs much more than filtering the relatively small list of configProvider

@connor4312
Copy link
Member

cc @roblourens. This looks generally okay to me.

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

Looks good but I agree with the comment about calling activate twice

@connor4312 connor4312 merged commit 990a496 into microsoft:main Jan 6, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
4 participants