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.

Restore "with args" to the launch.json options for PowerShell

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.

Summary

Sometime after ec53532bcf856725e1c763068122131aa949eb50, PowerShell Launch Current File w/Args Prompt was removed from launch.json.

That useful way of specifying args to a script being tested hasn’t been replaced or updated since. Running the script and getting a prompt for Mandatory = $true parms just isn’t the same. And who wants to specify args in launch.json itself?

It’s a pain to keep coming back to the repo to find the syntax for w/Args Prompt because I have too much else to remember.

Can we please put this back into launch.json?

I miss it.

Proposed Design

Put back a few lines of JSON code into launch.json that were summarily removed for some reason that’s probably lost to history.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rkeithhillcommented, Aug 21, 2021

Back in the day, I implemented this feature #707. The configurationSnippet in question is:

          {
            "label": "PowerShell: Launch - Current File w/Args Prompt",
            "description": "Launch current file (in active editor window) under debugger, prompting first for script arguments",
            "body": {
              "type": "PowerShell",
              "request": "launch",
              "name": "PowerShell Launch Current File w/Args Prompt",
              "script": "^\"\\${file}\"",
              "args": [],
              "cwd": "^\"\\${file}\""
            }
          },

Originally we put this in the configurationSnippets & initialConfigurations fields under debuggers in the package.json. But the VSCode team complained that the PowerShell extension offered too many debug configurations by default - see #1611. So they asked us to whittle down the defaults in package.json and provide additional debug configuration via the provideDebugConfigurations provider, which I did in #2084.

When we determined what would be in the dynamic debug config list we decided to whittle the list down a bit realizing that all w/args Prompt required was the user modifying the “args” property like so:

"args": [ "${command:SpecifyScriptArgs}" ],

It’s even in the tooltip for args: image

That said, I have no objections to adding this launch config back in.

0reactions
msftbot[bot]commented, Aug 26, 2021

This issue has been marked as answered and has not had any activity in a day. It has been automatically closed for housekeeping purposes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging PowerShell script in Visual Studio Code – Part 2
You can debug those PowerShell scripts from the C# project by adding a PowerShell launch configuration to the C# project's launch.json file. The ......
Read more >
Debug powershell in Visual studio code with parameters from ...
Then just open the "Run and Debug" sidebar pane on VSCode (the play button with the bug or Ctrl + Shift + D...
Read more >
vscode\launch.json - PowerShell Gallery
.vscode/launch.json ... "name": "PowerShell Launch Debug.ps1", ... "name": "PowerShell Launch Current File w/Args Prompt", "script": "${file}", "args": [
Read more >
C/C++ extension FAQ - Visual Studio Code
json file and remove it. How do I recreate the IntelliSense database? Starting in version 0.12.3 of the extension, there is a command...
Read more >
How to use PowerShell with Visual Studio Code like a Pro
Launch Visual Studio Code and press Ctrl+P (Cmd+P on Mac). The editor opens a side bar Extensions with the PowerShell extension selected. Click ......
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