-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Allow debug extensions to provide configurations to display in Select and Start Debugging #88230
Comments
Are you saying that when the user presses F5 and sees this: Then there would be a second quick pick with the list of possible launch configs? Or that they would show up in a dropdown in the viewlet like configured ones? I could see a flow like we do for tasks, where you see the list of autodetected configs, but then it prompts you to "configure" that task by adding it to a tasks.json file. |
In Select and Start Debugging There would be a new section with discovered configuration, something like: I imagine selecting those would immediately run the chosen configuration. I think it would be good to allow the user some way to persist the config into their launch.json file, but I'm not sure the best way for that interaction to work. Perhaps discovered configs appear as intellisense autocompletion entries while editing launch.json? |
Oh I didn't know that's what that menu was called, yeah it is similar to tasks then, where we show configured and detected tasks. One annoying thing about this for tasks is that the detection slows down showing that menu. But I think the discovery that debuggers do is probably simpler than that for tasks. |
I don't see an API for it, but it would be nice to have a way to update the items in a quick pick after instantiation. That'd allow us to show some 'loading' placeholder to avoid delaying the pick opening. But yes I think the debug discovery should generally be simple. |
I think this makes sense overall to me. As for where we surface this in the UX we can sync on that once we figure out the API. The select and start is not so discoverable, so I would push more that we just show them everywhere when it makes sense. |
I think that showing them by default in debug view's dropdown would be nice for discoverability. But I think it's important to be able to easily turn them off; once I have my project built and set up with custom launch configs, I may no longer need any of the auto-discovered tasks. Maybe the gear beside the dropdown turns into a menu with the options I also want to be careful to avoid cluttering the dropdown like build tasks can get. I'll update the proposal to add |
If I understand this request correctly, I can break it down into one new VS Code feature and two independent API requests:
IMO the first and the last items make complete sense but the second item needs more discussion. I've removed the "api-proposal" for now and added a "feature-request" label. |
|
After revisiting this API feature request and investigating how to improve "single file debugging" I got some new insights: In bullet item two of my comment above I had argued that the value of "in-memory-only debug configuration" is questionable because there is no need for editing them. Instead we could just allow to add regular commands to the debug configuration drop-down menu (and other places). But now after having reviewed what "tasks" is doing and what other feature requests (e.g. #92269) are asking for, I'm leaning more towards the following "homogenous" approach (similar to "tasks"):
Since we are not introducing new types of debug configurations, the VS Code implementation does not require big changes. Work needed:
Proposed API: /**
* Debug UI locations.
*/
export type DebugUILocation = 'debug.start' | 'debug.selectandstart' | 'debugView';
/**
* How a debug configuration is presented in the UI.
*/
export interface DebugConfigPresentation {
hidden?: boolean;
group?: string;
order?: number;
locations?: DebugUILocation[];
}
/**
* Configuration for a debug session.
*/
export interface DebugConfiguration {
// ...
presentation?: DebugConfigPresentation;
}
export interface DebugConfigurationProvider {
/**
* Provides [debug configuration](#DebugConfiguration). If more than one debug configuration provider is
* registered for the same type, debug configurations are concatenated in arbitrary order.
*
* @param token A cancellation token.
* @return An array of [debug configurations](#DebugConfiguration).
*/
provideDynamicDebugConfigurations?(token?: CancellationToken): ProviderResult<DebugConfiguration[]>;
} |
This makes good sense to me and feels like a natural progression of the current api. Some minor comments:
|
It would be ideal if |
@isidorn @awschristou thanks for the feedback. Here my replies to the bullets:
|
@weinand thanks. |
@connor4312 you might want to try the new feature with js-debug (may be as part of testing this; see #95837). |
In the API meeting it was suggested to rename the enum With this the final proposal becomes: /**
* A DebugConfigurationProviderTrigger specifies when the `provideDebugConfigurations` method of a `DebugConfigurationProvider` is triggered.
* Currently there are two situations: to provide the initial debug configurations for a newly created launch.json or
* to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
* A trigger is used when registering a `DebugConfigurationProvider` with #debug.registerDebugConfigurationProvider.
*/
export enum DebugConfigurationProviderTrigger {
/**
* `DebugConfigurationProvider.provideDebugConfigurations` is called to provide the initial debug configurations for a newly created launch.json.
*/
Initial = 1,
/**
* `DebugConfigurationProvider.provideDebugConfigurations` is called to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
*/
Dynamic = 2
}
export namespace debug {
/**
* Register a [debug configuration provider](#DebugConfigurationProvider) for a specific debug type.
* The optional [trigger](#DebugConfigurationProviderTrigger) can be used to specify when the `provideDebugConfigurations` method of the provider is triggered.
* Currently two triggers are possible: with the value `Initial` (or if no trigger argument is given) the `provideDebugConfigurations` method is used to provide the initial debug configurations to be copied into a newly created launch.json.
* With the trigger `Dynamic` the `provideDebugConfigurations` method is used to dynamically determine debug configurations to be presented to the user (in addition to the static configurations from the launch.json).
* Please note that the `trigger` argument only applies to the `provideDebugConfigurations` method: so the `resolveDebugConfiguration` methods are not affected at all.
* Registering a single provider with resolve methods for different triggers, results in the same resolve methods called multiple times.
* More than one provider can be registered for the same type.
*
* @param type The debug type for which the provider is registered.
* @param provider The [debug configuration provider](#DebugConfigurationProvider) to register.
* @param trigger The [trigger](#DebugConfigurationProviderTrigger) for which the 'provideDebugConfiguration' method of the provider is registered.
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
*/
export function registerDebugConfigurationProvider(debugType: string, provider: DebugConfigurationProvider, trigger?: DebugConfigurationProviderTrigger): Disposable;
} @jrieken @connor4312 @isidorn I've optimistically released the change (hoping that it will be accepted in the API meeting) |
fyi - we haven't yet used |
@jrieken thanks, renamed @connor4312 @isidorn FYI |
The test of this API is covered by test item #95837 |
Re-open to keep this item around for API finalization |
The API submitted for finalisation is this: /**
* A DebugConfigurationProviderTriggerKind specifies when the `provideDebugConfigurations` method of a `DebugConfigurationProvider` is triggered.
* Currently there are two situations: to provide the initial debug configurations for a newly created launch.json or
* to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
* A trigger kind is used when registering a `DebugConfigurationProvider` with #debug.registerDebugConfigurationProvider.
*/
export enum DebugConfigurationProviderTriggerKind {
/**
* `DebugConfigurationProvider.provideDebugConfigurations` is called to provide the initial debug configurations for a newly created launch.json.
*/
Initial = 1,
/**
* `DebugConfigurationProvider.provideDebugConfigurations` is called to provide dynamically generated debug configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
*/
Dynamic = 2
}
export namespace debug {
/**
* Register a [debug configuration provider](#DebugConfigurationProvider) for a specific debug type.
* The optional [triggerKind](#DebugConfigurationProviderTriggerKind) can be used to specify when the `provideDebugConfigurations` method of the provider is triggered.
* Currently two trigger kinds are possible: with the value `Initial` (or if no trigger kind argument is given) the `provideDebugConfigurations` method is used to provide the initial debug configurations to be copied into a newly created launch.json.
* With the trigger kind `Dynamic` the `provideDebugConfigurations` method is used to dynamically determine debug configurations to be presented to the user (in addition to the static configurations from the launch.json).
* Please note that the `triggerKind` argument only applies to the `provideDebugConfigurations` method: so the `resolveDebugConfiguration` methods are not affected at all.
* Registering a single provider with resolve methods for different trigger kinds, results in the same resolve methods called multiple times.
* More than one provider can be registered for the same type.
*
* @param type The debug type for which the provider is registered.
* @param provider The [debug configuration provider](#DebugConfigurationProvider) to register.
* @param triggerKind The [trigger](#DebugConfigurationProviderTrigger) for which the 'provideDebugConfiguration' method of the provider is registered. If `triggerKind` is missing, the value `DebugConfigurationProviderTriggerKind.Initial` is assumed.
* @return A [disposable](#Disposable) that unregisters this provider when being disposed.
*/
export function registerDebugConfigurationProvider(debugType: string, provider: DebugConfigurationProvider, triggerKind?: DebugConfigurationProviderTriggerKind): Disposable;
} |
What I meant to ask was if the default behavior could be added to the |
Moved the proposed API to vscode.d.ts. |
Goals
In some scenarios, it's possible for the debug adapters to provide a quality debugging experience without additional user configuration. For example, the new
js-debug
can debug npm scripts, and languages where entrypoints are easily identifiable. Go, C#, Java... may offer to debug the program without extra configuration.In a similar way to how build tasks are provided, we'd like the ability to provide default run tasks that show up under the
Select and Start Debugging
quick-pick.Proposal
Launch configurations already have an optional
presentation
key, with the following properties (this interface is not exposed in vscode.d.ts):This proposes adding a new property:
export interface IConfigPresentation { + locations: ('debug.start' | 'debug.selectandstart' | 'debugView')[];
When set, this configures the locations in the UI where the returned configuration is displayed. If not provided, the locations returned from
DebugConfigurationProvider.provideDebugConfigurations
default to['debug.start']
.provideDebugConfigurations
would now be called when the select and start quick-pick is opened to retrieve configurations to display.Questions
Why are we proposing this over the existing initial configuration/F5 experience?
Should we surface all existing provided configurations in select and start?
Should there be a separate method to return the pick-able configurations?
provideDebugConfigurations
more frequently, which may lead to side-effects or slowdowns; a separate method avoids that.Should we also be able to provide default configurations for the "Run and Debug" dropdown in the debug view?addedlocations
would let consumers in launch.json take advantage of it, rather thanhidden: true/false
.cc @isidorn @roblourens @weinand
microsoft/vscode-js-debug#197
The text was updated successfully, but these errors were encountered: