You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to run an unsaved PS script in the PowerShell Integrated Console, if you comment out the last line, and don't add an extra blank line after the commented one, the extension attempts to close the executed script by putting the closing bracket '}' on the same line as the comment, leading to a missing closing bracket in the code, which leads to a parser error.
After attempting to execute the unsaved code, if a comment is the last line of the script, you will receive, "Missing closing '}' in statement block or type definition." If you add a blank line at the end of the code, or don't comment out the last line, it works fine. I am unsure if this was an issue before the recent rework of the extension (great work on it, btw).
Obviously, this is not a severe bug. If this is a known, addressed, and/or intentionally left "bug," please disregard this issue and accept my apologies. I searched for, but may not have used the correct terminology, before posting.
Double click anywhere in the top workspace bar and select 'PowerShell' from the list of available languages (this is my way of getting a new file, but you may have an alternative way to do this).
Write or copy/paste code to run.
Comment the last line of the script.
Attempt to run it.
Visuals
No response
Logs
Code as written
# To make powrshell beep
[console]::beep(500,525)
# Different way
# [System.Media.SystemSounds]::Beep.Play()
# [System.Media.SystemSounds]::Hand.Play()
# [System.Media.SystemSounds]::Asterisk.Play()
# [System.Media.SystemSounds]::Exclamation.Play()
Code executed by the console
The below shows the input from the code and the output. Notice the '}' on the commented line
> . { # To make powrshell beep
[console]::beep(500,525)
# Different way
# [System.Media.SystemSounds]::Beep.Play()
# [System.Media.SystemSounds]::Hand.Play()
# [System.Media.SystemSounds]::Asterisk.Play()
# [System.Media.SystemSounds]::Exclamation.Play() }
Missing closing '}' in statement block or type definition.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : MissingEndCurlyBrace
The text was updated successfully, but these errors were encountered:
Prerequisites
Summary
When attempting to run an unsaved PS script in the PowerShell Integrated Console, if you comment out the last line, and don't add an extra blank line after the commented one, the extension attempts to close the executed script by putting the closing bracket '}' on the same line as the comment, leading to a missing closing bracket in the code, which leads to a parser error.
After attempting to execute the unsaved code, if a comment is the last line of the script, you will receive, "Missing closing '}' in statement block or type definition." If you add a blank line at the end of the code, or don't comment out the last line, it works fine. I am unsure if this was an issue before the recent rework of the extension (great work on it, btw).
Obviously, this is not a severe bug. If this is a known, addressed, and/or intentionally left "bug," please disregard this issue and accept my apologies. I searched for, but may not have used the correct terminology, before posting.
PowerShell Version
Visual Studio Code Version
Extension Version
[email protected]
Steps to Reproduce
Visuals
No response
Logs
Code as written
Code executed by the console
The below shows the input from the code and the output. Notice the '}' on the commented line
The text was updated successfully, but these errors were encountered: