Skip to content

Extension doesn't start with when workspace is defined with zero folders #4102

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

Closed
1 of 6 tasks
opmdsm opened this issue Aug 2, 2022 · 8 comments · Fixed by #4104
Closed
1 of 6 tasks

Extension doesn't start with when workspace is defined with zero folders #4102

opmdsm opened this issue Aug 2, 2022 · 8 comments · Fixed by #4104
Assignees
Labels

Comments

@opmdsm
Copy link

opmdsm commented Aug 2, 2022

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

Hi,

Just updated PowerShell extension to v2022.7.2 and all powershell files within an existing workspace does not work anymore.

For instance:

  1. Switching from PowerShell x86 and x64 does not work anymore (command PowerShell: ShowSessionMenu not found).
  2. Executing only a selection of commands also does not work (command PowerShell: RunSelection not found).

If I open those files separately (open file, without open workspace) the above commands runs successfully.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.2.5
PSEdition                      Core
GitCommitId                    7.2.5
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

1.69.2
3b889b090b5ad5793f524b5d1d39fda662b96a2a
x64

Extension Version

ms-vscode.powershell@2022.7.2

Steps to Reproduce

Open an existing workspace and try to execute what's described in the issue.

Visuals

Commands executed within an opened workspace:

Command PowerShell: ShowSessionMenu not found:
image

PowerShell: RunSelection not found:
image

Same commands executed with open files one by one:

Command PowerShell: ShowSessionMenu:
image

PowerShell: RunSelection:
image

Logs

No response

@opmdsm opmdsm added the Issue-Bug A bug to squash. label Aug 2, 2022
@ghost ghost added the Needs: Triage Maintainer attention needed! label Aug 2, 2022
@andyleejordan
Copy link
Member

I can open an existing workspace just fine. Can you give us some more details, maybe share your workspace file?

@opmdsm
Copy link
Author

opmdsm commented Aug 3, 2022

I can also open an existing workspace just fine. The problem is when opening a file within that workspace, i cannot execute anything. Even simple commands like Get-ExecutionPolicy or Write-Host "test" does not work.

Let's assume i have a workspace W1 with a PowerShell file F1.

Steps:
Not working:

  1. Open workspace W1
  2. Open file F1
  3. Try to execute something from that file (Write-Host for ex), it will not work.

Working:

  1. Close any workspaces and just open file F1, without opening workspace W1
  2. Try to execute something from that file (Write-Host for ex), it will work.

This is an example of workspace file, but is almost empty:
{
"folders": []
}

Note:

  1. If is possible, we can have a Teams session.
  2. I can reproduce this problem on 2 different computers.

@andyleejordan
Copy link
Member

Ah ha, I can repro when I set folders to an empty array. That is...a very strange use case. I need to check what happens with other extension like this, and I'll see if there's an easy workaround, but can you please add your workspace's folder to the workspaces' folders and test again?

@SydneyhSmith SydneyhSmith added Area-Workspaces and removed Needs: Triage Maintainer attention needed! labels Aug 3, 2022
@andyleejordan andyleejordan changed the title v2022.7.2 breaks up existing workspaces Extension doesn't start with when workspace is defined with zero folders Aug 3, 2022
@andyleejordan andyleejordan moved this to In Progress in American Pharoah Aug 3, 2022
@andyleejordan andyleejordan self-assigned this Aug 3, 2022
Repository owner moved this from In Progress to Done in American Pharoah Aug 3, 2022
@opmdsm
Copy link
Author

opmdsm commented Aug 4, 2022

Ah ha, I can repro when I set folders to an empty array. That is...a very strange use case. I need to check what happens with other extension like this, and I'll see if there's an easy workaround, but can you please add your workspace's folder to the workspaces' folders and test again?

I'm glad that you are able to reproduce it. I don't know if is a strange use case or not, but just for curiosity I've checked some of other workspaces I work with and none of them have any folder configured.

Ex:
{
"folders": [
{
"path": "."
}
],
"settings": {}
}

Because I don't have the option to create a workspace in Visual Studio Code, what I do to create one is this:

  1. New text file and change it to PowerShell type, save it
  2. Then File -> Save Workspace As...
    Maybe that's why I end with empty folders and I'm wondering if this is not causing also Windows Powershell (x64) Session will not start - seems like #118289 #4012 (comment).

I can add workspace's folder to the workspaces' folders and test it, but how should look like?

Like this?
{
"folders": [{"path": "C:\Temp"}]
}

@opmdsm
Copy link
Author

opmdsm commented Aug 4, 2022

I have replaced workspace file
{
"folders": []
}

With this:
{
"folders": [
{
"path": "."
}
],
"settings": {}
}

And it works.

@andyleejordan
Copy link
Member

@opmdsm Can you repro with your prior settings with the latest code, v2022.8.0-preview? I fixed that edge case where folders was an empty array.

@opmdsm
Copy link
Author

opmdsm commented Aug 5, 2022

Hmm... I don't know how to install a preview version... But I prefer to install a release version and anyway I will be off for the next 2 weeks, so I can try then. Thank you very much for help so far.

@andyleejordan
Copy link
Member

It is simply this extension on the marketplace. You can disable the regular one, install this and test, and then uninstall it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants