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

Support asdf-vm setup in wrapper scripts #78

Merged
merged 1 commit into from
Dec 9, 2019
Merged

Support asdf-vm setup in wrapper scripts #78

merged 1 commit into from
Dec 9, 2019

Conversation

cdegroot
Copy link
Contributor

@cdegroot cdegroot commented Nov 26, 2019

IDEs often don't have the same environment as the command line and this can, in certain circumstances, break Elixir. I've had multiple projects that could not start elixir-ls from Emacs, for example, due to subtle PATH differences.

asdf-vm is probably the most widely used version manager for Elixir projects; this PR invokes its configuration script if it exists, ensuring that Elixir gets invoked in the same way as on the command line.

I'm not super happy with explicitly supporting a single version manager, but it smells like "the standard" in Elixir land and if the config script is not available, this PR is a no-op anyway.

@axelson
Copy link
Member

axelson commented Dec 7, 2019

This seems to make sense to me and it appears it is safe to call "$HOME/.asdf/asdf.sh" multiple times. And according to the recent ElixirForum poll https://elixirforum.com/t/which-elixir-version-manager-are-you-using-poll/27186 76% of developers in the poll are using asdf, and 13% are not using any version manager. That means that this PR likely covers a majority of users.

@Trevoke
Copy link
Member

Trevoke commented Dec 7, 2019 via email

@Trevoke
Copy link
Member

Trevoke commented Dec 7, 2019

Though I am, of course, open to being convinced :)

@cdegroot
Copy link
Contributor Author

cdegroot commented Dec 7, 2019

This is not emacs specific. It could happen when stuff is called from any idea. I just found it on emacs (and only in certain circumstances asdf-vm isn’t setup already) because I have an excellent taste in IDEs ;). But I don’t think I’d be hard pressed to come up with a way to reproduce it with other environments as well. As far as I’m concerned it’s a sort of belt-and-suspenders approach to make sure that if the user uses asdf-vm, it is setup and used correctly no matter how we’re invoked.

(I think the #1 route to not have asdf setup is when users are confused which of bashrc/bash_profile/... is invoked at login and which only for interactive shells. I still don’t know ;))

@Trevoke
Copy link
Member

Trevoke commented Dec 9, 2019 via email

@axelson axelson merged commit b2749e7 into elixir-lsp:master Dec 9, 2019
@axelson
Copy link
Member

axelson commented Dec 9, 2019

Thanks for contributing! 🙌

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