Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2024.2.0 No longer loads my Pwsh profile in the integrated terminal. How can I fix this? #4970

Closed
6 tasks done
futuremotiondev opened this issue Apr 9, 2024 · 7 comments
Closed
6 tasks done
Labels
Issue-Bug A bug to squash. Needs: Author Feedback Please give us the requested feedback!

Comments

@futuremotiondev
Copy link

futuremotiondev commented Apr 9, 2024

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • 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

ms-vscode.powershell@2024.2.0

Steps to Reproduce

  1. Add an alias to your profile (C:\Users\username\Documents\PowerShell\profile.ps1), or an Import Module WhateverModule statement.
  2. Open VSCode and wait for the integrated terminal to open.
  3. Try running an alias or accessing a module you have set to manually import.
  4. 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:

Code_X5IMkwmdAa

Visuals

No response

Logs

No response

@futuremotiondev futuremotiondev added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Apr 9, 2024
@andyleejordan
Copy link
Member

Just curious, what happens if you disable Terminal Shell Integration via terminal.integrated.shellIntegration.enabled (and then restart the extension)?

@wsmelton
Copy link

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:
image

On my mac work device, in iTerm2
image

@wsmelton
Copy link

Confirmed this is affecting Polygot books as well
image

@andyleejordan
Copy link
Member

@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()

@SydneyhSmith SydneyhSmith added Needs: Author Feedback Please give us the requested feedback! and removed Needs: Triage Maintainer attention needed! labels May 7, 2024
@SydneyhSmith
Copy link
Collaborator

@futuremotiondev what is the value of $error? What is in your profile?

@github-actions github-actions bot added Needs: Maintainer Attention Maintainer attention needed! and removed Needs: Author Feedback Please give us the requested feedback! labels May 7, 2024
@wsmelton
Copy link

wsmelton commented May 7, 2024

@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.

@SydneyhSmith SydneyhSmith added Needs: Author Feedback Please give us the requested feedback! and removed Needs: Maintainer Attention Maintainer attention needed! labels May 15, 2024
Copy link
Contributor

This issue has been labeled as needing feedback and has not had any activity a week. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash. Needs: Author Feedback Please give us the requested feedback!
Projects
None yet
Development

No branches or pull requests

4 participants