Issue
When using VS Code sessions in Posit Workbench, environment configurations and module loading scripts in /etc/profile.d/ are not being sourced automatically in the VS Code integrated terminal, while they work correctly in RStudio, JupyterLab, and Jupyter Notebook terminals.
Description
This issue occurs because the VS Code integrated terminal starts a non-login shell by default, which does not source the scripts in /etc/profile.d/. Other session types in Workbench (RStudio, JupyterLab, Jupyter Notebook) automatically start login shells that properly source these environment configuration scripts.
Solution
To resolve this issue, you need to configure the VS Code terminal to launch as a login shell. This can be done in two ways:
1. For Individual Users
Users can modify their VS Code settings by following these steps:
- Open VS Code in Workbench.
- Press Ctrl+Shift+P (Cmd+Shift+P on macOS) to open the Command Palette.
- Type "settings json" and select "Preferences: Open User Settings (JSON)".
- Add the following configuration:
{
"terminal.integrated.shellIntegration.enabled": false,
"terminal.integrated.profiles.linux": {
"bash (login)": {
"path": "/bin/bash",
"args": ["--login", "-i"]
}
},
"terminal.integrated.defaultProfile.linux": "bash (login)"
}2. For All Users (Administrator Configuration)
Administrators can set this configuration globally by:
- Editing the /etc/rstudio/vscode-user-settings.json file on the server, or
- If using Kubernetes with the Helm chart, modifying the values.yaml file in the vscode-user-settings.json section with the above configuration.
After applying these changes, new VS Code sessions will properly source the profile scripts and load environment modules automatically.
If you're still having issues, you can reach out to Support by opening a ticket here.