Vscode-powershell: Interactive console does not provide command history in debugger

Created on 15 Mar 2017  ยท  48Comments  ยท  Source: PowerShell/vscode-powershell

System Details

  • Operating system name and version: Windows 7 (64-Bit)
  • VS Code version: 1.10.2
  • PowerShell extension version: 0.10.0
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.0.10586.117
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.10586.117
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When executing commands in the integrated terminal, the up and down arrows on the keyboard to browse through command history do not work.

For example:

  1. Execute a command such as Get-Item
  2. When the command is finished, I would expect to be able to press the up arrow on the keyboard and have Get-Item re-appear as the command to run. Instead, the command input remains blank.
Issue-Bug

Most helpful comment

Any update on the issue? As I'm sure everyone agrees this is a pain when debugging.

All 48 comments

Are you typing in the command or using F8 to execute it? What is the output of the Get-History command? History should be working for you.

Sorry missed some information. This is only an issue while debugging when a breakpoint is hit and commands are being manually entered via the terminal.

Thanks! I'll check on that.

Definitely a bug here. I'll fix it when I overhaul command history in a few days.

This is a pain, typing the commands again and again on the interactive console while debugging. Hoping this gets fixed soon.

Any update on the issue? As I'm sure everyone agrees this is a pain when debugging.

I've been trying to use VSCode for my day-to-day PowerShell needs, but this issue really hinders how fast I can be when debugging code.

same here, trying to switch to vscode, but this makes it very painful. I use this ALL THE TIME, when debugging scripts!

Me too - loving vscode but the ability to use the interactive console whilst debugging at a breakpoint is massively hindered because of this bug :( It's the only thing really stopping me from jumping full swing into vscode.

Yes, I thought I would be able to say bye to ISE, but this is really a showstopper!

@daviwil What's the status on this issue? Is this being blocked by a bigger issue and the team is still debating how to approach it or is it just a question of finding time?

Basically does it make sense for me to spend some time and see about implementing this feature currently?

@SeeminglyScience has a fix for this, we just need to do a bit of verification work before merging it.

Oh I didn't realize that the commit was the entire fix, nice.

I'm assuming there's not really any good way in which someone with no experience with the code can help with the verification work necessary? Would really love to see this issue fixed sooner than later, so if there's a way to help please tell.

Same here: if there's a way to get a build with that fix in, I'd be delighted to test that!

Me, three. If I can help accelerate a fix, please let me know how I can help. I've worn the paint off my up-arrow key sitting there stupidly hitting it over and over and over again to no avail.

I am in the same boat, I'm looking at switching to VSCode from ISE. (for the GIT integration)

This thread made it sound like there was a fix, but unless I am missing something it does not appear it's made it's way to VSCode yet.

@moymike yeah it hasn't made it to release yet. The fix is adding support for PSReadLine which is mostly done, but it's a huge change. Sorry for the delay, been getting side tracked with other projects.

@SeeminglyScience Thanks for the update. I sympathize with "huge changes". :-)

Any chance the fix to PSReadLine will contain support for $host.PrivateData, which is blank in VSCode.

($host.PrivateData allows control of text color for warnings, verbose, debug, etc)

@moymike Nah that's unrelated. Looks like a quick fix though. I'll take a crack at it this weekend.

Plus one.

And bump.

This missing feature is really annoying. Any ETA?

It is _so_ annoying. Plus F11 in a debug session seems to be broken as well.

As long as you're on Windows 5.x or PowerShell Core - this fix in in the works. That fix is to integrate PSReadLine 2 into PSIC which will bring history support. Unfortunately, Windows PowerShell v3/4 are not supported by PSRL 2.

See https://github.com/PowerShell/vscode-powershell/issues/535#issuecomment-363571191 for details

pwsh 4? pwsh 3?? I never knew you. Seriously, fixing this would be a great incentive to get to pwsh 5.1.

+1
I would even offer to fix a PSSA issue of your choice in exchange for getting this fixed.

@bergmeister careful now, my price is steep ๐Ÿ˜‰ (PowerShell/PSScriptAnalyzer#850)

@SeeminglyScience Phew, I'm glad you did not pick one of the many PSUseDeclaredVarsMoreThanAssignments issues that all require a re-write of the rule...
Jokes aside, I think your referenced issue is really important because it is a blocker for many people. I had it already in the back of my mind to look at it but you confirmed that it really needs to be investigated and hopefully properly fixed.

+1
SeeminglyScience has a commit ready since October 2017, but it seems that commit is just the tip of the iceberg. Anyways, would be really good with an ETA, as this issue prevents me from using VS Code with PowerShell.

+1

Really am looking forward to seeing when the update is made to support
this, As love vscode but have to resort back to ISE for basic debugging in
pwsh :(

On Mon, 26 Mar 2018 at 10:48, Sharken03 notifications@github.com wrote:

+1
SeeminglyScience has a commit ready since October 2017, but it seems that
commit is just the tip of the iceberg. Anyways, would be really good with
an ETA, as this issue prevents me from using VS Code with PowerShell.

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/PowerShell/vscode-powershell/issues/550#issuecomment-376109446,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQYljh79JH47-0AZy6yJSVZM7lL0B038ks5tiLlygaJpZM4MeCh8
.

Any update on general availability for this fix yet? I am also in the group who want to drop the ISE but find this issue a show-stopper.

@WaynePlummer Current core work for it is happening in this PR: https://github.com/PowerShell/PowerShellEditorServices/pull/672
But it might take some time afterwards for a release of the vscode-powershell, which is probably going to be of version 2 due to breaking changes (PowerShell versions before 5 will not be supported any more)

I generally debug code in the ISE for this reason. This is my last reservation.

@bergmeister
Thanks for the link to the pull request 672, now i am wondering if comments to that pull request should go on that thread or on this current thread.
Opting for the last choice, i have made the following observations:

  • Starting a debug session with F5 should set focus to the editor window and not the terminal window. CTRL + 1 will return you to the editor window.
  • It feels like a workaround to use F8 in order to move from editor window to the terminal window. But in practice it gets the job done.

@Sharken03, thanks for the feedback! Definitely leave comments on the PR so that we can address them.

As for your current comments, can you try setting powershell.integratedConsole.focusConsoleOnExecute to False and see if that accomplishes what you want?

@tylerl0706
With focusConsoleOnExecute set to False, the focus is set to the editor window. But now F8 will not set focus to the Terminal window, as that behavior is also controlled by focusConsoleOnExecute. Guess i will have to find another shortcut for setting focus to the terminal window.

Update:
Following the idea outlined on Stackoverflow, you can have a toggle to switch between editor window and the terminal. Note that if you are not using an english keylayout, then it is better to use CTRL+K CTRL+K, to let VS Code tell you what key that corresponds with.

Here are a couple of keyboard shortcut customizations I use that you might find helpful:

  { "key": "ctrl+`",          "command": "workbench.action.focusActiveEditorGroup",
                                 "when": "!editorFocus" },
  { "key": "ctrl+`",          "command": "workbench.action.terminal.focus",
                                 "when": "!terminalFocus" },
  { "key": "ctrl+shift+q",    "command": "workbench.action.toggleMaximizedPanel" },

Just updated everything today and saw this feature is still missing. +1 ! ๐Ÿ™

Soon โ„ข ๐Ÿ˜‰

The PSReadLine PR is almost done.

Any ETA yet on this bug fix being released?

Struggling from the same problem since started to use VS Code for Powershell coding :( Up arrow just doesn't populate any last command entered in debugger. Guys any news when it can be fixed?

There's a preview build available to address this that you can find here: https://github.com/PowerShell/vscode-powershell/issues/535#issuecomment-418944258

Please give it a try -- it's a pretty significant feature, so if you hit any problems please open an issue :)

I'm running 1.9.0 on VScode 1.27.2 (Windows, PowerShell 5.1), and still no history when debugging...

Am I missing something?

P.S. I do have the "PSReadLine" feature flag set.

@sba923 Yeah, it's in the 2.0 which isn't released yet. There's a preview build in this comment if you'd like to help test though ๐Ÿ™‚

IIRC I tried that vsix when it was announced in this thread, but it didn't work, and someone commented it can't work with PowerShell 5.1, only with PowerShell 6.x. Do you concur?

The latest build in that comment thread works with Windows PowerShell. There is still an extension command bug in it which is fixed upstream, but we're currently getting all the fixes in 1.9.0 into 2.0.0 so we can get an up-to-date AppVeyor build going โ€” that way you won't need to pull from a comment.

With the PSReadline integration done in PowerShell/PowerShellEditorServices#672, i really hope version 2.0 is out soon as it is a really great improvement to VS Code.

Closing as PSReadLine is now available in the PowerShell Preview extension, tracking that PSReadLine is not available in the main PowerShell Extension here #1793

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bgelens picture bgelens  ยท  3Comments

rkeithhill picture rkeithhill  ยท  3Comments

keposet picture keposet  ยท  3Comments

guidooliveira picture guidooliveira  ยท  3Comments

daviwil picture daviwil  ยท  3Comments