microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
161.9k stars 28.45k forks source link

Remove previous session history for pwsh and zsh #154377

Open Tyriar opened 2 years ago

Tyriar commented 2 years ago

For pwsh and zsh, history is flushed to the file after every command that is run and we can also parse out the commands perfectly AFAICT including new lines. Contrast this to bash which doesn't flush and doesn't retain new lines (in a regular setup).

Screen Shot 2022-07-07 at 10 04 57 am

Because of this it would be ideal if we could remove previous session history all together for pwsh and zsh to consolidate on a single source of truth. However, we only parse pwsh and zsh history a single time per window currently and if we got rid of previous session we would need to track and continually update the window's knowledge of file history. An important thing to keep in mind here is we want no pty host latency when triggering the run recent command so when do we sync the history exactly?

For bash the problem is more complicated because:

Tyriar commented 8 months ago

Code pointer to where terminal command history is maintained: https://github.com/microsoft/vscode/blob/b0d60e8e2e90bc9d7913611c176d14b8eb91b532/src/vs/workbench/contrib/terminal/common/history.ts