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

Powershell Core installed with scoop is not recognized in terminal #137323

Closed
Rafeqm opened this issue Nov 16, 2021 · 7 comments · Fixed by #243025
Closed

Powershell Core installed with scoop is not recognized in terminal #137323

Rafeqm opened this issue Nov 16, 2021 · 7 comments · Fixed by #243025
Assignees

Comments

@Rafeqm
Copy link

Rafeqm commented Nov 16, 2021

Does this issue occur when all extensions are disabled?: No

  • VS Code Version: 1.62
  • OS Version: Windows 11 Build 22000

Steps to Reproduce:

  1. Install Powershell Core from scoop.
  2. Just open VS Code and its integrated terminal.
  3. Default terminal profile is just powershell.
  4. VS Code does not recognize pwsh from scoop PATH.
  5. Tried to tweak 4 settings in setting.json related to terminal profile, but no avail.

Why Windows Terminal recognize pwsh from scoop directory while VS Code does not?

@Tyriar
Copy link
Member

Tyriar commented Nov 17, 2021

I believe this was fixed in the recovery build.

@Tyriar Tyriar closed this as completed Nov 17, 2021
@Rafeqm
Copy link
Author

Rafeqm commented Nov 22, 2021

I believe this was fixed in the recovery build.

And which version is that build?

@Tyriar
Copy link
Member

Tyriar commented Nov 22, 2021

1.62.3

@Rafeqm
Copy link
Author

Rafeqm commented Nov 30, 2021

Hey sorry for late feedback. But I updated vscode to this latest version and integrated terminal still does not recognize pwsh from scoop PATH and default to Windows Powershell not Powershell Core. Here is the screenshot:

Screenshot (16)

I think this issue should be reopen :(

@Rafeqm
Copy link
Author

Rafeqm commented Nov 30, 2021

Update: I figured it out. I just tweak this setting and vscode can now detects it:

    "terminal.integrated.profiles.windows": {
        "PowerShell Core": {
            "path": "pwsh.exe",
            "icon": "terminal-powershell"
        }
    },

Just Happy to share it now after three weeks tweaking it 😎.

@Tyriar
Copy link
Member

Tyriar commented Nov 30, 2021

I don't think we detect the scoop install:

/**
* Iterates through all the possible well-known PowerShell installations on a machine.
* Returned values may not exist, but come with an .exists property
* which will check whether the executable exists.
*/
async function* enumerateDefaultPowerShellInstallations(): AsyncIterable<IPossiblePowerShellExe> {
// Find PSCore stable first
let pwshExe = await findPSCoreWindowsInstallation();
if (pwshExe) {
yield pwshExe;
}
// Windows may have a 32-bit pwsh.exe
pwshExe = await findPSCoreWindowsInstallation({ useAlternateBitness: true });
if (pwshExe) {
yield pwshExe;
}
// Also look for the MSIX/UWP installation
pwshExe = await findPSCoreMsix();
if (pwshExe) {
yield pwshExe;
}
// Look for the .NET global tool
// Some older versions of PowerShell have a bug in this where startup will fail,
// but this is fixed in newer versions
pwshExe = findPSCoreDotnetGlobalTool();
if (pwshExe) {
yield pwshExe;
}
// Look for PSCore preview
pwshExe = await findPSCoreWindowsInstallation({ findPreview: true });
if (pwshExe) {
yield pwshExe;
}
// Find a preview MSIX
pwshExe = await findPSCoreMsix({ findPreview: true });
if (pwshExe) {
yield pwshExe;
}
// Look for pwsh-preview with the opposite bitness
pwshExe = await findPSCoreWindowsInstallation({ useAlternateBitness: true, findPreview: true });
if (pwshExe) {
yield pwshExe;
}
// Finally, get Windows PowerShell
pwshExe = findWinPS();
if (pwshExe) {
yield pwshExe;
}
}

fyi @TylerLeonhardt if this is something you want to add

@TylerLeonhardt
Copy link
Member

Yeah the scoop usage was pretty low and rather than it installing in the normal location (which is what winget & chocolatey do) it goes to a specific scoop place.

That is why we didn't do it in the PowerShell extension.

In any case, I'll say what I said then... I'm not planning on adding this, but if a PR came in for it, I wouldn't reject it.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants