Hello,
I have a weird issue I do not know how to phrase to get google to answer me how (if at all) to resolve, or why this might even be the case.
I suspect it is probably a PSReadLine behaviour that has been fixed in PS7 as it does not occur there.
Trying to paste multi-line code for a class (or a function), powershell is trying to execute this line-by-line instead of as a full block.
Copying and pasting, starting a PS5 session (no profile, to exclude influence of oh-my-posh prompt)
in PS7 I get:
PS C:\Users\David> class ClassName
>> {
>> [string] $ParameterName
>>
>> [string] $Parameter2
>>
>> }
PS C:\Users\David>
in PS5 I get:
PS C:\WINDOWS\System32> class ClassName
>> {
>> [string] $ParameterName
>>
At line:3 char:1
+ [string] $ParameterName
+ ~~~~~~~~~~~~~~~~~~~~~~~
Missing closing '}' in statement block or type definition.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndCurlyBrace
PS C:\WINDOWS\System32> [string] $Parameter2
PS C:\WINDOWS\System32>
PS C:\WINDOWS\System32> }
At line:1 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
PS C:\WINDOWS\System32>
Can anyone tell me what this behaviour is called, and whether I can configure PS5 to behave the same as PS7?
Cheers,
David
Edit: PsReadline v2.3.5 (just found 2.3.6 is out)