-
Notifications
You must be signed in to change notification settings - Fork 234
Add support for conditional breakpoints #94
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
Comments
Ooh, that would be nice. So the BTW this doesn't help with management of data and command breakpoints which can be set by the user in the Debug Console (fortunately). Although it is a bit of a pain e.g.: Set-PSBreakpoint -Script C:\Users\Keith\.vscode\extensions\ms-vscode.PowerShell-0.3.1\examples\DebugTest.ps1 -Command Write-Output It would be nice if I could use some variable in the Debug Console would recognize as the path to the workspaceRoot and the current file. I tried $file, $MyInvocation.ScriptName (and InvocationName) and these all came back empty. Or perhaps we inject some sort of DTE like object in the Debug Console session to allow the user to access things like the path to workspaceRoot, the full path of the currently open (debugged) file, the collection of Watched variables, etc. |
Yep, we'd basically just take the expression and register it with Set-PSBreakpoint so that the PowerShell debugger will stop when it evaluates to true. I think it would be good to propose command breakpoints as a possibility to the VS Code team. Not sure if other languages have that feature though? The DTE idea is interesting. I think we're going to need a broader strategy for a |
I'm going to push this out to 0.5.0 because I'm not sure how it will work just yet. |
A few thoughts:
|
Kirk, I agree, it'd be nice if we could make some distinction there so that we could enable both kinds of breakpoints. I think we'll have some more leverage to ask them about more breakpoint types in a couple months. If they can't do it then we could at least enable it in Editor Services so that another editor (like the ISE) could have that capability. Keith, I agree with going with the simplified predicate expression approach for now since that's what VS Code's UI communicates. Let's still ask them about the possibility of adding action breakpoints, but maybe after some of our current requests have settled. Also, I spy code folding icons ;) Does it work with #region/#endregion? |
Not only could PowerShell support "action" breakpoints (as they're called in Visual Studio) but also variable breakpoints. The latter is similar to the data breakpoints you get in C++ IIRC.
No. But perhaps that would require that the language declares support for such directives? @KirkMunro
As @daviwil alludes to, with VSCode we don't have that sort of control over the end user UI experience. We get a JSON message from VSCode saying put a breakpoint on line X, optionally on column Y and optionally with a condition string. We try to do that and then let VSCode know whether we succeeded and if not, we can provide a message indicating why. Also RE this:
Don't you mean "modern debuggers"? :-) BTW I consider Visual Studio a modern debugger and it allows just that. Note the So I think I want to A) use the ScriptBlock AST to search for either a |
If it turns out to be fairly straightforward to do the advanced syntax support, I'd say go for it. We've got plenty of time until 0.5.0 gets released. We don't even have to advertise that it works until VS Code expands their UI to include it as a possibility. |
@rkeithhill Yeah, I meant modern debuggers, not modern editors. When considering features for PowerShell editors/debuggers, while I draw some inspiration from Visual Studio and other IDEs (and I know, this is Visual Studio Code), I try to tweak it for the target audience. I did this when working on PowerGUI and PowerSE as well. It might make sense to diverge from how Visual Studio does things when the majority of the PowerShell community doesn't do debugging. But then again, maybe not, since this is a Visual Studio environment. Still thinking about it. For me though, regardless of the debugger, my brain still wants to pause when it hears the word breakpoint in the context of something that doesn't break at all. I get it, and I use it, but the presentation doesn't feel right to me. |
…akpoints Fixes #94 - adds support for conditional breakpoints
…ise-with-spaces Fixes PowerShell#94 - specifically the Open in ISE issue.
The VS Code debug adapter protocol just gained support for conditional breakpoints. We should adopt the protocol changes and add this support in our debug service. See the commit related to this issue for the protocol changes:
microsoft/vscode-debugadapter-node#6
The text was updated successfully, but these errors were encountered: