Add support for hover and go to definition when typechecker enabled but typed: false #1280
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This is a follow up to #1245 by @SeanKG and I.
We did another pair programming session today to continue that work to add hover and go to definition support for when the type checker is enabled but the file is
typed: false.A lot of our files are currently
typed: falsebut we still wanted to get the editor benefits of the Ruby LSP despite that.Implementation
The implementation was very similar to #1245. We added an extra parameter to the
initializemethod in bothhover.rbanddefinition.rbto store whether the type checker is enabled or not, and then we replaced existing instances ofDependencyDetector.instance.typecheckerwith that newly provided instance variable@typechecker_enabled.There is also a small refactor to
common.rbincluded in these changes so that we could modify the code we needed to modify. We pulled out the call toDependencyDetector.instance.typecheckerbecause it didn't relate to whether the caller was defined in a gem or not. So now thedefined_in_gem?method looks like thisAutomated Tests
We didn't add any new automated tests as part of this change. However we did update existing ones.
The reasoning behind that was we thought the change in functionality was small enough this time that updating the existing tests would be ok. If this is not ok definitely let us know.
Manual Tests
Note as of 2:00pm on January 5th, 2024 this has not been manually tested yet. I will update when it has been.