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 Environment Proposed API #241722

Closed
3 tasks done
anthonykim1 opened this issue Feb 24, 2025 · 4 comments
Closed
3 tasks done

Test: Terminal Shell Environment Proposed API #241722

anthonykim1 opened this issue Feb 24, 2025 · 4 comments

Comments

@anthonykim1
Copy link
Contributor

anthonykim1 commented Feb 24, 2025

Refs: #227467

Complexity: 5

Create Issue


Thanks in advance for testing.
I've rated this as complexity 5 due to having to cover multiple shells, but should not be technically challenging to test.

Background Information

There are times where extensions would like to know user's environment information. Meaning list of user's environment variable from various places (including shell specific init scrip such as .zshrc, etc).
I've been working on adding a proposed API here to expose such information from core => extension.

Last month, we had a TPI to test initial version of this proposed API but only for Powershell: #238896

There has been change to the API shape since then (added an isTrusted field), and addition of support for of zsh, bash, fish as well.


Setup

  1. Make sure to enable proposed api terminalShellEnv on extension/code of your choice
  2. Bring/Create extension of your choice where you can subscribe for terminal.shellIntegration event. (onDidChangeTerminalShellIntegration)
  3. Make sure you have shell integration setting enabled: terminal.integrated.shellIntegration.enabled

Testing

For MacOS and Linux:

  • Test for: pwsh, zsh, bash, fish

For Windows

  • Test for: pwsh, gitbash, fish
  1. Make sure you are listening to window.onDidChangeTerminalShellIntegration.
  2. The new proposed API and env (environment variables object) should be available via terminal.shellIntegration.env. Note there is two field for env, which are:
    • terminal.shellIntegration.env.value should get you all of the environment variables
    • terminal.shellIntegration.env.isTrusted(This should be true for pwsh, bash, zsh, and false for fish)
  3. Create terminal, watch environment variables. Try putting some env vars in your shell init scripts and see if they show up in the list of environment variables.
  4. Try setting environment variable directly in your terminal. Make sure you are getting updated variable show up
  5. Try deleting/unsetting the environment variable. Make sure you are NOT seeing the deleted/unsetted environment variable.
  6. This API is enabled by true in default in insiders via setting terminal.integrated.shellIntegration.environmentReporting Try turning this off to see that you dont get the env object.
@amunger
Copy link
Contributor

amunger commented Feb 25, 2025

fyi fish is not listed as supporting shell integration on Windows

Image

@amunger
Copy link
Contributor

amunger commented Feb 25, 2025

Looks like that's just because fish isn't really available for windows except maybe through WSL

@amunger amunger removed their assignment Feb 25, 2025
@anthonykim1
Copy link
Contributor Author

Yeah, maybe we could add a WSL section, but not too sure since there are already linux section

@karthiknadig
Copy link
Member

Only fish is working for me on linux.

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

No branches or pull requests

5 participants