ruby-lsp icon indicating copy to clipboard operation
ruby-lsp copied to clipboard

vscode/asdf: support configuration environment variables

Open gi opened this issue 9 months ago • 6 comments

This adds support for detecting asdf configuration via its environment variables:

  • ASDF_DIR: installation location
  • ASDF_DATA_DIR: data directory

Motivation

Fixes #2023

Implementation

If the environment variable is set, include it as the first option for where to search to validate the value.

Automated Tests

Manual Tests

gi avatar May 10 '24 06:05 gi

I have signed the CLA!

gi avatar May 10 '24 06:05 gi

@vinistock Thanks for the feedback.

FYI, a recent update broke this customization of the asdf setup.

I presume that it was this commit: 30bc0001.

I'm simply comparing the timeframe of the commit and the functionality change. (I use Ruby LSP every day.)

gi avatar May 10 '24 17:05 gi

@vinistock Shouldn't the shell be able to determine the values of the ASDF_DIR and ASDF_DATA_DIR values, so why are they manually set?

gi avatar May 10 '24 17:05 gi

We have decoupled all version manager integrations from shells. I explained in more detail here. The summary is that trying to automatically discover the user's shell and source their configurations has lead to several problems and it's generally a brittle approach. The NodeJS process where extensions run is not the same as your shell/terminal. Nothing you configure in shell scripts is available there.

We're trying to push forward version manager integrations that do not connect to the shell in any way, so that we can achieve more reliable environment activation.

Compared to other version managers, ASDF is proving to be extremely coupled with shells (multiple users have raised issues). It seems that when we source the asdf.sh script from the NodeJS exec invocation (which uses /bin/sh), ASDF is not able to properly determine ASDF_DIR and ASDF_DATA_DIR automatically, which I believe is the source of many of the errors we're seeing.

If you have better ideas on how to make the integration smoother, please do tell us.

vinistock avatar May 10 '24 17:05 vinistock

@vinistock I pushed an update with an alternative approach. I'm not sure this will work either based on the complexities you mentioned, but I'm curious on your insights.

gi avatar May 10 '24 17:05 gi

I created an alternative and simpler update which simply includes the XDG base data directory as it is a common pattern: https://github.com/Shopify/ruby-lsp/pull/2045.

gi avatar May 13 '24 06:05 gi

Issue fixed in https://github.com/Shopify/ruby-lsp/pull/2006

gi avatar May 30 '24 21:05 gi