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

Global API search #61

Open
roshanjames opened this issue Aug 16, 2013 · 11 comments
Open

Global API search #61

roshanjames opened this issue Aug 16, 2013 · 11 comments

Comments

@roshanjames
Copy link

Consider building a global API search. Merlin has all of the infrastructure required for this. TBD.

@ELLIOTTCABLE
Copy link
Contributor

Just wanted to link this to the issue I opened via the VSCode OCaml Platform; "list all global references" would be absolutely amazing:

ocaml/ocaml-lsp#646

@ELLIOTTCABLE
Copy link
Contributor

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?

@ulugbekna
Copy link
Contributor

ulugbekna commented Jan 10, 2023

There’s ongoing work: ocaml/dune#6762

@orbitz
Copy link
Contributor

orbitz commented Jan 10, 2023

Does this mean this functionality would require Dune and would not directly be part of Merlin?

@ELLIOTTCABLE
Copy link
Contributor

ELLIOTTCABLE commented Jan 10, 2023

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:

https://github.com/voodoos/ocaml-uideps/blob/0f033aee4a2915078d77ad9bfc43892d022fd73e/tests/tuideps.t#L18-L52

@voodoos
Copy link
Collaborator

voodoos commented Jan 11, 2023

Does this mean this functionality would require Dune and would not directly be part of Merlin?

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!

@voodoos
Copy link
Collaborator

voodoos commented Jan 11, 2023

Hey there! This has recently become somewhat critical for refactoring one of our projects

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.

@orbitz
Copy link
Contributor

orbitz commented Jan 11, 2023

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.

@ELLIOTTCABLE
Copy link
Contributor

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.

Yep, totally aware — haven't completed evaluation yet, but tentatively, we may allow Dune to orchestrate ocaml-uideps, then script consumption of the .uideps files.

(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 ocaml-uideps --unused to dump a report on interface-items with no external references?)

@voodoos
Copy link
Collaborator

voodoos commented Jan 17, 2023

(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 ocaml-uideps --unused to dump a report on interface-items with no external references?)

Yes, the index could eventually be used to list values that are exported by a module but never referenced by others.

@NoahTheDuke
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants