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

[debug] automatically create 'launch.json' #6490

Merged
merged 1 commit into from
Nov 6, 2019
Merged

Conversation

vince-fugnitto
Copy link
Member

What it does

Currently, when attempting to execute the command Start Debugging without a launch.json present under .theia or .vscode nothing occurs. The change ensures that if no configurations are found, the launch.json is automatically created and users are then prompted to select their debug configuration type template.

Additional steps will need to be done in the future to prompt the quick-open described in #6489.

How to test

  1. start the application with a workspace that currently does not have a .launch.json
  2. attempt to execute the command Start Debugging
  3. the command will automatically create the launch.json if not present, and will prompt users in the editor to select the type of config
  4. the same scenario should work with a launch.json except the debugging should begin

Review checklist

Reminder for reviewers

Signed-off-by: Vincent Fugnitto vincent.fugnitto@ericsson.com

@vince-fugnitto vince-fugnitto added the debug issues that related to debug functionality label Nov 4, 2019
@vince-fugnitto vince-fugnitto self-assigned this Nov 4, 2019
Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

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

May be on another PR, but If the end-user close the "Debug console" voluntary or not and he starts the debug session again, he does not see the end result. May be if the "Debug console" is closed when initiating the debug, we should open the "Debug console" view?

Otherwise, looks good to me

@@ -947,6 +947,11 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi

async start(noDebug?: boolean): Promise<void> {
let { current } = this.configurations;
// If not current configurations are present, create the `launch.json` and prompt users to select the config.
Copy link
Contributor

Choose a reason for hiding this comment

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

"If not current ..." or "If no current..."

@vince-fugnitto
Copy link
Member Author

May be on another PR, but If the end-user close the "Debug console" voluntary or not and he starts the debug session again, he does not see the end result. May be if the "Debug console" is closed when initiating the debug, we should open the "Debug console" view?

@lmcbout I'm not sure I understand what you mean, could you clarify?

@lmcbout
Copy link
Contributor

lmcbout commented Nov 4, 2019

If "Debug console" view is closed when you try to run the Debug session, the "Debug console" view will not show up and we don't see the result of the execution. May be if we don't see the execution result, we should open the "Debug console" view if closed to see the result.

@vince-fugnitto
Copy link
Member Author

If "Debug console" view is closed when you try to run the Debug session, the "Debug console" view will not show up and we don't see the result of the execution. May be if we don't see the execution result, we should open the "Debug console" view if closed to see the result.

@lmcbout are you referring to when no launch.json exists and a user attempts to start debugging? I see the following behavior:

  1. launch.json exists - the debug console is displayed and the debugging starts
  2. no launch.json exists - the file is created, and users are prompted to add a new config

I don't see why the debug console would be opened for the second case, the same behavior is also present in VS Code.

Copy link
Contributor

@elaihau elaihau 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 to me. Thank you !

@akosyakov
Copy link
Member

Why do we need to create an empty file? I don't think VS Code does it. Does it really fix #6489?

@vince-fugnitto
Copy link
Member Author

Why do we need to create an empty file? I don't think VS Code does it. Does it really fix #6489?

It doesn't just create an empty file, it creates the file with the default launch schema, and also prompts users to add specific configs (for instance, creating a mocha test config):

Peek 2019-11-05 06-22


It is the same functionality present when executing the play button from the debug-view from master.

@akosyakov
Copy link
Member

It is the same functionality present when executing the play button from the debug-view from master.

Can we reuse it?

@vince-fugnitto
Copy link
Member Author

It is the same functionality present when executing the play button from the debug-view from master.

Can we reuse it?

I refactored further so we can re-use the same logic present in the actual command.
Thanks for the idea!

Automatically creates the `launch.json` file when executing
the command `start debugging` whenever a `launch.json` does not
exist under `.theia` or `.vscode`. Once created, users are prompted
to select the type of debug configuration they desire.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

code wise looks good now, thank you

@vince-fugnitto
Copy link
Member Author

code wise looks good now, thank you

Thank you for your help in making it better 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug issues that related to debug functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants