sublime-config icon indicating copy to clipboard operation
sublime-config copied to clipboard

support shell variable expansion, like $HOME

Open mpvl opened this issue 10 years ago • 5 comments
trafficstars

Go Sublime supported this, so it will make the transition from Go Sublime more straightforwards.

Alternatively, give a better error message that a given path could not be found. I got an error message that my GOPATH was not defined, rather than pointing to a non-existing directory.

mpvl avatar Oct 29 '15 11:10 mpvl

While I understand the motivation, I'm not convinced adding environment variable expansion is the right move, mostly because it is sort of open-ended and may be harder to document.

Some thoughts related to the implementation and documentation I have are:

  • Will we support expanding any env var in any variable, or just HOME/USERPROFILE?
  • Will we support OS-specific env variable formatting? Will it be $HOME on OS X and Linux and %USERPROFILE% on Windows?
  • Will variable replacement only work in some settings? Just GOPATH and GOROOT, or should it work in any string value?

If I were to answer the question, I would probably say to do the following if we were going to add support:

  • Just $HOME and %USERPROFILE%
  • Only in GOPATH and GOROOT

wbond avatar Oct 30 '15 00:10 wbond

I opened #4 to address the error reporting issue. Let's focus this on variable expansion.

I like Will's suggestion of only offering this for a limited set of variables. But I think this could also be added later (post 1.0). That being said, I am not a heavy user of GoSublime, and can't comment on how useful that feature is/isn't to general users.

jbuberel avatar Oct 30 '15 21:10 jbuberel

@mpvl Did you manually enter your GOPATH into Sublime Text, or was your $GOPATH env var set to $HOME/...?

As a follow up, if you did enter it into the Sublime Text settings, was ST not able to fetch it from your shell?

If you did not enter it into the settings, could you execute the following in your Sublime Text console and tell me the output?

import shellenv
shell, env = shellenv.get_env()
env.get('GOPATH')

wbond avatar Oct 31 '15 05:10 wbond

@mpvl Ping

wbond avatar Dec 03 '15 17:12 wbond

@wbond another use case that would be addressed by this is appending to $PATH rather than overwriting it outright, which is currently (infuriatingly) the only option.

tamird avatar Apr 26 '17 15:04 tamird