-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Provide extension hooks to generate debugger configuration when clicking Add Configuration button #65988
Comments
@DonJayamanne this makes good sense and is somewhat a duplicate of #63121 Dynamic snippets should be shown on top of the add configuration suggest box and they should get configurations via provideDebugConfigurations call. So basically the add configuration would call into the same exisiting DebugConfigurationProvider, we would not add any hooks. fyi @weinand |
Note to self: @aeschli is there some way for me to provide a dynamic JSON schema snippet like this but that I compute it on the fly and return a promise. Or I have to go thorugh the CompletionProviderRegistry as I propose here. |
@DonJayamanne we tried implementing this and we believe that all the pieces are there already and this could be done by extensions. Here's what we recommend:
Here's a very rough sketch of this CompletionProviderRegistry.register({ pattern: '**/launch.json' }, {
provideCompletionItems: (model, position, context, token) => {
return this.provideDebugConfigurations().then(configurations => {
// TODO map configurations to suggestions
});
}
}); Here's the actual vscode api for this https://github.com/Microsoft/vscode/blob/275d2a02ca922738b58cea7dbf9dce229ea75f21/src/vs/vscode.d.ts#L7838 Can you please try this out and let us know if you find any missing pieces? Here's a sample for completions https://github.com/Microsoft/vscode-extension-samples/tree/master/completions-sample |
Thanks, however that's not what we're after.
Next:
Suggestion
Problems Summary |
@DonJayamanne thanks for feedback. We are currently wrapping up our milestone this week, so I will think about your use case and get back to you next week. |
@DonJayamanne First of all sorry for the slow response, only found time now. I understand your scenario and thanks for clariyfing. And yes I agree with you if we allowed an extension to hijack the Add Configurations button it could be a confusing experience to the user. I think my original proposal would not be such a bad scenario, let me clarify it a bit from a UX standpoint: User clicks Add Configuration button, he is in the editor and sees a list of suggetions (he can choose freely if he wants C# or Python). The first Python suggestion is just called PYTHON... or something to make it stand out from the rest - also to make it stand out I suggest using a different icon and having ... at the end. Once the user chooses that one -> you go in your quick pick wizard experience. |
For demo purposes of the idea I have created a very simple extension that does just this. I can also show this to our UX team to get feedback and potential ideas, but for now I think it is more important to get your feedback. |
Perfect.
Absolutely no problem.
Sorry but I didn't understand you the first time, with the screen sample you're suggestions makes more sense now |
Glad you like the idea. Yeah the first time i was not being precise enough. As for the implementation here are some tips which might help:
That should make it work. However now your completion item will be shown whenever a user triggers inteli-sense in the Because there are no code changes needed on the vscode side I am closing this issue. |
Currently clicking the
Configure or fix launch.json
button will invoke theDebugConfigurationProvider
of the extension.We (Python Extension) have used this to generate a leaner
launch.json
file (#62851 & microsoft/vscode-python#3321 (comment)).However, when the user clicks the
Add Configuration
button (either in the debugger dropdown or button displayed on the bottom right oflaunch.json
, the corresponding extension hooks do not get triggered. Instead VSC merely displays a pick list of configuration snippets.We were hoping VSC could provide some hook (similar to
DebugConfigurationProvider
) that would get invoked when clicking theAdd Configuration
button.The text was updated successfully, but these errors were encountered: