terminal icon indicating copy to clipboard operation
terminal copied to clipboard

VSCode-like Shell Integration

Open heartacker opened this issue 3 years ago • 9 comments
trafficstars

Description of the new feature/enhancement

https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_69.md#shell-integration

  1. shellIntegration
  2. Command navigation
  3. run-recent-command
  4. Go to recent directory
  5. 👍

Maintainer note: I'm hijacking this issue body, for issue tracking purposes

Main elements of shell integration

  • [ ] #1595
  • [ ] #12861
  • [ ] #12863
  • [ ] #12860
  • [ ] #12859
  • [ ] https://github.com/microsoft/terminal/issues/16599
  • [ ] #14779
  • [ ] Automatic shell integration
  • [ ] https://github.com/microsoft/terminal/pull/12948
  • [ ] https://github.com/microsoft/terminal/issues/15057
  • [ ] Add horizontal seperators between commands (do we really not have this elsewhere?)
  • [ ] #14754
  • [ ] https://github.com/microsoft/terminal/issues/17493

Related, indirectly

  • #11000
  • #3121
  • #6632
  • #3337
    • I'm including this because it creates a highly-visible surface by which the CWD can be exposed.
    • Furthermore: Right-click on a region of output -> "Copy all command output"
    • Right-click -> "Rerun this command"

References

  • https://github.com/microsoft/vscode/issues/154662
  • https://github.com/microsoft/vscode/pull/171648
  • https://github.com/microsoft/vscode/commits/main/src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1

edit 2025-04-15

VsCode impl

  • This is where VsCode actually injects the args:
    • https://github.com/microsoft/vscode/blob/3a28d8d2e1044f2fe28f93076df911fd8fc9fd98/src/vs/platform/terminal/node/terminalEnvironment.ts#L114-L149
    • looks like it's mostly:
      • Is this commandline something we know how to inject our script into? If so, then inject the CLI args and environment vars
  • https://github.com/microsoft/vscode/blob/ef6f1349eb824cef6635d9a3083b871a1c5ddbdf/src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts#
  • https://github.com/microsoft/vscode/blob/ef6f1349eb824cef6635d9a3083b871a1c5ddbdf/src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.ps1#

heartacker avatar Jul 07 '22 00:07 heartacker

I'm tempted to leave this open as a megathread, linking the other things we have planned across the repo:

  • [ ] #11000
  • [ ] #1595
  • [ ] #12861
  • [ ] #12863
  • [ ] #3121

zadjii-msft avatar Jul 07 '22 11:07 zadjii-msft

Also https://github.com/microsoft/terminal/issues/6632

WSLUser avatar Jul 08 '22 13:07 WSLUser

I actually intentionally omitted #6632 from that list. #6632 is more about an autocomplete menu who's contents are populated based on the words that are currently in the buffer. The rest of these VsCode features are more driven by specific metadata in the prompt to indicate things like the CWD, the command that's run, where the prompt is, etc. One is something exclusively powered by the terminal, the other is powered by a cooperating shell/commandline program.

It's definitely related, but not necessarily "shell integration" 😄

zadjii-msft avatar Jul 08 '22 14:07 zadjii-msft

Kitty also has shell integration for various shells. But seems to really intermingle with shells in a way that Iterm2 does not. Wezterm is also looking to implement Iterm2 shell integration from what I saw but nothing has come of that yet other than implementing OSC 7 quite awhile ago.

WSLUser avatar Jul 08 '22 15:07 WSLUser

iTerm also has a really cool password manager that integrates with 1Password for example

Stanzilla avatar Jul 28 '22 02:07 Stanzilla

VS Code has now enabled its shell integration by default in 1.70.

segevfiner avatar Aug 04 '22 23:08 segevfiner

I know it's trivial but I really like the command decoration circles too...

khuongduybui avatar Aug 14 '22 15:08 khuongduybui

And copy entire command's output!

khuongduybui avatar Aug 14 '22 15:08 khuongduybui

fhl-task-pane-expando-000

in dev/migrie/fhl/tasks-pane


Local tasks .wt.json wt.json actions

Since these notes seem to be no where else:

  • 58f7f0e8368cb868aa84a5a45c14e05a53f9c1a9 seems to be the last commit for local tasks / suggestions.
  • 4def21a looks like it did all the actual business
  • there's a test file in 0c68bd1778595dba9f42605a8f7347d86825fcc3

zadjii-msft avatar Feb 16 '24 21:02 zadjii-msft