Repository navigation
Simplify generated launch.json #1611
Copy link
Copy link
Closed
Labels
Area-ConfigurationIssue-EnhancementA feature request (enhancement).A feature request (enhancement).Resolution-FixedWill close automatically.Will close automatically.
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
DebugConifugarionProviderfor resolving configuration. I suggest to aslo use it for providing debug conifiguration as it should make the following step possible -
DebugConfigurationProvidershould use thequickPickto 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
configuraitonSnippetswhich 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": ""
}
]
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-ConfigurationIssue-EnhancementA feature request (enhancement).A feature request (enhancement).Resolution-FixedWill close automatically.Will close automatically.
Activity
isidorn commentedon Nov 20, 2018
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
rkeithhill commentedon Nov 20, 2018
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. :-)
rjmholt commentedon Nov 20, 2018
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.
isidorn commentedon 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 microsoft/vscode-docker#618
WIP: first pass at PowerShell#1611 - provide dynamic debug config
rkeithhill commentedon Jul 20, 2019
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.
Implement #1611 - provide dynamic debug config (#2084)
Implement PowerShell#1611 - provide dynamic debug config (PowerShell#…
BACKPORT: Implement #1611 - provide dynamic debug config (#2084) (#2195)
TylerLeonhardt commentedon Oct 4, 2019
I think we can close this now :) Keith Hill (@rkeithhill)
UnicodeTreason commentedon Jan 29, 2020
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.
UnicodeTreason commentedon Jan 29, 2020
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.
rkeithhill commentedon Apr 22, 2020
@JustinAddams Also note that the tooltip to the
argsparameter mentions${command:SpecifyScriptArgs}: