Skip to content

PowerShell Preview: Weird Behavior #1727

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

Closed
PrzemyslawKlys opened this issue Jan 25, 2019 · 15 comments
Closed

PowerShell Preview: Weird Behavior #1727

PrzemyslawKlys opened this issue Jan 25, 2019 · 15 comments
Labels
Area-PSReadLine Issue-Bug A bug to squash. Resolution-Duplicate Will close automatically.

Comments

@PrzemyslawKlys
Copy link
Contributor

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:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### 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
Copy link
Contributor Author

Similar situation is here:

image

On production PowerShell:

image

@PrzemyslawKlys
Copy link
Contributor Author

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
Copy link
Collaborator

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
Copy link
Contributor Author

What you're seeing here is few things:

  • when the script has defined a function and only that and you press F5 vscode will display filepath to Terminal

image

And it will stay like that.

  • when the script is run with F5 or CTRL+F5 PowerShell doesn't show it's running in a left bottom corner
  • when the script is run and you use a script block your output in the terminal will get mixed up with file path of an executed script
  • when the script is run it will sometimes display WARNING and other streams in weird places (like on the screenshot 2 posts up.

@ili101
Copy link

ili101 commented Feb 5, 2019

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
Copy link
Collaborator

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
Copy link
Contributor Author

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

@ili101
Copy link

ili101 commented Mar 31, 2019

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
Copy link
Member

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

@sba923
Copy link

sba923 commented Apr 10, 2019

See also #1850

@PrzemyslawKlys
Copy link
Contributor Author

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
Copy link
Member

Yes, you can do this in your settings:

powershell.developer.featureFlags: []

@TylerLeonhardt
Copy link
Member

Ok so circling back here. This issue and #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
Copy link
Member

Making this a duplicate

@TylerLeonhardt TylerLeonhardt added the Resolution-Duplicate Will close automatically. label Nov 6, 2019
@ghost
Copy link

ghost commented Nov 7, 2019

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

@ghost ghost closed this as completed Nov 7, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-PSReadLine Issue-Bug A bug to squash. Resolution-Duplicate Will close automatically.
Projects
None yet
Development

No branches or pull requests

5 participants