Fix fish shell integration status code#319065
Open
aravind-n wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Fish shell integration to avoid clobbering Fish’s $status during prompt/command lifecycle hooks and ensures environment variables are applied only once per session.
Changes:
- Make the env-var “already applied” flag global so it persists beyond
__vsc_apply_env_vars. - Preserve and restore
$statusacross preexec/postexec/cancel/prompt events by saving it locally and returning it.
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @anthonykim1Matched files:
|
1 similar comment
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @anthonykim1Matched files:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #319058
As documented in the linked issue, the shell integration on fish breaks any status checks in the user's prompt if fish_mode_prompt is disabled. This occurs for users who have tools like starship installed (which disables the mode prompt). To fix this, I have modified each of the on_event handlers to capture the previous status and return it. This preserves the status of the previous command ensuring that status checks in the user's prompt are not tampered
I have also fixed a bug on line 57 that incorrectly set the
__vsc_applied_env_varsflag locally instead of globally.