From: "Ulysse Gérard" <ulysse@u31.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] automatically resolving open?
Date: Thu, 24 Apr 2025 11:16:36 +0200 [thread overview]
Message-ID: <AD786728-24F9-44BE-A33D-696DE3E2872C@u31.fr> (raw)
In-Reply-To: <6891bc81-fff2-4cd7-989b-0de1b7517eed@m4x.org>
Refactor open is actually a feature of Merlin which have long been exposed in the custom protocol:
https://github.com/ocaml/merlin/blob/main/doc/dev/PROTOCOL.md#refactor-open--postion-position--action-qualifyunqualify
- In the merlin.el mode the commands are: `merlin-refactor-open` and `merlin-refactor-open-qualify`.
- In the vim plugin it is `merlin#RefactorOpen`.
- In LSP based plugins, such as `ocaml-eglot` for emacs and `vscode-ocaml-platform`, it is available as a code action. 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.
As for other solutions, potential shadowing is not checked. This is a fairly obscur command of Merlin, please open an issue if you encounter any issue. Additionally, if someone wants to step in to improve the feature in LSP we will be happy to welcome their contribution :-)
Ulysse
> On 24 Apr 2025, at 08:39, Virgile Prevosto <virgile.prevosto@m4x.org> wrote:
>
> Hello,
>
> this is one of the built-in transformations offered by the recently advertised `ocamlmig` tool:
> https://github.com/v-gb/ocamlmig/blob/main/doc/using.md#removing-opens
> However, it comes with caveats, including that "when identifiers are requalified, not all possible shadowings are taken into account" (and I've checked that indeed in François' example we end up with a `List.map` below the `module List = struct end`...)
>
> Best regards,
next prev parent reply other threads:[~2025-04-24 9:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 14:10 Kenichi Asai
2025-04-23 14:32 ` Francois Pottier
2025-04-23 14:38 ` BOBOT François
2025-04-23 14:45 ` Ivan Gotovchits
2025-04-23 15:33 ` Jeremy Yallop
2025-04-24 4:33 ` Oleg
2025-04-24 6:39 ` Virgile Prevosto
2025-04-24 9:16 ` Ulysse Gérard [this message]
2025-04-24 13:06 ` Kenichi Asai
2025-04-24 13:44 ` Ulysse Gérard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AD786728-24F9-44BE-A33D-696DE3E2872C@u31.fr \
--to=ulysse@u31.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox