Skip to content

Simplify generated launch.json  #1611

Closed

Description

Hey,

VSCode dev here. This milestone I am looking into simplifing generated launch.json for various extensions microsoft/vscode#62851

The launch.json that Powershell generates is attached at the end. This is a bit too complex for the avarage user and I suggest to simplify it the following way:

  • You are already using a DebugConifugarionProvider for resolving configuration. I suggest to aslo use it for providing debug conifiguration as it should make the following step possible
  • DebugConfigurationProvider should use the quickPick to ask the user if he would like to launch or to attach. If he chooses launch I would ask a follow up question if he would like to launch a current file, Current File in Temporary Console, Current File w/Args Prompt or just an interactive powershell session.
  • Remove default fields which are not necessery like args, runspaceId
  • You are already contributing configuraitonSnippets which is great. However these snippets also need to be simplified. I suggest to remove all attributes that have the default value. Example: stopAtEntry, cwd, args

If you agree with the suggestions I am making here I am also here to help with any potential questions you might have. The changes should not require a lot of work but will simplify the flow a lot imho. It should be much less complex and not too much like a wizard experience

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Launch Current File",
            "script": "${file}",
            "args": [],
            "cwd": "${file}"
        },
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Launch Current File in Temporary Console",
            "script": "${file}",
            "args": [],
            "cwd": "${file}",
            "createTemporaryIntegratedConsole": true
        },
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Launch Current File w/Args Prompt",
            "script": "${file}",
            "args": [
                "${command:SpecifyScriptArgs}"
            ],
            "cwd": "${file}"
        },
        {
            "type": "PowerShell",
            "request": "attach",
            "name": "PowerShell Attach to Host Process",
            "processId": "${command:PickPSHostProcess}",
            "runspaceId": 1
        },
        {
            "type": "PowerShell",
            "request": "launch",
            "name": "PowerShell Interactive Session",
            "cwd": ""
        }
    ]
}

Activity

  1. isidorn commented on Nov 20, 2018

    @isidorn
    Author

    Are there any plans to address this?
    Do you agree with my suggesstions here?
    If you do not have cycles to address this but would like to see it done, I can try to get some users to provide a PR which tackles this.

    Thanks a lot

  2. rkeithhill commented on Nov 20, 2018

    @rkeithhill
    Contributor

    Removing fields set to their default value makes sense. I think we originally put in the ones we thought our users were likely to change - to "advertise" them.

    Regarding the quick pick approach, when the user goes through that once, will it save that debug configuration? If our users have to go through a quick pick wizard every time they start a debug session, that will get old real quick.

    Regarding starting this work, we have a deprecated API (webview preview) issue we really need to address first but after that we could tackle this. But PRs are always welcome. :-)

  3. rjmholt commented on Nov 20, 2018

    @rjmholt
    Contributor

    Yes, there's definitely intent to address this and we want to do what we can to (1) simplify the debug experience and (2) accord with VSCode's recommendations, but we're currently locked up in some other things and don't have an ETA on this work.

  4. isidorn commented on Nov 20, 2018

    @isidorn
    Author

    Great news that you plan to look into this.
    Yeah this is not really urgent but we just wanted to know that you are on it.

    Keeping fields around to advertise them makes perfect sense. But imho only fields which the user change often should be advertised.

    As for the quick pick approach: it would appear only when the launch.json is being generated, based on the users choice we would generate a different launch.json and the user would not be asked again.
    Here's an example in docker for reference microsoft/vscode-docker#618

  5. added a commit that references this issue on Jul 14, 2019
  6. rkeithhill commented on Jul 20, 2019

    @rkeithhill
    Contributor

    Isidor Nikolic (@isidorn) I've implemented this in PR #2084. Could you give this a look? It has gone through some iterations so look at the latest comments on the PR.

  7. added a commit that references this issue on Jul 28, 2019
  8. added 2 commits that reference this issue on Sep 20, 2019
  9. TylerLeonhardt commented on Oct 4, 2019

    @TylerLeonhardt
    Member

    I think we can close this now :) Keith Hill (@rkeithhill)

  10. UnicodeTreason commented on Jan 29, 2020

    @UnicodeTreason

    With these simplified options, whats the preferred method for debugging a script that has parameters.
    Used to use "PowerShell Launch Current File w/Args Prompt" and enter the parameters I wanted to test with.

  11. UnicodeTreason commented on Jan 29, 2020

    @UnicodeTreason

    Ah apoligies, I follow the documentation rabbit hole further and found my answers.

    From here: https://code.visualstudio.com/docs/languages/powershell#_debugging
    You then have to go to here: https://devblogs.microsoft.com/scripting/debugging-powershell-script-in-visual-studio-code-part-2/

    And then it's explained how to hard code some parameters which is nice enough for most users.
    Though it could be nice to mention what the old launch.json did with "args": [ "${command:SpecifyScriptArgs}" ] to let the user enter Param's on debug launch.

  12. rkeithhill commented on Apr 22, 2020

    @rkeithhill
    Contributor

    @JustinAddams Also note that the tooltip to the args parameter mentions ${command:SpecifyScriptArgs}:

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions