solvuu-build icon indicating copy to clipboard operation
solvuu-build copied to clipboard

More complete merlin file

Open copy opened this issue 7 years ago • 4 comments

Currently the following are missing from .merlin files:

  1. A FLG -w directive according to the ~w argument
  2. safe_string, strict_sequence, short_paths if they are set
  3. As a bonus, it would be awesome if solvuu-build could generate location information according to this, i.e. CMT /home/user/.opam/build/$PKG/** or similar

copy avatar Nov 15 '16 13:11 copy

FLG directives for -w, -safe-string, and -short-paths are generated as of 52f5f575a25089487c050fd3299b0cf1ec0b0446.

-strict-sequence should be easy to add, but I didn't do it yet because it should be supported in the type of lib and app too, not just for merlin files.

I'll have to read more about item 3.

agarwal avatar Nov 15 '16 22:11 agarwal

b1e88b9f9e0d20f28e9eada4d8cac281de29c860 adds support for -strict-sequence.

agarwal avatar Nov 18 '16 20:11 agarwal

I'm uncertain which directory to give to the CMT directives. The link you provided implies that you have to tell opam to keep the build directory, but I find plenty of .cmt files installed in opam's lib dir. For example, all project's using solvuu-build install the .cmt files. 😄

We could follow this heuristic:

  • check if there are .cmt files in the lib dir and if so use that dir
  • else check if there is a build dir and if it has .cmt files, if so use that dir
  • else omit the CMT directive for this package

Does that sound correct?

agarwal avatar Nov 18 '16 20:11 agarwal

If the cmt files are within the lib folder, merlin locates them automatically (if the package is referenced using PKG), so adding a CMT directive to the lib folder is not necessary. However the lib folder often does not contain the .ml files, so pointing to the build folder is still useful for jump-to-definition to libraries. So I'd suggest adding the CMT directive to the build folder for all packages.

copy avatar Nov 19 '16 10:11 copy