Skip to content

PowerShell Preview: Weird Behavior #1727

Closed

Description

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.

Activity

  1. PrzemyslawKlys commented on Jan 25, 2019

    @PrzemyslawKlys
    ContributorAuthor

    Similar situation is here:

    image

    On production PowerShell:

    image

  2. PrzemyslawKlys commented on Jan 29, 2019

    @PrzemyslawKlys
    ContributorAuthor

    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.

  3. SydneyhSmith commented on Jan 31, 2019

    @SydneyhSmith
    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!

  4. PrzemyslawKlys commented on Jan 31, 2019

    @PrzemyslawKlys
    ContributorAuthor

    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.
  5. ili101 commented on Feb 5, 2019

    @ili101

    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.

  6. SydneyhSmith commented on Feb 7, 2019

    @SydneyhSmith
    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!

  7. PrzemyslawKlys commented on Mar 29, 2019

    @PrzemyslawKlys
    ContributorAuthor

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

  8. ili101 commented on Mar 31, 2019

    @ili101

    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?

  9. TylerLeonhardt commented on Mar 31, 2019

    @TylerLeonhardt
    Member

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

  10. sba923 commented on Apr 10, 2019

    @sba923

    See also #1850

  11. PrzemyslawKlys commented on Apr 13, 2019

    @PrzemyslawKlys
    ContributorAuthor

    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.

  12. TylerLeonhardt commented on Apr 13, 2019

    @TylerLeonhardt
    Member

    Yes, you can do this in your settings:

    powershell.developer.featureFlags: []
    
  13. TylerLeonhardt commented on Nov 2, 2019

    @TylerLeonhardt
    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.

  14. TylerLeonhardt commented on Nov 6, 2019

    @TylerLeonhardt
    Member

    Making this a duplicate

  15. added
    Resolution-Duplicate
    on Nov 6, 2019
  16. ghost closed this as completedon Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-PSReadLineIssue-BugResolution-Duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions