-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Honor debug stop from configuration providers #10999
Conversation
e085336
to
917d913
Compare
5ba001c
to
4678360
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good and the provided tests work. @vince-fugnitto mentioned VSCode's ProviderResult
type, and I think it might make sense to introduce something similar in our packages/core/src/common/types.ts
file to reduce the number of times we have to write | undefined | null
?
1f29607
to
6eab3ff
Compare
Hi @colin-grant-work, The new type is under a new commit so we can discuss this particular update separately! I have updated all the related returns accordingly, let me know what you think ! |
packages/core/src/common/types.ts
Outdated
@@ -130,3 +130,5 @@ export namespace ArrayUtils { | |||
export function unreachable(_never: never, message: string = 'unhandled case'): never { | |||
throw new Error(message); | |||
} | |||
|
|||
export type ResultPromise<T> = Promise<T | undefined | null>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alvsan09 I would probably keep the same name ProviderResult
unless you have a strong reason to deviate? I don't think ResultPromise
would be a good name for this type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we benefit from this type at all at them moment, I would remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically I don't think it's super useful to use for implementations, which is its main use right now.
Looking at VS Code they have a ProviderResult
used in definitions, but they never mention it in implementations.
packages/core/src/common/types.ts
Outdated
@@ -130,3 +130,5 @@ export namespace ArrayUtils { | |||
export function unreachable(_never: never, message: string = 'unhandled case'): never { | |||
throw new Error(message); | |||
} | |||
|
|||
export type ResultPromise<T> = Promise<T | undefined | null>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we benefit from this type at all at them moment, I would remove it.
6eab3ff
to
5b1e75b
Compare
@colin-grant-work, @paul-marechal, @vince-fugnitto, Colin had already approved that commit, @vince-fugnitto and @paul-marechal any pending items before approving this PR? |
Debug configuration providers can indicate to stop debugging by returning `undefined` or `null` on either of the functions - `resolveDebugConfiguration` or - `resolveDebugConfigurationWithSubstitutedVariables` The vscode API https://code.visualstudio.com/api/references/vscode-api#DebugConfigurationProvider specifies different handling for `undefined` and `null` as follows: "Returning the value 'undefined' prevents the debug session from starting. Returning the value 'null' prevents the debug session from starting and opens the underlying debug configuration instead." This implementation focuses on passing the `undefined` or `null` response from the extension to the debug session manager where the indication from the extension is handled. Signed-off-by: Alvaro Sanchez-Leon <[email protected]>
5b1e75b
to
4214de2
Compare
Re-based to latest master |
My approval stands, with or without the additional type. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What it does
Fixes: #10998
Debug configuration providers can indicate to stop debugging by
returning
undefined
ornull
on either of the functionsresolveDebugConfiguration
orresolveDebugConfigurationWithSubstitutedVariables
The vscode API
https://code.visualstudio.com/api/references/vscode-api#DebugConfigurationProvider
specifies different handling for
undefined
andnull
as follows:"Returning the value 'undefined' prevents the debug session from
starting. Returning the value 'null' prevents the debug session from
starting and opens the underlying debug configuration instead."
This implementation focuses on passing the
undefined
ornull
response from the extension to the debug session manager where the
indication from the extension is handled.
Signed-off-by: Alvaro Sanchez-Leon [email protected]
How to test
https://github.com/alvsan09/debug-activation-events/blob/master/on-debug-resolve-null.vsix
undefined
:From the command palette (Ctrl + shft + P) , type
debug
, note trailing space is needed.Select configuration named
Create JavaScript Debug Terminal
Verify that no debug session is started and that a single
JavaScript Debug Terminal
instance is created.This verifies the fix for issue: resolveDebugConfiguration returning 'undefined' or 'null' does not comply to vscode API #10998
null
:From the command palette (Ctrl + shft + P) , type
debug
, note trailing space is needed.Select configuration named
Resolve config to null
(this configuration is provided by the test extension loaded in step 1)Verify that no debug session is started and that the
launch.json
file is opened.Review checklist
Reminder for reviewers