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

Provide simpler route for activating shell integration #155046

Merged
merged 7 commits into from
Jul 14, 2022
Merged

Conversation

Tyriar
Copy link
Member

@Tyriar Tyriar commented Jul 13, 2022

Fixes #153921

# pwsh
if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --shell-integration pwsh)" }
# bash
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --shell-integration bash)"

# zsh
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --shell-integration zsh)"

@Tyriar Tyriar added this to the July 2022 milestone Jul 13, 2022
@Tyriar Tyriar self-assigned this Jul 13, 2022
@felipecrs
Copy link
Contributor

Another approach would be to output the whole script when calling such command instead of script path. Like Homebrew's shellenv:

eval "$(brew shellenv)"

Or other tools which generates completion scripts, like:

kubectl completion zsh

@Tyriar Tyriar marked this pull request as ready for review July 14, 2022 01:02
@Tyriar
Copy link
Member Author

Tyriar commented Jul 14, 2022

@felipecrs I think since we'll say to use the if term_program is vscode, the eval should work the same as sourcing the file

As for completions, shell integration doesn't need completions to work, but we have some early prototypes for how to tackle that problem starting with pwsh #154662

@Tyriar Tyriar requested a review from meganrogge July 14, 2022 01:06
Copy link
Contributor

@meganrogge meganrogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not test but lgtm

@Tyriar Tyriar merged commit e1146e0 into main Jul 14, 2022
@Tyriar Tyriar deleted the tyriar/si_cli branch July 14, 2022 11:47
andreamah pushed a commit that referenced this pull request Jul 14, 2022
Provide simpler route for activating shell integration
jrieken pushed a commit that referenced this pull request Jul 18, 2022
Provide simpler route for activating shell integration
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify shell integration manual install by deferring to the code CLI
3 participants