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

Make environment issues easier to troubleshoot #50465

Closed
dlukes opened this issue May 25, 2018 · 1 comment
Closed

Make environment issues easier to troubleshoot #50465

dlukes opened this issue May 25, 2018 · 1 comment
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code

Comments

@dlukes
Copy link

dlukes commented May 25, 2018

I recently started using VSCode and I've been very happy for the most part (kudos and thank you!) :) However, there was one hurdle that made the initial setup somewhat painful: my environment variables weren't being properly picked up.

By "properly picked up", I mean "the same as in the shell I use day to day". Many VSCode extensions run commands on behalf of the user, which they can't do if the command lives in a non-standard directory and the configuration which puts that directory on the PATH is ignored. Or the command itself may live in a standard directory, but it may be influenced by some other environment variable FOO, in the absence of which its outcome is different. Getting different behavior when running the same command from my shell and from VSCode is confusing, and currently hard to troubleshoot.

I expect this is a problem mostly on Unix-like systems, where people regularly use a variety of shells and different ways to configure them. I'm afraid there's no foolproof way for VSCode to just guess the correct setup here. But it would be great to make users more aware that some of the problems they might encounter while running VSCode arise from improperly detected environments, and there should be more convenient tools to address them (see below for suggestions).

One concrete example is microsoft/vscode-python#1338, my own attempts to work around the problem are documented in a few comments starting here. Based on that experience, I've distilled some ideas for features that I think would make it easier to resolve this type of issues:

  • a command to check the environment VSCode is actually running in (display environment variable names and values)
  • allow configuring the environment from settings.json -- just an object where you can set/override any environment variable
  • an environment quick fix command, which would basically just tell the user to open the shell they typically use (because they'll be basing their expectations for what should work in VSCode on that), run env and copy-paste the output, which will be parsed and put into their settings.json (see previous bullet); obviously, this is for Unix-like systems, I'm not sure what the Windows equivalent would be
  • when users first run VSCode, suggest that they run the quick fix command or at least satisfy themselves that their environment is being picked up correctly, because otherwise, some features might not work as expected

In addition to the quick-and-dirty fix via settings.json, it would be great to have a page in the docs on other ways to address this kind of problems, including:

  • first troubleshooting rule: try running VSCode from the shell you normally use -- if the feature that's giving you grief works in this scenario, then an improperly detected environment is almost certainly to blame
  • tinkering with the code script -- changing the shebang to use the shell you normally use (bashzsh in my case), explicitly sourcing the runcoms which contain the appropriate settings etc. (this turned out to be useful on Linux, where VSCode is invoked via the script even when not run from the command line; no idea if that's the case on Windows and macOS)
  • setting the login shell to the one you normally use via chsh (this helped me on macOS but not on Solus OS Linux, where it seems like environment customizations made in the login shell runcoms are not transferred to the GUI environment)

It's not like VSCode needs to have all of these, they're more food for thought / inspiration :) And thanks again for a great editor!

@weinand weinand added the feature-request Request for new features or functionality label May 28, 2018
@mjbvz mjbvz added the *out-of-scope Posted issue is not in scope of VS Code label Oct 8, 2019
@vscodebot
Copy link

vscodebot bot commented Oct 8, 2019

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@vscodebot vscodebot bot closed this as completed Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

3 participants