Skip to content

Partially migrate go to definition to use Rubydex#4015

Open
vinistock wants to merge 1 commit into03-18-migrate_type_inferrerfrom
03-03-migrate_go_to_definition_to_use_rubydex
Open

Partially migrate go to definition to use Rubydex#4015
vinistock wants to merge 1 commit into03-18-migrate_type_inferrerfrom
03-03-migrate_go_to_definition_to_use_rubydex

Conversation

@vinistock
Copy link
Member

Motivation

This PR partially migrates go to definition to use Rubydex. It ignores constants for now as we need the visibility API to complete it. Everything else is migrated.

Implementation

There's not much that's notable other than changing to use the new APIs, but I'll highlight two things:

  1. I always disliked our Common module. I propose that we instead patch Rubydex's classes with LSP related things so that we can do things like definition.to_lsp_range (see the code). It feels a lot more elegant and, as long as we include lsp in the method names, it won't really conflict with anything
  2. The logic to find the correct graph declaration for go to definition, hover and signature help will probably be super similar. I think we can extract a common implementation for the 3, but I held back for now so that we can take a more complete look into how the requests use the graph

Automated Tests

I migrated our tests. The only thing to call out here is that Rust's ordering does not match the original indexer's ordering (due to how HashMap works).

This makes no functional difference, but tests expect a very specific order to assert things. Instead of paying the price to sort the result, which is unnecessary, I just sorted in the tests.

@vinistock vinistock self-assigned this Mar 18, 2026
@vinistock vinistock requested a review from a team as a code owner March 18, 2026 15:51
@vinistock vinistock added server This pull request should be included in the server gem's release notes other Changes that aren't bugfixes, enhancements or breaking changes labels Mar 18, 2026
@vinistock vinistock requested review from alexcrocha and st0012 March 18, 2026 15:51
@vinistock vinistock force-pushed the 03-18-migrate_type_inferrer branch from 5b864a5 to cd9f1e7 Compare March 18, 2026 17:16
@vinistock vinistock force-pushed the 03-03-migrate_go_to_definition_to_use_rubydex branch from f2b1b2d to a6c13bd Compare March 18, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

other Changes that aren't bugfixes, enhancements or breaking changes server This pull request should be included in the server gem's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant