Skip to content

Fix fish shell integration status code#319065

Open
aravind-n wants to merge 2 commits into
microsoft:mainfrom
aravind-n:fish-shell-integ-fix
Open

Fix fish shell integration status code#319065
aravind-n wants to merge 2 commits into
microsoft:mainfrom
aravind-n:fish-shell-integ-fix

Conversation

@aravind-n
Copy link
Copy Markdown
Contributor

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_vars flag locally instead of globally.

Copilot AI review requested due to automatic review settings May 29, 2026 21:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 $status across preexec/postexec/cancel/prompt events by saving it locally and returning it.

@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@anthonykim1

Matched files:

  • src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish

1 similar comment
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@anthonykim1

Matched files:

  • src/vs/workbench/contrib/terminal/common/scripts/shellIntegration.fish

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell integration for fish breaks command status code return

3 participants