-
Notifications
You must be signed in to change notification settings - Fork 470
[merlin] Incoming changes to dune ocaml-merlin #4217
Description
The disposal of .merlin based Merlin configuration was a major change in Dune 2.8 and issues appeared in some untested setups. This issue summarize these problems with known workarounds and candidate solutions. Most of these should be fixed for Dune 2.9.
✅ 1. Dune and Merlin disagree on paths when workspace is in a symlinked folder
- Workaround:
cdto the "real" directory before starting hacking. - Solution: exchange paths relative to the CWD of
dune ocaml-merlin
instead of absolute paths.
✅ 2. On Windows Dune and Merlin disagree with how absolute path should look like
Which case ? forward or backward slashes ? etc. That means upgrading to Dune 2.8
breaks Windows setup using both Merlin and Ocaml-LSP
- Workaround: No easy workaround
- Solution: on Windows (and Cygwin)
dune ocaml-merlinshould lowercase
the paths before comparing them. Also using relatives paths as for issue 1
should make the process more robust.
☑️ 4. Now that each module has a precise configuration, files must bear a module name
Files with an ill-formed module name like mymodule.foo.ml do not have any
configuration loaded. Previously Merlin would always load the generic
configuration for the whole directory, including for source files which does not
reflect a valid module name.
- Workaround: write a
.merlinfile by hand. This can be a daunghting
task for massive libraries/executables. - Possible solutions:
- Keep track of Dune copy rules to know the module name (I don't know if that is possible) ?
- ✅ Decide of a file naming convention for that case:
module_name.xxxxx.ml? - Add a command line parameter for
dune ocaml-merlinto dump a generic
.merlinfile (with commented Preprocessing instructions). - Always generate an additional generic configuration that is given to
Merlin if the filename does not match any known module.
✅ 5. Merlin files
I feel like in any case we should have a possibility to have .merlin back
for users with non-standard setups by either:
- Giving the ability to extract
.merlinfiles once by using a specialdune ocaml-merlin --dump-merlin-filesparameter. - Or adding an option to the
dune-projectfile to enable approximate.merlin
files promotion as before.
CC @rgrinberg @jeremiedimino @emillon @trefis
For item 4 (not-a-module-name) I am in favour of solution iv and for item 5 (merlin-files) I am in favor of solution 1, dumping a file with merged configurations (the same as the generic configuration that would be generated for 4.iv) and commented preprocessing directives.