Skip to content

wrapper: cd to --cwd earlier #448

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

Merged
merged 1 commit into from
Oct 1, 2020
Merged

wrapper: cd to --cwd earlier #448

merged 1 commit into from
Oct 1, 2020

Conversation

ocharles
Copy link
Contributor

@ocharles ocharles commented Oct 1, 2020

Currently, if haskell-language-server-wrapper is called with --cwd, a cradle will first be loaded and then the change of working directory will happen. This commit reorders this such that if --cwd is supplied, the very first action is to change directory. This means a cradle will be found with --cwd, rather than the directory that haskell-language-server-wrapper was called in.

Currently, if `haskell-language-server-wrapper` is called with `--cwd`, a cradle will first be loaded and _then_ the change of working directory will happen. This commit reorders this such that if `--cwd` is supplied, the very first action is to change directory. This means a cradle will be found with `--cwd`, rather than the directory that `haskell-language-server-wrapper` was called in.
@ocharles
Copy link
Contributor Author

ocharles commented Oct 1, 2020

I'm not sure if this is or isn't correct, because it's not clear to me what --cwd is for. I'm using (or abusing) it at the moment because what I want to do is:

  • Have my source code in ~/code
  • Have a UnionFS file system in ~/code-hls that uses COW to mirror ~/code, but to not actually write changes to ~/code
  • Run haskell-language-server while my current working directory is code, but have everything run from within ~/code-hls.

The reason I'm doing this is to try and work around haskell/hie-bios#195. The current behavior is that the hie-bios cradle constantly intereferes with my own cabal calls. I'm trying to sandbox haskell-language-server so it can do what it wants without stepping on my toes.

@ndmitchell
Copy link
Collaborator

My personal approach is that --cwd should always be the very first thing done, other than perhaps resolving paths passed on the command line (and even then, its debatable) - therefore I'm in solid agreement with this.

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@fendor fendor merged commit 248e8df into haskell:master Oct 1, 2020
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.

3 participants