FormatPowershellCode icon indicating copy to clipboard operation
FormatPowershellCode copied to clipboard

Format-ScriptFormatCodeIndentation doesn't work after building

Open vlariono opened this issue 9 years ago • 0 comments

Format-ScriptFormatCodeIndentation stops working after release building. It's related to the following code:

$AST = [System.Management.Automation.Language.Parser]::ParseInput($ScriptText, [ref]$Tokens, [ref]$ParseError) 

It will be change after build process is run:

$AST = [System.Management.Automation.Language.Parser]::ParseInput($ScriptText, [System.Management.Automation.PSReference]$Tokens, [System.Management.Automation.PSReference]$ParseError)

It seems types are expanded incorrectly because $Tokens variable will always be empty. If I change it back to [ref] everything works again.

vlariono avatar Dec 11 '16 09:12 vlariono