-
Notifications
You must be signed in to change notification settings - Fork 509
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
else: The term 'else' is not recognized as a name of a cmdlet, function, script file, or executable program. #3087
Comments
There hasn't been a new release in several months, so unless you just upgraded it seems unlikely. There is a known issue with formatting where it seems to race the extension's file system abstraction, discussed in #2569. I suspect this is the same issue -- which also explains why you might not have hit it before. |
Can you report the output of |
dont have an integrated console??:
|
this is my settings.json {
"workbench.colorTheme": "Atom One Dark",
"window.zoomLevel": 0,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.autoSave": "off",
"files.associations": {
"*.ps1": "powershell"
},
"files.defaultLanguage": "powershell",
"editor.rulers": [
115
],
"editor.mouseWheelZoom": true,
"editor.minimap.enabled": false,
"editor.renderWhitespace": "all",
"editor.renderControlCharacters": true,
"editor.wordWrap": "wordWrapColumn",
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.tabSize": 4,
"editor.minimap.maxColumn": 115,
"editor.tabCompletion": "on",
"editor.insertSpaces": false,
"editor.detectIndentation": false,
"editor.wordWrapColumn": 115,
"terminal.integrated.fontFamily": "Consolas",
"terminal.integrated.fontSize": 14,
"terminal.integrated.lineHeight": 1,
"terminal.integrated.rendererType": "dom",
"emmet.triggerExpansionOnTab": true,
"powershell.enableProfileLoading": true,
"powershell.integratedConsole.focusConsoleOnExecute": true,
"powershell.integratedConsole.showOnStartup": false,
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationAfterEveryPipeline",
"powershell.codeFormatting.autoCorrectAliases": true,
"powershell.codeFormatting.useCorrectCasing": true,
"editor.fontFamily": "Fira Code",
"editor.fontSize": 16,
"editor.codeActionsOnSave": null,
"git.enableSmartCommit": true,
"git.autofetch": true,
"powershell.powerShellDefaultVersion": "Windows PowerShell (x64)"
} |
That's because pressing F8 when dealing with "not the PowerShell Integrated Console" just throws the text in the editor into the terminal window. With the "PowerShell Integrated Console", we do something differently (sending a message behind the scenes with the full script to make sure the full script gets run). We can do this because it's "Integrated". I'm not sure what can really be done about this behavior unless PSReadLine supported Paste Bracketing: |
Thanks for the clarification Tyler. At least I know going forward to use the integrated console and I now understand a bit better what it does in the background. 👍 |
Be sure to give that PSReadLine issue a like :) |
done 👍 |
Issue Description
I am experiencing a problem with...
else is not recognized as a name of a cmdlet, function, script file, or executable program when using the "Format Document" feature.
Format Document (creates the error)
Manual edit (now works)
BOTH of these work when run from PowerShell ISE or running the code via a normal powershell console.
vscode for some reason does not like else being on a new line.
This behaviour is the same for Windows PowerShell 5.2 and PowerShell 7.1.0
I use Format Document for all my scripts and I've never run into this issue with 'else' previously so do not know if this is a new bug introduced recently??
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: