Skip to content

PSReadLine Command History is not saving to the HistorySavePath location #2086

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

Closed
stevenjudd opened this issue Jul 14, 2019 · 4 comments
Closed
Labels

Comments

@stevenjudd
Copy link

System Details

System Details Output

### VSCode version: 1.36.1 2213894ea0415ee8c85c5eea0d0ff81ecc191529 x64

### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


### PSES version:

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.17134.858
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.858
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with the PSReadline HistorySavePath file. First, it is not saving the command history to the defined file location.

Second, it would be preferred to have the default file name to not have white space characters in the name. Thus "Visual Studio Code Host_history.txt" would be "VisualStudioCodeHost_history.txt"

Third, the Set-PSReadlineOption -HistorySavePath command does not seem to save the path for the history file.

Expected Behaviour

The file specified in the HistorySavePath should be created and should contain the commands entered into the Integrated Console.

Actual Behaviour

The file is not created and the command history is not stored in this file.

Attached Logs

vscode-powershell.log
EditorServices.log
Start-EditorServices-EditorServices.log

@SydneyhSmith
Copy link
Collaborator

Thanks @stevenjudd for opening this issue, you have some very valid concerns.

First, it is not saving the command history to the defined file location.

It looks like you are using the PowerShell extension, rather than the PowerShell Preview extension which unfortunately is the only place where PSReadline support is available in VSCode, we are tracking this issue with #1793

Second, it would be preferred to have the default file name to not have white space characters in the name. Thus "Visual Studio Code Host_history.txt" would be "VisualStudioCodeHost_history.txt"

This is a result of PSReadLine using the host name to create this file path--changing our host name would be a substantial breaking change so we are unlikely to update this, although we agree it would be nicer to not have white spaces.

@rjmholt
Copy link
Contributor

rjmholt commented Jul 16, 2019

FYI our host name is defined here. It imitates the ISE's host name, which is Windows PowerShell ISE Host.

@SeeminglyScience
Copy link
Collaborator

SeeminglyScience commented Jul 17, 2019

As a work around, you can put this in your profile (still requires the preview version of the extension):

if ($psEditor -and (Get-Module PSReadLine)) {
    $currentSavePath = (Get-PSReadLineOption).HistorySavePath
    Set-PSReadLineOption -HistorySavePath $currentSavePath.Replace($Host.Name, 'ConsoleHost')
}

@ghost
Copy link

ghost commented Aug 10, 2019

This issue is being closed as inactive, if this issue is still occurring it will be re-opened

@ghost ghost added the Resolution-Inactive Will close automatically. label Aug 10, 2019
@ghost ghost closed this as completed Aug 10, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants