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

Should the server restart when `.ruby-version` is changed?

Open Earlopain opened this issue 1 year ago • 3 comments

I have checked that this feature is not already implemented

  • [x] This feature does not exist

Use case

Ruby now plans to to a patch release every two months or so, and repos are inconsistent about updaing their .ruby-version file. Here for example it declares 3.3.4 at the moment even though 3.3.5 is released. I make a habbit of removing previous patch releases when a new one releases and just hand-edit the .ruby-version file, no big deal. But I also have to manually reload the window to make ruby-lsp pick it up.

Should this happen automatically, same as with lockfile changes?

Description

See above

Implementation

No response

Earlopain avatar Sep 20 '24 10:09 Earlopain

Thank you for the feature proposal!

Yes, we should definitely auto-reload if the .ruby-version change. Perhaps just watching the file to trigger the reload is enough? It would be good to give it a try just to ensure it works as expected.

We received this bug report #2411 which is related.

I wonder if which file to watch shouldn't be controlled by the version manager integrations. Maybe the extension's Ruby object can expose something like ruby.versionDefinitionFilePath so that we can use .ruby-version, but also .tools-versions and mise.toml.

Then the Workspace can ask the Ruby object which file to watch and register a watcher like we do for the lockfile.

vinistock avatar Sep 20 '24 13:09 vinistock

This issue is being marked as stale because there was no activity in the last 2 months

github-actions[bot] avatar Nov 20 '24 12:11 github-actions[bot]

We ran into this problem at work, where the .ruby-lspdirectory needed to be fully deleted and recreated after we updated Ruby and a lot of our gems at the same time, otherwise we saw pretty weird behaviors.

connorshea avatar Nov 14 '25 22:11 connorshea