Re: automatically resolving open?
Ulysse Gérard <[email protected]> Thu, 24 Apr 2025 15:44:01 +0200
| Newsgroups | gmane.comp.lang.caml.inria |
|---|---|
| Message-ID | <[email protected]> |
> On 24 Apr 2025, at 15:06, Kenichi Asai <[email protected]> wrote: > > Thank you all for the information. I realize the problem is much > harder than I first thought. But the refactor open of Merlin appears > to be the closest to what I wanted. I confirmed that I can add and > remove module names in emacs and VS Code. Can I do the same thing > using a stand-alone command line tool? If not, can I do it from the > VS Code extension programatically? You can try to query manually to Merlin directly from the command line. For that you will still need to build your project so that the configuration is available. Then you will want to run something like this: > ocamlmerlin single refactor-open -action qualify -position 4:6 -filename path/to/file.ml <path/to/file.ml (note that you need to input the file content on stdin or the call will hang) And then parse the output... The commands are documented here: https://github.com/ocaml/merlin/blob/main/doc/dev/PROTOCOL.md You can find examples in the test suite: https://github.com/ocaml/merlin/tree/main/tests/test-dirs/refactor-open > >> It appears to be working in only one direction however: from the >> `open` statement it is possible to qualifying all identifiers coming >> from that statement. > > In my environment, I could do both direction. That's good to know !