WhatsThatItsPat / dotfiles_research

2 stars 2 forks source link

Investigate inheritEnv in VS Code #10

Open WhatsThatItsPat opened 4 years ago

WhatsThatItsPat commented 4 years ago

Why are there duplicate paths in the terminal's $PATH environment variable and/or why are they reversed?

There are two direct fixes for this. You can set "terminal.integrated.inheritEnv": false

WhatsThatItsPat commented 4 years ago

From the same link above:

which will strip most environment variables from the terminal's environment, except for some important ones (like HOME, SHELL, TMPDIR, etc.).

This is the second mention of removing some variables that we've seen. Apparently, $USER isn't an important environment variable.

image

WhatsThatItsPat commented 4 years ago

We enforce uniqueness anyway here: 176f771fa66b10d556883a3086215fe79a894840

WhatsThatItsPat commented 4 years ago

Launch terminals with clean environments

The Integrated Terminal in VS Code has always acted a little differently to normal terminals, particularly on Linux and macOS.

Ok, good to know.


macOS: Pull a handful of important environment variables off the current environment and only include them. Eventually we would like macOS to behave the same as Linux but there are currently issues with fetching environments.

Apparently, $USER isn't an important environment variable. But there's a plan to fix it eventually.


The main visible result of setting inheritEnv to false is that $SHLVL (shell level) should now be 1 and $PATH should not include duplicate paths, provided your launch scripts don't intentionally include them.

Will this affect our new SHLVL prompt section (892dd4d3a8c278fbf1124474c3ca82075a2d70b6)?


The default value for terminal.integrated.inheritEnv is true, which is the previous behavior, but we will probably switch the value to false in the future.

Eventually, it might be false and "just work."

WhatsThatItsPat commented 4 years ago

We really have to get VS Code settings in the repo... #8

alternative, can we link issues like links?

We really have to get VS Code settings in the repo.