fix: Propagate forceShellIntegration to remote terminal server#300428
Open
renan-r-santos wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: Propagate forceShellIntegration to remote terminal server#300428renan-r-santos wants to merge 1 commit intomicrosoft:mainfrom
forceShellIntegration to remote terminal server#300428renan-r-santos wants to merge 1 commit intomicrosoft:mainfrom
Conversation
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 microsoft/vscode-python-environments#1337
Debug terminals are created with
isFeatureTerminal: trueandforceShellIntegration: true. TheforceShellIntegrationflag is needed because VS Code skips shell integration injection for feature terminals by default (seeterminalEnvironment.ts).The problem is that
forceShellIntegrationis not included inIShellLaunchConfigDto, which is the DTO used to serialize the shell launch config when sending it from the client to the remote server. So whileisFeatureTerminal: trueis correctly propagated,forceShellIntegrationis silently dropped.On the remote server, the shell integration injection check sees
isFeatureTerminal: trueandforceShellIntegration: undefined, and skips injection. Without shell integration, the Python activation hooks built into VS Code's shell integration scripts (e.g. theVSCODE_PYTHON_BASH_ACTIVATEeval inshellIntegration-bash.sh) never run. The.bashrcalso doesn't have the activation code because the Python Environments extension skipped profile modification after detecting that shell integration was available.Locally this works because the full
IShellLaunchConfig(includingforceShellIntegration) is passed directly to the pty host without going through the DTO serialization.In addition to the issue described above, debug terminals were reused across different working directories, causing stale environment activations from previous debug sessions to persist. I added
cwdto the terminal config key used for matching, so terminals are only reused when the shell type and working directory both match, so each project directory gets its own debug terminal with the correct activated Python environment.This PR was manually tested with
./scripts/code.sh --remote test+test