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

View all comments

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.

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.