Skip to content
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

Test: Terminal shell integration #141339

Closed
3 tasks done
Tyriar opened this issue Jan 24, 2022 · 7 comments
Closed
3 tasks done

Test: Terminal shell integration #141339

Tyriar opened this issue Jan 24, 2022 · 7 comments

Comments

@Tyriar
Copy link
Member

Tyriar commented Jan 24, 2022

Refs: #133084

Complexity: 5

Authors: @Tyriar, @meganrogge

Create Issue


The terminal now features "shell integration" with the opt-in setting terminal.integrated.enableShellIntegration. The basics of this feature is that it runs a script in your shell of choice and injects invisible sequences at key points to tell the terminal about certain things, like where the prompt, command, output starts and what the current working directory (cwd) is. Shell integration activates by injecting arguments into the profile while it is starting up, you can view these injected arguments by looking for terminalInstance#ctor in a trace log.

Since a shell script needs to be written on a shell-by-shell basis, only the following are currently supported:

  • Windows
    • pwsh (6+, not "Windows PowerShell")
  • Linux/macOS
    • pwsh
    • bash
    • zsh

Currently these new insights into what's happening within the shell are used in the following features:

  • New command: Run Recent Command, running this after a terminal command executed is the easiest way to tell if shell integration is working
    • This command has a button on the right to open the command's output in the editor
  • New command: Terminal: Go to Recent Directory
  • Current working directory detection on Windows (this only worked on non-Windows before), this drives the following:
    • The terminal.integrated.splitCwd setting
    • Links in the terminal are resolved relatively against the current working directory
  • Clicking links in the terminal now resolve the links relatively to whatever cwd the command they're contained within. For example if you cd into a new directory, any links clicked below that will resolve against the new directory and any above that will use the old directory.
  • The old commands Select/Scroll to Previous/Next Command now use shell integration if it's available, otherwise they fallback to the old mechanism (which assumed it was a command anytime you press enter when the cursor was in the 3rd column or beyond)

Test the feature on each of the shells assigned to your platform. Some things to try:

  • Does shell integration activate?
  • Install a special prompt and see if shell integration still works, if not does it fail gracefully?
  • Test the new features above
  • Does the hover for your terminal tab show information about shell integration?
  • Turn off shell integration and try the features, do they work as expected?

Here are some of the main limitations you may hit while testing:

@DonJayamanne
Copy link
Contributor

it is starting up, you can view these injected arguments by looking for terminalInstance#ctor in a trace log.

@Tyriar

  • How do I enable trace logs? And I'm assuming the logs are in the Remote Server output panel, is that correct (FYI using WSL)

  • I'm on WSL, and run recent command doesn't do anything for me
    No buttons to the right of the command either
    image

  • Similarly Terminal: Go to Recent Directory and Select/Scroll to Previous/Next Command do nothing

  • FYI using !! i can see the last executed command in the terminal

Am I running into these issues because of WSL? or just not doing something correctly

@meganrogge
Copy link
Contributor

meganrogge commented Jan 26, 2022

  • How do I enable trace logs? And I'm assuming the logs are in the Remote Server output panel, is that correct (FYI using WSL)

In the command palette, Set log level -> trace

Yes that is correct re the output panel

@meganrogge
Copy link
Contributor

Can you please include a screen shot of the terminal @DonJayamanne and actually instead set the log level to debug to see if there are capabilities getting added? It should say something like:

terminalInstance added capability

@Tyriar
Copy link
Member Author

Tyriar commented Jan 26, 2022

@DonJayamanne there might be a problem with a linux terminal on a window backend, we can follow that up in an issue. I haven't tested it in WSL yet, only the test resolver.

To clarify, for the Linux test item we would prefer to get coverage on a real linux local window.

@DonJayamanne
Copy link
Contributor

coverage on a real linux local window.

Don't have this, will try to get someone else to take this test item then.

ight be a problem with a linux terminal on a window backend, we can follow that up in an issue.

Thanks, will file an issue for that #141599

@Tyriar
Copy link
Member Author

Tyriar commented Jan 26, 2022

@DonJayamanne on the tools website it says your only platform is Linux which you should fix up then (to just Windows?) since Linux there means Linux UI.

@DonJayamanne
Copy link
Contributor

Oh, thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants