Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[503] Project-wide renaming #1877

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

[503] Project-wide renaming #1877

wants to merge 12 commits into from

Conversation

voodoos
Copy link
Collaborator

@voodoos voodoos commented Dec 17, 2024

This PR adds initial support for project-wide Renaming:

  • When indexing, declarations which are linked together are aggregated in an union-find structure.
  • When calling occurrences with the new scope Renaming, Merlin will return all the usages of the definition corresponding to the selected identifier, all the declarations/definitions linked to that definition and all the usages of all these definitions.

This PR is based on #1857

Todo

  • Add tests

@voodoos voodoos marked this pull request as ready for review December 20, 2024 16:30
Comment on lines +172 to +175
in
Uid_map.find_opt uid related_uids
|> Option.value_map ~default:Uid_set.empty ~f:Union_find.get
|> Uid_set.to_list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a detail but:

  related_uids
  |> Uid_map.find_opt uid
  |> Option.value_map 
        ~default:[] 
        ~f:(fun x -> x |> Union_find.get |> Uid_set.to_list)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(feel free to discard the comment)

type 'a content =
| Root of { mutable value : 'a; mutable rank : int }
| Link of { mutable parent : 'a element }
and 'a element = { mutable content : 'a content }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just defining an element as a ref (since it is exactly the same type)?

and 'a element = 'a content ref

Maybe you will add, in the future, more information?>

@voodoos voodoos added this to the 5.4-503 milestone Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants