-
Notifications
You must be signed in to change notification settings - Fork 234
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
Support "Find occurrences" at whole project scale, not just inside the current file #377
Comments
I started work on this a few weeks ago, but I don't have time for it right now… |
Thanks! 👍 |
Hi, I feel always a bit bad when reviving a 4 year old issue 😅 but I found this issue while looking for a way to find project-wise occurrences (currently limited to the current file). The issue #156 is kind of misleading, one has to read carefully through the thread to understand it only works in the current file. I propose this issue is renamed to better reflect the feature request: Support "Find occurrences" in the project, not just in the current file. What do you think? 6 years later, does someone have any idea if this feature is:
I have the secret (though probably unrealistic 😁 ) hope that current knowledge would make this implementation easier than it was back then 🤞 As a recent OCaml developer, this would be an amazing feature to work on medium to large projects (where grepping gives too many false-positives) 🙏 Project-wise renaming would be the cherry on top, but finding occurrences alone would be an amazing step forward already. |
@sir4ur0n there is ocp-grep, if you are really dying for something. |
So I gave a serious shot to Unfortunately there are several shortcomings to this tool:
I don't mean to be unfair to As Merlin seems to be the standard OCaml development tool, I think it would make sense to add this "Find occurrences" feature. What do the maintainers think about this?
I just want to thank again the maintainers because what Merlin currently does, it does really well (I am often baffled by how well it keeps working below lines that don't compile) 🙇 |
Re: find occurrences in merlin I was recently onboarded to work on editor experience for OCaml projects. I find "occurrences" as important as you do especially when working with new projects. There are some other tasks that I will need to complete before however, including work on other aspects of occurrences. So, if you want the feature asap and anyone wants to point you in the right direction (I can't since I'm new to merlin codebase myself), then it may be indeed a good idea to give it a try yourself. |
Hi, The answer is definitely "Makes sense, we will work on it (assuming we have time, etc.) / are already working on it" :) Historically Merlin has been supporting a wide range of versions and this has made this kind of feature difficult to support. Now that a given version of merlin only support the latest compiler, it can leverage more precise compiler information. For example, finding where a value comes from can be a tricky question to define. It used to be tracked by source location, but this is not always a 1:1 mapping (for example with generated code). With things like ocaml/ocaml#8934 merged in the compiler it means that merlin can have a more precise view of how definitions, declarations and usage are linked. All of these features (more precise jumps, cross-module uses, better renaming) are on merlin's roadmap so you should be able to see some improvements later this year. |
Any progress? |
Yes, we've progressed by at least one more (significant) step with some recent changes that were made to the compiler ( https://github.com/ocaml/ocaml/blob/trunk/Changes#L658 ). At this point everything we would need from the compiler for a project-wide "find occurences" functionality is present in 4.14. What we need is to build the actual tooling around it; which implies merlin but also some cooperation from dune and other build systems. We have no ETA for the finished feature yet, but the work is progressing steadily. |
The ability to search for occurrences of a symbol across a project is very useful. I was wondering if any more progress had been made on this @voodoos @trefis I am willing to work on this feature to make it happen. However, I don't know Merlin internals but I'm willing to learn. Let me know if it would be efficient to be guided to build this feature and I can volunteer. |
Very exciting! If there is a public branch available to check this out do let us know :-) ! |
For anyone looking this seems to work using LSP in the most recent version https://discuss.ocaml.org/t/ann-project-wide-occurrences-in-merlin-and-lsp/14847/1 Requires a |
Indeed, since Merlin 5.2-502 one can perform project-wide usages searches ! Meta-issue tracking bugs and future work related to that feature: #1780 |
merlin-locate is project-wise
merlin-occurrences is just current-buffer
Can't we have a merlin-occurrences that is project-wise?
The text was updated successfully, but these errors were encountered: