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

VSCode PowerShell Preview PSES no longer shows history from previous F8/F5 command in buffer #3683

Closed
5 tasks done
brwilkinson opened this issue Nov 9, 2021 · 13 comments · Fixed by PowerShell/PowerShellEditorServices#1823 or PowerShell/PowerShellEditorServices#1841
Assignees
Labels
Area-Extension Terminal Issue-Enhancement A feature request (enhancement).

Comments

@brwilkinson
Copy link

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

The current behavior of the PowerShell Extension is to show the history in the Terminal after using F5 or F8

  • This is available with the up arrow to re-execute the previous command; however this is missing in the current preview.

Typo on my video: "Up arrow does not show history"

There are also some artifacts and clearing of the screen when executing the second command, however I didn't open this issue for that.

Cannot_See_History_with_UpArrow.mp4

issue starts at 30 seconds onwards.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.2.0-preview.10
PSEdition                      Core
GitCommitId                    7.2.0-preview.10
OS                             Microsoft Windows 10.0.22499
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

1.62.0
b3318bc0524af3d74034b8bb8a64df0ccf35549a
x64

Extension Version

Steps to Reproduce

run a command from the script pane with F8
watch it execute
Go to the terminal and press the up arrow, the previous command is not in the buffer
It is shown in the history

Visuals

video is above, you can skip to 30 seconds.

Logs

No response

@SeeminglyScience
Copy link
Collaborator

It's shown in Get-History but not PSReadLine history. Basically PSConsoleReadLine.AddToHistory(string) needs to be called somewhere.

@andyleejordan andyleejordan self-assigned this Nov 10, 2021
@andyleejordan andyleejordan added this to the Committed-vNext milestone Nov 10, 2021
@MartinGC94
Copy link
Contributor

Some people actually want this behavior: #2307 so this should get turned into an option. I personally use F8 to load functions or run other big sections of code so when I press arrow up and my entire console gets filled up with a function definition I get annoyed.

@StevenBucher98 StevenBucher98 added Feature: VS Code Request to use or implement a VS Code feature. and removed Needs: Triage Maintainer attention needed! labels Nov 16, 2021
@andyleejordan
Copy link
Member

I think @MartinGC94 is right and this should be configurable, moving to consideration milestone.

@andyleejordan andyleejordan added the Bug: Pre-release Bugs reproducing only in the pre-release extension. label Jan 20, 2022
@andyleejordan andyleejordan moved this to Todo in Sea Biscuit Jan 20, 2022
@andyleejordan
Copy link
Member

This might get a little messy. Someone tell me what the want the setting name to be 😂 the whole subblock of settings under powershell.integratedConsole are all client-side settings, so while this is kind of for the integrated console, since it would be the first server-size setting it would mean adding a bunch of boiler plate if we want it there. What about just powershell.includeEvaluateInHistory with a default of false?

@brwilkinson
Copy link
Author

brwilkinson commented Feb 1, 2022

Ignoring the naming of the setting... 🙂for now.

I was thinking of optional different behaviors, i likely should have mentioned this before.

Also I was trying to think back to ISE behavior.

Here are a few more considerations or options of how code might be executed/presented. I am not sure what work has already been done etc or if this fits with this work?

  1. you have an unsaved or saved script and you select/highlight some code or just have the cursor on the line and you run F8
  2. you have an unsaved script file e.g. ps1 open and you press F5
  3. you have a saved PS1 and you press F5.

What is the expectations.... I would tentatively say for the options listed the outcome might be (assuming the new setting is true)

  1. I would see the text in the output or at least if I up arrow or execute history the whole command would be there
  2. in ISE it forces you to save, I have autosave in vscode as well, so for me this becomes the same as option 3.
    • I didn't test disabling auto save, maybe this becomes the same as option 1 if unsaved?
  3. in ISE it just puts the path to the ps1 file in the history, so up arrow allows you to invoke the script again by fully qualified path.

Sorry for the late reply on this with the extra specifications Etc.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Feb 1, 2022
@andyleejordan andyleejordan moved this from Todo to In Progress in Sea Biscuit Feb 3, 2022
@andyleejordan
Copy link
Member

Because this is going to require some amount of designing and a new API (the setting to control it), while we want to fix it eventually, this regression is probably going to make it's way into the stable channel so we can evaluate more user feedback and prioritize it as necessary.

@andyleejordan andyleejordan removed Needs: Maintainer Attention Maintainer attention needed! Feature: VS Code Request to use or implement a VS Code feature. labels Feb 9, 2022
@andyleejordan andyleejordan moved this to Todo in Sea Biscuit Feb 23, 2022
@andyleejordan andyleejordan moved this from Todo to Punted in Sea Biscuit Feb 23, 2022
@andyleejordan andyleejordan moved this from Punted to Wishlist in Sea Biscuit Mar 15, 2022
@andyleejordan andyleejordan moved this from Wishlist to Punted in Sea Biscuit Mar 15, 2022
@andyleejordan andyleejordan added Area-Extension Terminal Issue-Enhancement A feature request (enhancement). and removed Issue-Bug A bug to squash. Bug: Pre-release Bugs reproducing only in the pre-release extension. labels May 6, 2022
@ruudhanegraaf
Copy link

ruudhanegraaf commented May 7, 2022

It looks likes this change has made it into the stable channel. :-(
This is extremely annoying behavior. When writing scripts, a lot of us execute the selection using F8, and when you get an error, you recall the command in the terminal window using the cursor and change it until you've found the correct syntax.

The previous behavior was one of the things I really liked in VSCode compared to ISE.

Please revert this change until you've made it configurable. :-(

@SydneyhSmith SydneyhSmith moved this from Todo to P0 - Todo in American Pharoah May 9, 2022
@brwilkinson
Copy link
Author

It's been a while since we chatted over this experience. We had too many options to consider and it was difficult to select one in time.

I do miss having the command history.

I figured I would see if there were any decisions that we needed to make over this? Seems since this shipped, it's now breaking change in both directions, so we will need a configurable setting, default to the current behavior for now, then people can opt back into getting the history shown?!

I will just add (again), An optional experience that I like is, that If you press F5, it can just place the dot sourced script file path in the history, that way up arrow you can invoke the script by path. However if the file was not saved, it's basically F8 behavior that it just pastes the command in the history and up arrow shows the whole buffer of the previous command.

So not sure on others' opinions or preferences on that?

@andyleejordan
Copy link
Member

andyleejordan commented May 18, 2022

Seems since this shipped, it's now breaking change in both directions, so we will need a configurable setting, default to the current behavior for now, then people can opt back into getting the history shown?!

Oops... @SeeminglyScience I think we should change it back to the old setting until we have it be configurable, what do you think?

If you press F5, it can just place the dot sourced script file path in the history, that way up arrow you can invoke the script by path.

Ugh, ok, it gets put in PowerShell's history e.g. Get-History but not in PSReadLine's. I remember now, and it was annoying to fix. We'll investigate.

@andyleejordan
Copy link
Member

Please revert this change until you've made it configurable. :-(

Sorry, I think I went to revert it and discovered it was much harder to do than expected after the pipeline rewrite because of this:

It's shown in Get-History but not PSReadLine history. Basically PSConsoleReadLine.AddToHistory(string) needs to be called somewhere.

@AvrumFeldman
Copy link

I agree with @ruudhanegraaf, this was one of the features I loved from vscode vs ise. A lot of times I run my initial command in the editor and then modify it in the console after by pressing up. I was hoping there can be at least an optional setting for this.

@brwilkinson
Copy link
Author

Didn't realize just how much productivity I gained back from having commands in history.

So thankful this is back 👍🏼🙏🏼✅😎🙂

@andyleejordan
Copy link
Member

Sorry it took us so long to fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment