Skip to content

Prompt incorrectly indented after debugger run #2407

Closed
PowerShell/PowerShellEditorServices
#1162

Description

System Details

System Details Output

### VSCode version: 1.41.1 26076a4de974ead31f97692a0d32f90d735645c0 x64

### VSCode extensions:
[email protected]


### PSES version: 2.0.0.0

### PowerShell version:

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

Issue Description

  1. Launch VSCode

  2. Close any open files.

  3. Close VSCode.

  4. Lauch VSCode.
    The console looks like:
    image

  5. Open a very basic .ps1 file from a saved workspace.
    image
    The console changes to "PowerShell integrated console"
    image
    However, the console (terminal or whatever you're calling it these days) is blank.
    (Please note, PowerShell Preview extension is installed. I have reported the notification bug in The 'PowerShell' extension is recommended for this file type #2406 )

If I scroll up, I can see your ASCII art:
image
There is no prompt. (C:\>). I have to press enter to get a prompt.

  1. Set focus to the script window.
  2. Press f5 to run the script.
    image
    As you can see, indentation and output are all over the place. Lines merged and strange indentation.
    Even when the output isn't so mangled, the output still starts after the prompt (C:\ >) as opposed to ISEs behaviour where it is on its own line:
    image

Expected Behaviour

What I want to see is an output like ISE.
image
The output is on a new line, at the start of the line with no indentation and the prompt is clean, on a new line waiting for the next command.

Actual Behaviour

See "Issue description".
This behaviour isn't something new. It's been happening for ~12 months or more. In both the current and preview version of the PowerShell extension. It's finally annoyed me enough to write this.

I've also noticed other spurious behaviour. For instance, I can start typing in the console and it starts at some random position in the previous output, not after the C:\ > (greater-than symbol) as one would expect.

This behaviour happens on multiple PCs and laptops. The examples above have been taken from a laptop freshly installed today, with Windows 10 Enterprise 1909.

Attached Logs

Follow the instructions in the troubleshooting docs
about capturing and sending logs.

Activity

  1. ghost added
    Needs: Triage
    on Jan 10, 2020
  2. rjmholt commented on Jan 10, 2020

    @rjmholt
    Contributor

    Thanks for opening this issue Arcotek Limited (@arcotek-ltd).

    I can see your ASCII art

    That's been changed in PowerShell/PowerShellEditorServices#1141. From next release we'll just have a small indication in the Integrated Console to let you know you're not in ordinary PowerShell. This will be disablable with a VSCode setting.

    There is no prompt. (C:>). I have to press enter to get a prompt.

    This is a Windows-specific terminal bug that we haven't been able to reproduce ourselves. The latest VSCode release has had some issues in the terminal layer which have impacted the Integrated Console experience in particular unfortunately.

    As you can see, indentation and output are all over the place. Lines merged and strange indentation.

    I've seen the particular rogue indentation you have in the screenshot there too. Hopefully we can address that soon, similar to PowerShell/PowerShellEditorServices#1097, but it hasn't been as high priority as the functional bugs we've been working on recently. Due to the way running scripts and running prompts work, this can be a tricky problem to solve, so it's something we're gradually solving.

    Do you have other cases where the indentation is wrong you can share? That was the only case I saw in your issue.

    Even when the output isn't so mangled, the output still starts after the prompt (C:\ >) as opposed to ISEs behaviour where it is on its own line:

    This is for you to set in your prompt function, which you can define in your $profile. The PowerShell extension tries not to have opinions or force settings onto users, since what looks good to some does not to others. Instead you're free to define your own prompt in the $profile. The current prompt is the default for PowerShell. Please note that the PowerShell extension's $profile lies on a different path to those of PowerShell and the ISE, but you can also define a $profile for all hosts if you prefer a unified experience ($profile.CurrentUserAllHosts).


    We've been working recently on the functional bugs in the lead up to the PowerShell 7 release. After that, and hopefully with a fix in VSCode/Windows for the recent UI issues, I'm hopeful we can address some of the cosmetic issues.

    Of the four issues you raise here, hopefully one is resolved instantly for you and one will be resolved in the next release. The console prompt not appearing is a nebulous issue that we've been trying to identify the cause of in #2014, but is very dependent on lower layers like xtermjs, VSCode and Windows. That leaves the indented prompt after run, which, to keep this issue cohesive so that it represents a work item for us, I'll use as the ongoing focus for this issue.

  3. changed the title [-]PowerShell Integrated Console output is a mess.[/-] [+]Prompt incorrectly indented after debugger run[/+] on Jan 10, 2020
  4. rjmholt commented on Jan 10, 2020

    @rjmholt
    Contributor

    Issue likely introduced in PowerShell/PowerShellEditorServices#1097

  5. added
    Issue-Bug
    and removed
    Needs: Triage
    on Jan 10, 2020
  6. TylerLeonhardt commented on Jan 10, 2020

    @TylerLeonhardt
    Member

    Actually, I think this might be the same issue as #2408

  7. ghost added
    Needs: Maintainer Attention
    on Jan 10, 2020
  8. TylerLeonhardt commented on Jan 11, 2020

    @TylerLeonhardt
    Member

    The history was introduced with PSReadLine. PSReadLine involved quite a massive change to the PowerShell extension.

    Totally hear the frustration, we're working hard on trying to stabilize the PSReadLine support so it can replace the current stable extension.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions