Skip to content
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

Prompt incorrectly indented after debugger run #2407

Closed
arcotek-ltd opened this issue Jan 10, 2020 · 5 comments · Fixed by PowerShell/PowerShellEditorServices#1162
Closed

Comments

@arcotek-ltd
Copy link

arcotek-ltd commented Jan 10, 2020

System Details

System Details Output

### VSCode version: 1.41.1 26076a4de974ead31f97692a0d32f90d735645c0 x64

### VSCode extensions:
ms-vscode.powershell-preview@2019.12.0


### 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.

@ghost ghost added the Needs: Triage Maintainer attention needed! label Jan 10, 2020
@rjmholt
Copy link
Collaborator

rjmholt commented Jan 10, 2020

Thanks for opening this issue @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.

@rjmholt rjmholt changed the title PowerShell Integrated Console output is a mess. Prompt incorrectly indented after debugger run Jan 10, 2020
@rjmholt
Copy link
Collaborator

rjmholt commented Jan 10, 2020

Issue likely introduced in PowerShell/PowerShellEditorServices#1097

@SydneyhSmith SydneyhSmith added Area-Extension Terminal Issue-Bug A bug to squash. and removed Needs: Triage Maintainer attention needed! labels Jan 10, 2020
@TylerLeonhardt
Copy link
Member

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

@arcotek-ltd
Copy link
Author

Thank you @rjmholt for your reply.

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

I regularly see this so I'll try and capture more examples when I see them.

IMHO, things in this area seem to have been getting steadily worse over time. Whether that is Windows 10 updates, VSCode or the PowerShell extension, I cannot say. I thought I was going made over the Split-Line issue (#2408) and it got to me enough, to report some of the frustrations with VSCode and the PS extension.

One of the features of ISE that was not ported across was the ability to use doskey (command history) and IntelliSense in debug mode. To me, these are quite basic requirements, so much so, the first time I ran into the issue, I thought it was me. After all this time, I find it amazing they are still not available in the master branch of the PS extension, hence why I use the "preview" version and have this in settings.json:

"powershell.developer.featureFlags": [
        "PSReadLine"
    ], 

I'll play with the prompt to get it right. This might clean up some of the output issues. Thanks for the tip.

@TylerLeonhardt
Copy link
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants