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

Add support for ASDF_DIR environment variable #2695

Merged
merged 6 commits into from
Oct 18, 2024

Conversation

srcid
Copy link
Contributor

@srcid srcid commented Oct 9, 2024

Motivation

To handle custom asdf vm installation paths.

Closes #2686

ASDF supports custom installation paths using the asdf_dir env var, and ruby-lsp should look for it as it already supports ASDF. Currently, it tries the default installation paths only.

Implementation

I check if the ASDF_DIR env var do exists, and if it did, I try to find if the asdf script. Otherwise, it will follow the actual behavior.

Automated Tests

Since I only check if an env var exists, and didn't change the actual workflow of the extension, the current test suit should cover it up.

Manual Tests

  • I set the variable ASDF_DIR.
  • Change asdf installation to a non-default folder.
  • I open vscode
  • Check if the extension was working
  • Check if it finds the asdf.

@srcid srcid requested a review from a team as a code owner October 9, 2024 00:57
@srcid srcid requested review from st0012 and vinistock October 9, 2024 00:57
@srcid
Copy link
Contributor Author

srcid commented Oct 9, 2024

I have signed the CLA!

@srcid srcid changed the title Add support for ASDF_ENV environment variable Add support for ASDF_DIR environment variable Oct 9, 2024
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. I understand the use case, but reading that variable from the process env is not going to work for every case.

If someone opens VS Code from the terminal with code ., it will work because the editor will inherit the environment variables. But if someone opens from the app icon, then it will not inherit anything and the code will simply not work.

If ASDF can be installed in any arbitrary directory, then we should add a new setting for ASDF allowing people to configure where we look for it.

vscode/src/ruby/asdf.ts Outdated Show resolved Hide resolved
vscode/package.json Outdated Show resolved Hide resolved
vscode/src/ruby/asdf.ts Outdated Show resolved Hide resolved
@vinistock vinistock added enhancement New feature or request vscode This pull request should be included in the VS Code extension's release notes labels Oct 16, 2024
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

@vinistock vinistock merged commit bb336e5 into Shopify:main Oct 18, 2024
19 checks passed
@srcid
Copy link
Contributor Author

srcid commented Oct 18, 2024

@vinistock I thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ruby-lsp should follow the ASDF_DIR environment variable.
2 participants