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

New: Install VS Code debugger extensions #48

Merged
merged 1 commit into from
Jun 7, 2018

Conversation

molant
Copy link
Contributor

@molant molant commented Jun 7, 2018

Install automatically VS Code debugger extensions for Chrome an Edge


Ref: #46

Install automatically VS Code debugger extensions for Chrome an Edge

- - - - - - - - - - - - - - - - - - -

Ref: microsoft#46
@yodurr
Copy link
Contributor

yodurr commented Jun 7, 2018

love it, thanks!

@yodurr yodurr merged commit 872a12d into microsoft:master Jun 7, 2018
@@ -15,6 +15,9 @@ Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\

#--- Tools ---
choco install -y vscode
code --install-extension msjsdiag.debugger-for-chrome
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yodurr I "think" this might require a refreshenv in order to function. I gave a Chocolatey presentation yesterday, and the need to refreshenv was required for me.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PowerShell scripts, I'm not going to recommend a "refreshenv" as it is not deterministic to know if the PowerShell profile is installed - it is more deterministic to use Update-SessionEnvironment after importing some of the Chocolatey module. cc @crutkas

I'll explain at the bottom on the need for updating environment variables.

molant added a commit to molant/windows-dev-box-setup-scripts that referenced this pull request Jun 18, 2018
@crutkas
Copy link
Member

crutkas commented Jun 18, 2018

why do you need to refreshenv?

@molant
Copy link
Contributor Author

molant commented Jun 18, 2018

@gep13 can say more, but I believe it's because code will not be in the path after doing choco install -y vscode and it is required in order to install the extensions.

See #48 (comment)

@gep13
Copy link
Collaborator

gep13 commented Jun 19, 2018

That is what I suspect it required yes. I ran into this during a demo I was given.

Also, here in this package:

https://chocolatey.org/packages/vscode-powershell

A refresh is required, or at least, it was.

@crutkas
Copy link
Member

crutkas commented Jun 19, 2018

One Thought, just have choco vs code and the vs packages to refresh. Where does one submit a PR for those?

@gep13
Copy link
Collaborator

gep13 commented Jun 19, 2018

@crutkas said...
One Thought, just have choco vs code and the vs packages to refresh. Where does one submit a PR for those?

I am not sure that I follow your train of thought here. Can you please elaborate?

@crutkas
Copy link
Member

crutkas commented Jun 19, 2018

sorry, if we need to do a refresh for the environment, wouldn't the better spot to do the adjustment is actually in the choco package? that way everyone gets the update versus only someone that uses our scripts

@ferventcoder
Copy link
Collaborator

sorry, if we need to do a refresh for the environment, wouldn't the better spot to do the adjustment is actually in the choco package? that way everyone gets the update versus only someone that uses our scripts

@crutkas unfortunately Windows doesn't quite work that nicely. Even if those packages call Update-SessionEnvironment (aka refreshenv for PowerShell.exe), it won't matter once the choco.exe process exits and it moves back up to the powershell.exe process. A subprocess can update the environment variables all it wants in that process, and when it exits, the parent process won't see the changes. If it makes permanent changes to User/System environment variables, that also won't be seen in command shells until the shell is closed and reopened.

Chocolatey however has a concept of refreshenv, that will review the changes in the registry and update the process environment variables with the changes. There is refreshenv.cmd for cmd.exe command shells, and there is Update-SessionEnvironment, which is aliased to refreshenv when the Chocolatey PowerShell profile is installed. As you can guess, running refreshenv in PowerShell without that profile loaded, it's going to call refreshenv.cmd, starting a cmd.exe subprocess, updating those environment variables in that subprocess, and then exiting and having no changes to the current PowerShell.exe command shell.

Does all of that make sense?

@molant
Copy link
Contributor Author

molant commented Jun 20, 2018

@ferventcoder so if I've understood correctly I have to replace refreshenv with Update-SessionEnvironment in this PR?

@gep13
Copy link
Collaborator

gep13 commented Jul 26, 2018

@molant since everything here is running in PowerShell, yes, that would be the safest thing to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants