Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Mention a fallback for chruby users if project doesn't have `.ruby-…
Browse files Browse the repository at this point in the history
…version`
  • Loading branch information
st0012 committed Sep 22, 2023
1 parent 6dda18b commit 7f915e9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
25 changes: 4 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,10 @@ To make sure that the Ruby LSP can find the version manager scripts, make sure t
configuration script (e.g.: ~/.bashrc, ~/.zshrc) and that the SHELL environment variable is set and pointing to the
default shell.

##### Custom activation

If you're using a different version manager than the ones listed above or if you're manually inserting the Ruby
executable into the PATH, you will probably need to define custom activation so that the extension can find the correct
Ruby.

For these cases, set `rubyLsp.rubyVersionManager` to `"custom"` and then set `rubyLsp.customRubyCommand` to a shell
command that will activate the right Ruby version or simply add the Ruby bin folder to the PATH. Some examples:

```jsonc
{
// Don't forget to set the manager to custom when using this option
"rubyLsp.rubyVersionManager": "custom",

// Using a different version manager than the ones included by default
"rubyLsp.customRubyCommand": "my_custom_version_manager activate",

// Adding a custom Ruby bin folder to the PATH
"rubyLsp.customRubyCommand": "PATH=/path/to/ruby/bin:$PATH"
}
```
> **Note**
>
> For manager-specific notes and how to set up custom activation for managers that are not listed above,
please see [version managers](VERSION_MANAGERS.md).

See [version managers](VERSION_MANAGERS.md) for user-contributed configuration examples.

Expand Down
30 changes: 27 additions & 3 deletions VERSION_MANAGERS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
# Custom version managers
## Chruby

Below you can find user-contributed configurations for less common version managers.
If you use `chruby` but don't have `.ruby-version` in a project, you can add `.ruby-version` to its parent folder as a fallback.

## rtx
For example, if `/projects/my_project` doesn't have `.ruby-version`, `chruby` would read `/projects/.ruby-version` instead.

## Custom activation

If you're using a different version manager that's not supported by us or if you're manually inserting the Ruby
executable into the PATH, you will probably need to define custom activation so that the extension can find the correct
Ruby.

For these cases, set `rubyLsp.rubyVersionManager` to `"custom"` and then set `rubyLsp.customRubyCommand` to a shell
command that will activate the right Ruby version or simply add the Ruby bin folder to the PATH. Some examples:

```jsonc
{
// Don't forget to set the manager to custom when using this option
"rubyLsp.rubyVersionManager": "custom",

// Using a different version manager than the ones included by default
"rubyLsp.customRubyCommand": "my_custom_version_manager activate",

// Adding a custom Ruby bin folder to the PATH
"rubyLsp.customRubyCommand": "PATH=/path/to/ruby/bin:$PATH"
}
```

### rtx

[rtx](https://github.com/jdxcode/rtx) is a Rust clone compatible with asdf. You can use it by adding the following
snippet to your user configuration JSON
Expand Down

0 comments on commit 7f915e9

Please sign in to comment.