-
Notifications
You must be signed in to change notification settings - Fork 235
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
Global API search #61
Comments
Just wanted to link this to the issue I opened via the VSCode OCaml Platform; "list all global references" would be absolutely amazing: |
Hey there! This has recently become somewhat critical for refactoring one of our projects. Happy to contribute back to the ecosystem, if it's within my ablity — @roshanjames pointed out that "Merlin has all of the infrastructure required for this"; is this indeed the case? Any pointers towards getting started, if I wanted to dive in and implement this feature? |
There’s ongoing work: ocaml/dune#6762 |
Does this mean this functionality would require Dune and would not directly be part of Merlin? |
I've been looking into his work; it includes forks of Merlin, ocaml-lsp, and so on to integrate. However, it does require the indexes be generated (and in particular merged across the project), and that's indeed dependent on Dune. I found this test-file for the underlying single-file index-generator (ocaml-uideps) illuminating: |
It requires an indexing phase. Indexation of individual CMT files and merging of indexes is done by a new independent binary. This binary needs to be adequately driven on a given project to generate the index. We are going to provide a set of Dune rules that builds the index, but any other build system could be adapted to do the same. Everything is still WIP but we plan to provide a simple way to test the current dev version soon! |
Just to be clear, the first version of the index aims at searching all usages of a specific definition which is primarily a navigation tool. It might be helpful when performing refactoring but does not guaranty correctness (for example, the same declaration can have multiple definitions and a correct renaming would rename all occurrences of all these definitions). However it is a major step toward (correct) renaming of values across the project. |
Great! Thank you for the hard work. For various reason, I am using a Makefile-based build so I only ask to keep us non-Dune-folks in mind. But sounds like you have. Again, thanks, I'm really looking forward to this feature. |
Yep, totally aware — haven't completed evaluation yet, but tentatively, we may allow Dune to orchestrate (We mainly want information about unreferenced values; which, based on my understanding, is something that we can extract out of your work. At least, it's sure looking like it thus far! If this works out well, would you likely accept a PR providing something like |
Yes, the index could eventually be used to list values that are exported by a module but never referenced by others. |
Now that ocaml/dune#10422 has been merged, what's the next step for support in Merlin? Is this something that anyone can contribute to? |
Consider building a global API search. Merlin has all of the infrastructure required for this. TBD.
The text was updated successfully, but these errors were encountered: