Skip to content

ISE like breakpoint behaviour (hit breakpoints when running a script from the integrated terminal) #2159

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

Open
Line40 opened this issue Aug 29, 2019 · 3 comments
Labels
Area-Debugging Issue-Enhancement A feature request (enhancement).

Comments

@Line40
Copy link

Line40 commented Aug 29, 2019

Support for hitting breakpoints set in scripts run from the integrated powershell terminal

One of the main features of the Powershell ISE for me was that I was able to just open any script, set breakpoints and run the script from the ISE console and the breakpoints would be hit. Heck even breakpoints in scripts or modules that were invoked by that script would hit.

In VS Code, I find it extremely tedious to always have to edit launch.json just to change parameters I run a script I'm developing with. I'm still exclusively using ISE for script development, just for this one missing feature in VS Code.

I tried multiple times to switch to VS Code, because I really like it overall, but I'm always going back to ISE because I can't bear the overly complicated debugging setup.

Maybe I'm missing something, I really wonder why apparently no one else requested this.

What I want to happen

I want to open any .ps1 file in VS Code, set breakpoints in that file, then go to the terminal window, and invoke that script, or any script that indirectly calls the opened file, and the breakpoints I set in the file get actually hit, as if I used F5.

@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 29, 2019
@SydneyhSmith SydneyhSmith added Area-Debugging Issue-Bug A bug to squash. and removed Needs: Triage Maintainer attention needed! labels Aug 29, 2019
@rjmholt
Copy link
Contributor

rjmholt commented Aug 29, 2019

Looking at the underlying code, setting the breakpoint should just be calling Set-PSBreakpoint under the hood (which if you do directly does exactly what you want it to do).

But I'm also seeing the behaviour you describe. I'll try and look into it and see what would need to be done to enable this.

We are currently reworking the PowerShell extension, including the debug adapter, so while we might not be able to make this work immediately, it's likely something that will see some love in the medium term.

@rkeithhill
Copy link
Contributor

rkeithhill commented Aug 30, 2019

You can't quite do what you want because (I believe) debug sessions have to be started from VSCode. However, if you add the PowerShell Interactive Session debug config, you can start debugging with that configuration and then run scripts from the PowerShell Integrated Console and breakpoints will be hit. You can even set breakpoints from the PSIC when debugging using the PowerShell Interactive Session debug config and those breakpoints will be hit. The nice thing about that debug config is that it doesn't require any customization. Just add it to your workspace's launch config.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 30, 2019
@SydneyhSmith SydneyhSmith added Issue-Enhancement A feature request (enhancement). and removed Needs: Maintainer Attention Maintainer attention needed! Issue-Bug A bug to squash. labels Sep 3, 2019
@rjmholt rjmholt mentioned this issue Aug 24, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Debugging Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

4 participants