vscode-powershell
vscode-powershell copied to clipboard
v2024.2.0 No longer loads my Pwsh profile in the integrated terminal. How can I fix this?
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all open and closed issues to ensure it has not already been reported.
- [X] I have read the troubleshooting guide.
- [X] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- [X] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- [X] If this is a security issue, I have read the security issue reporting guidance.
Summary
Previously before the new update (v2024.2.0), the integrated terminal would load my profile on launch in VSCode. This is no longer the case, and all my aliases don't work, as well as the modules that I have set to import (In my profile).
Another side-effect is that my terminal color settings aren't respected in the new integrated terminal.
How can I get the integrated terminal to auto-load my profile?
Appreciate any assistance.
PowerShell Version
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Name : Visual Studio Code Host
Version : 2024.2.0
InstanceId : 1075371e-9c80-4d5f-9a9f-ab860b9b6cfc
UI : System.Management.Automation.Internal.Host.InternalHostUserInte
rface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.88.0
5c3e652f63e798a5ac2f31ffd0d863669328dc4c
x64
Extension Version
[email protected]
Steps to Reproduce
- Add an alias to your profile (
C:\Users\username\Documents\PowerShell\profile.ps1), or anImport Module WhateverModulestatement. - Open VSCode and wait for the integrated terminal to open.
- Try running an alias or accessing a module you have set to manually import.
- It doesn't work.
Edit:
Entering $PROFILE in the integrated terminal returns C:\Users\username\Documents\PowerShell\Microsoft.VSCode_profile.ps1, but even after adding the Microsoft.VSCode_profile.ps1 file and restarting the integrated terminal, the profile still isn't loaded.
Edit 2:
Just to cover everything, this is enabled in Powershell settings:
Visuals
No response
Logs
No response
Just curious, what happens if you disable Terminal Shell Integration via terminal.integrated.shellIntegration.enabled (and then restart the extension)?
I have been seeing this for a while now and not sure if it is with the extension or if it isn't VS Code itself.
I can tell in integrated or VS Code's terminal that it is broken because $PROFILE points to a different path compared to the terminal on my device.
I use the CurrentUserAllHosts profile
In VS Code $PROFILE is pointing to ~/powershell/ but that is not the correct path when I open it in iTerm2 or normal Terminal on a mac, it is in ~/.config/powershell
VS Code terminal:
On my mac work device, in iTerm2
Confirmed this is affecting Polygot books as well
@wsmelton ah now that is interesting! I just confirmed that we (the extension terminal / custom host) are just grabbing info from PowerShell's built-in $PROFILE in private EditorServicesConfig CreateConfigObject()
@futuremotiondev what is the value of $error? What is in your profile?
@andyleejordan figured out my issue working with Joel (jaykul) and found somehow XDG_CONFIG_HOME=$HOME was being set in my ZSH profile. Commented that out and then everything worked again on Mac for me.
This issue has been labeled as needing feedback and has not had any activity a week. It has been closed for housekeeping purposes.