-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fallback to latest known Ruby if no .ruby-version is found (#2836)
### Motivation Completes a significant part of handling missing `.ruby-version` for #2793 If the user doesn't have a `.ruby-version` in their project or in any parent directories, then we can try to fallback to the latest known Ruby available. **Note**: this PR doesn't handle the aspect of having a `.ruby-version` configured to a Ruby that's not installed. I'll follow up with that later. ### Implementation To avoid having this behaviour be surprising, I used a progress notification with a 5 second delay warning the user that we are going to try falling back to the latest known Ruby. If they don't do anything, we search for the Ruby installation and launch. If the user clicks cancel, then we stop everything and offer them 3 options: 1. Create a `.ruby-version` file in a parent directory. Here we use a quick pick to list all known rubies and create the file for them using what they select 2. Manually configure a global fallback Ruby installation for the LSP 3. Shutdown ### Automated Tests Added automated tests for two scenarios. I haven't figured out if it's possible to trigger the cancellation in a test even with a stub, so I failed to create tests for those cases. If you have an idea about how to fake the cancellation of the progress notification, please let me know!
- Loading branch information
Showing
3 changed files
with
238 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters