0

I'd find it convenient to be able to quickly recall past commands issued in the terminal. In Matlab one can simply select any number of those from the Command HIstory panel, and reissue them in the Terminal all at once:

enter image description here

In VS Code (on Windows), I know there is a command to pull up the log text file:

(Get-PSReadlineOption).HistorySavePath

But I find this extremely cumbersome as a solution to call up multiple lines at a time. Is there an VS Code addon that creates a Matlab-like Command History panel with timestamped commands (didn't find any searching myself)? Or is such feedback taken into consideration by Microsoft?

z8080
  • 459
  • 1
  • 7
  • 19
  • Please don't tag Visual Studio for a Visual Studio Code question – phuzi Jan 04 '22 at 11:43
  • The terminal in VS Code is (usually) Powershell. Perhaps you should be looking for a Powershell solution?! – phuzi Jan 04 '22 at 11:46
  • Or perhaps if you have a common set of commands you run, did you consider writing a Powershell script? – phuzi Jan 04 '22 at 11:47
  • @phuzi sorry - fixed – z8080 Jan 04 '22 at 12:47
  • I'm not sure what to do about Powershell, I am not an advanced user and was simply wondering how to have a Command History panel. Since there's no addon for it, filing a feedback ticket with MS seems the way to go – z8080 Jan 04 '22 at 12:48

1 Answers1

1

This might help (coming to v1.64):

Terminal shell integration

The terminal now features experimental opt-in shell integration which allows VS Code to gain insights on what is going on within the terminal as it was previously a black box. When enabled using "terminal.integrated.enableShellIntegration": true, arguments to run a shell integration script will be injected into your terminal profile if possible. The script itself mostly just injects invisible sequences into your prompt, providing us with information like where the prompt, command and command output is, what the current working directory (cwd) is for each command and the exit code of each command.

Shell integration enables the following new features:

Run recent command: Since we know what commands are run, we have exposed a command that allows you to view and run them again in a quick pick.

Developer: Run Recent Command run this command from the Command Palette

run recent command image

The current shells supported are pwsh for Windows and pwsh, bash and zsh for Linux and macOS.

Although I switched to powerShell on W11 to test this feature - which should be supported - I can't get it to work just now. I wanted to see if you could pick multiple command entries in the QuickPick to run a series of them, but I doubt you can. But at least you get a nice list of recent commands.

Mark
  • 97,651
  • 19
  • 297
  • 324