question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simplify generated launch.json

See original GitHub issue

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": ""
        }
    ]
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rkeithhillcommented, Jul 20, 2019

@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.

1reaction
isidorncommented, Nov 20, 2018

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 https://github.com/Microsoft/vscode-docker/pull/618

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simplify generated launch.json #3321 - GitHub
Hey, VSCode dev here. This milestone I am looking into simplifing generated launch.json for various extensions microsoft/vscode#62851 The launch.json that ...
Read more >
Debugging in Visual Studio Code
If running and debugging is not yet configured (no launch.json has been created), VS Code shows the Run start view. Simplified initial Run...
Read more >
Why when I create launch.json file in VScode, it is empty?
These steps helped me: Go to your launch.json file and press the "Add Configuration" button img 1. Choose "C/C++: (gdb) Launch" img 2....
Read more >
Quick Tip: How do I recreate my launch.json in VSCode?
Do you manually create a new launch.json file? Do you copy a launch.json file from another project? Do you go to #bcalhelp and...
Read more >
Integration with Visual Studio Code debugging - Microsoft Learn
Select Activity Bar > Microsoft Edge Tools > click the Generate launch.json button, and then press F5 . Or, see Opening DevTools and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found