r/PowerShell • • Mar 05 '20

Visual Studio Code for PowerShell 7

https://devblogs.microsoft.com/powershell/visual-studio-code-for-powershell-7/
187 Upvotes

14 comments sorted by

7

u/new-fantomas Mar 05 '20

Is it possible to turn PSReadline history on and and off? When I run the selection in VS Code with F8 the entire selection is saved into PSReadline history. I would like only the commands that I run from prompt to be saved into history.

7

u/rjmholt Mar 06 '20

I don't think there's a way to do that currently, but if you open a feature request we could add it!

3

u/Thotaz Mar 06 '20

There is already a feature request for it here: https://github.com/PowerShell/vscode-powershell/issues/2307

4

u/chinpokomon Mar 06 '20

You could introduce this yourself.

In VSCode, there is an environment variable TERM_PROGRAM with a value of "vscode." In your $profile, you could look for the existence of this variable and set PSReadline's HistorySavePath option to something temporary. It should restore to the default when not running within VSCode, but I make that statement untested.

3

u/Insidii Mar 06 '20

In the new version for VSCode integrated terminal, I am now getting a constant line break between command execution, how do I stop this?

2

u/perogy1 Mar 06 '20

I've been trying to figure that one out as well, to make it work like in ISE.

2

u/Insidii Mar 09 '20

Worked out where the issues probably is but no idea how to fix it. The problem is in PSReadLine module and how VSCode passes it to the terminal. Similar issues reported in the following issues:

https://github.com/PowerShell/PSReadLine/issues/901

https://github.com/PowerShell/PSReadLine/issues/959

https://github.com/PowerShell/PSReadLine/issues/291

I'm guessing it's the VSCode teams fix to avoid being impacted by this issue.

2

u/overlydelicioustea Mar 06 '20

finally, the integrated console doesnt seem to suck so far.

3

u/logicalmike Mar 06 '20

I truly hope this solves the severe reliability issues, but it seems we're told they have been "really fixed this time" every 6 months.

With ISE becoming less and less fashionable, we need these issues fixed asap.

1

u/halbaradkenafin Mar 06 '20

If they aren't fixed then make sure to log an issue with screenshots and replication steps. Then jump on the preview version of the extension so that you get the fixes every month.

1

u/f3lckern Mar 06 '20

THX! Was looking for this Yesterday 🙃