Vscode-powershell: Auto set breakpoints

Created on 1 May 2017  路  4Comments  路  Source: PowerShell/vscode-powershell

Automatically generate breakpoints for all the functions in the script.

It'd be cool if the vs code API was surfaced to be able to do this from $psEditor.

https://channel9.msdn.com/coding4fun/blog/Breaking-the-Breakpoint-Blues-with-the-Breakpoint-Generator?WT.mc_id=dlvr_twitter_ch9

Area-Debugging Issue-Enhancement

All 4 comments

Cool idea! This will definitely be possible with $psEditor in the future.

You could do something like this once editing has started (works only for the current file but you get the idea):

$psEditor.GetEditorContext().CurrentFile.Ast.FindAll({param($p) $p -is [System.Management.Automation.Language.FunctionDefinitionAst]}, $true) | Foreach-
Object { Set-PSBreakpoint -Command $_.Name }

Unfortunately, pasting into the integrated console breaks the line into two invalid command lines.

But yeah, it would be nice to have access to a debug API off of $psEditor.

Cool! Yeah, we'll definitely have a debug API and also one for easily grabbing the symbols in a file so that you don't have to walk the AST yourself.

Closing as Keith's suggestion should work now, and we do not currently intend to make this enhancement in the near future

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nathan-alden-hp picture nathan-alden-hp  路  3Comments

guidooliveira picture guidooliveira  路  3Comments

TheDanishDynamo picture TheDanishDynamo  路  3Comments

inthemedium picture inthemedium  路  3Comments

lukegriffith picture lukegriffith  路  3Comments