PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.7k stars 488 forks source link

PowerShell Preview: Weird Behavior #1727

Closed PrzemyslawKlys closed 4 years ago

PrzemyslawKlys commented 5 years ago

System Details

System Details Output

 & {"### VSCode version: $(code -v)"; "`n### VSCode extensions:`n$(code --list-extensions --show-versions | Out-String)"; "`n### PSES version: $($pseditor.EditorServicesVersion)"; "`n### PowerShell version:`n$($PSVersionTable | Out-String)"}
### VSCode version: 1.30.2 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8 x64

### VSCode extensions:
aaron-bond.better-comments@2.0.3
abusaidm.html-snippets@0.2.1
adelphes.google-search-ext@0.2.1
akamud.vscode-theme-onedark@2.1.0
AlanWalk.markdown-toc@1.5.6
alefragnani.Bookmarks@10.2.0
andrew-lis.workbench@0.1.7
auchenberg.vscode-browser-preview@0.2.5
azemoh.one-monokai@0.3.7
ban.spellright@3.0.22
batisteo.vscode-django@0.17.0
bierner.github-markdown-preview@0.0.2
bierner.markdown-checkbox@0.1.1
bierner.markdown-emoji@0.0.7
bierner.markdown-preview-github-styles@0.1.4
bierner.markdown-yaml-preamble@0.0.2
DavidAnson.vscode-markdownlint@0.23.0
DavidWang.ini-for-vscode@0.0.4
daylerees.rainglow@1.5.2
donjayamanne.githistory@0.4.4
donjayamanne.jupyter@1.1.4
donjayamanne.python-extension-pack@1.4.0
DotJoshJohnson.xml@2.4.0
dracula-theme.theme-dracula@2.15.0
dunstontc.dark-plus-syntax@0.0.149
eamodio.gitlens@9.4.1
ecmel.vscode-html-css@0.2.0
EditorConfig.EditorConfig@0.12.6
emilast.LogFileHighlighter@2.4.3
emmanuelbeziat.vscode-great-icons@2.1.46
Equinusocio.vsc-material-theme@2.6.3
esbenp.prettier-vscode@1.7.3
felixfbecker.php-debug@1.12.6
formulahendry.code-runner@0.9.6
gerane.Theme-dimmed-monokai@0.0.2
gharveymn.nightswitch@1.1.0
GlenBuktenica.unicode-substitutions@2.0.1
GrapeCity.gc-excelviewer@2.1.28
hdg.live-html-previewer@0.3.0
hnw.vscode-auto-open-markdown-preview@0.0.4
HookyQR.beautify@1.4.7
IBM.output-colorizer@0.1.2
ikappas.phpcs@1.0.5
ionutvmi.reg@0.0.2
JerryHong.autofilename@0.1.3
joaompinto.asciidoctor-vscode@2.3.2
johnpapa.winteriscoming@0.8.8
Kelvin.vscode-sshfs@1.11.2
kisstkondoros.vscode-codemetrics@1.17.4
KnisterPeter.vscode-github@0.30.1
liximomo.remotefs@0.0.13
magicstack.MagicPython@1.1.0
mariorodeghiero.vue-theme@1.1.2
mechatroner.rainbow-csv@0.8.0
mkloubert.vs-deploy@14.0.0
mkloubert.vscode-remote-workspace@0.40.0
ms-mssql.mssql@1.4.0
ms-python.python@2018.12.1
ms-vscode.csharp@1.17.1
ms-vscode.PowerShell@1.11.0
ms-vscode.PowerShell-Preview@2.0.0
ms-vsliveshare.vsliveshare@0.3.1134
ms-vsts.team@1.144.1
msjsdiag.debugger-for-chrome@4.11.1
quicktype.quicktype@12.0.46
redhat.java@0.37.0
redhat.vscode-yaml@0.2.1
robertohuertasm.vscode-icons@8.0.0
seedess.vscode-remote-editor@0.0.1
Shan.code-settings-sync@3.2.4
stkb.rewrap@1.9.1
streetsidesoftware.code-spell-checker@1.6.10
streetsidesoftware.code-spell-checker-polish@1.0.0
swyphcosmo.spellchecker@1.2.13
teabyii.ayu@0.17.0
techer.open-in-browser@2.0.0
TomasHubelbauer.zip-file-system@1.0.0
vangware.dark-plus-material@1.4.6
VisualStudioExptTeam.vscodeintellicode@1.1.2
vscjava.vscode-java-debug@0.16.0
vscjava.vscode-java-dependency@0.3.0
vscjava.vscode-java-pack@0.5.0
vscjava.vscode-java-test@0.14.0
vscjava.vscode-maven@0.14.0
WakaTime.vscode-wakatime@1.2.5
wayou.vscode-todo-highlight@1.0.4
wesbos.theme-cobalt2@2.1.6
whizkydee.material-palenight-theme@1.9.4
wholroyd.jinja@0.0.8
xaver.clang-format@1.9.0
zhuangtongfa.Material-theme@2.18.1
Zignd.html-css-class-completion@1.11.0

### PSES version: 2.0.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.17763.134
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.134
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with... filename showing up in Console window on F5/CTRL+F5

preview problem1

While when there is some content output it will be removed when it's done, when there's no content (such as the .ps1 file has only function definition) it will look like on attached gif.

PrzemyslawKlys commented 5 years ago

Similar situation is here:

image

On production PowerShell:

image

PrzemyslawKlys commented 5 years ago

This actually has a huge side effect.

Notice how this function uses scriptblock { } as a parameter and and then when uusing F5 or CTRL+F5 it takes whatever is displayed in the Terminal into tha script block (which in this case is file name). Only if use F6 (which in my case is Run Current File) it behaves as expected.

preview problem2

This makes it quite hard to work with.

SydneyhSmith commented 5 years ago

Sorry for a bit of a delayed response but I am having trouble fully understanding what is happening here. Would you mind re-phrasing what the expected behavior is and what the current behavior is. Thanks as always!

PrzemyslawKlys commented 5 years ago

What you're seeing here is few things:

image

And it will stay like that.

ili101 commented 5 years ago

Let me try to explain this more simply. This happens when "powershell.developer.featureFlags": [ "PSReadLine" ] is enabled. If you run your saved script (with F5 for example), the script path will be written to the console (as before). the only difference is that it's not adding a "line break" after writing the path.

it's not cussing any "coding problem" but a "display" one. if your code don't have any output, after the code run you will be left with your text cursor on the start of the path line so if you write something you are writhing it on the path text overwriting it. or if your code have output it will do the same thing and write it's first output line on the path line so if the output is shorter then the path you will get a line with a mix of the two strings displayed.

So the solution is just to make it line break/move to the next line after writing the path. Exactly as on a regular Powershell windows you will writhe the file path and hit enter and as a result the text cursor moves down and only then the file output starts from there.

SydneyhSmith commented 5 years ago

It looks like start without debugging needs to add a new line either after writing the file path or before output is written, thanks for reporting this!

PrzemyslawKlys commented 5 years ago

Just FYI. It's still not working correctly in 2.0.1

ili101 commented 5 years ago

Can also confirm that it is still a problem. What is the point of releasing preview 2 to us if the bugs we reported on preview 1 are not addressed?

TylerLeonhardt commented 5 years ago

@ili101 preview.2 mostly contained work on the debugger. Sadly we couldn't get to everything this time around.

sba923 commented 5 years ago

See also #1850

PrzemyslawKlys commented 5 years ago

Is there a way to disable PSReadLine? In earlier versions, it was not enabled by default. Now it is, yet this issue is not fixed so it makes it really hard for me to cope with the output it provides.

TylerLeonhardt commented 5 years ago

Yes, you can do this in your settings:

powershell.developer.featureFlags: []
TylerLeonhardt commented 4 years ago

Ok so circling back here. This issue and https://github.com/PowerShell/vscode-powershell/issues/1850 are very closely related. In fact, they may be the same bug.

The file path showing up makes sense as an indicator that you are, in fact, running the script.

What's not correct is that you should be seeing a prompt after that line, and you're not.

TylerLeonhardt commented 4 years ago

Making this a duplicate

ghost commented 4 years ago

This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.