Skip to content
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

Automatically generating .merlin files trounces customisations.. #4209

Closed
progman1 opened this issue Feb 10, 2021 · 4 comments
Closed

Automatically generating .merlin files trounces customisations.. #4209

progman1 opened this issue Feb 10, 2021 · 4 comments
Assignees

Comments

@progman1
Copy link

the generated .merlin files point to the opam installation libraries.
they don't allow source exploration beyond .mli's and wrapping .ml's
so I added directives to point to the installed sources and build directories.
this is all well and good until a dune build and then those changes are gone.

is there any way to disable overwriting of customised .merlins or allow for user addiitions
to them?

@ghost ghost assigned voodoos Feb 10, 2021
@voodoos
Copy link
Collaborator

voodoos commented Feb 12, 2021

If I am not mistaken in latests versions of Dune (>= 2.8) .merlin files are not promoted any more to the sources so custom .merlin files should be ignored by Dune (after the first cleanup after upgrading).
However because Dune does not generate a .merlin anymore it will need to be entirely written from scratch.

You can use (in a project built with dune 2.8) the command dune ocaml-merlin --dump-config="$(pwd)" from within your source dir to print the content of the generated config in sexp format.

We may add a way to easily print directectives à-la .merlin for customization.

@progman1
Copy link
Author

can you consider retaining reading of .merlin files for the express purpose of
augmenting the directives generated from 'dune ocaml-merlin' ?
I want for merlin to not say 'no definition found' when it is simply lacking
additional places to look.
ie. not losing the auto-generated/communicated directives

or consider allowing a way to generate a .merlin as needed, which can then be customised
and then be part of the source (copied to _build) , thereafter overriding ocaml-merlin
communicated info (until such time as deleted by user)

@voodoos
Copy link
Collaborator

voodoos commented Feb 18, 2021

or consider allowing a way to generate a .merlin as needed, which can then be customised
and then be part of the source (copied to _build) , thereafter overriding ocaml-merlin
communicated info (until such time as deleted by user)

It is actually being worked on right now: #4250
We will provide a command to print configuration information in the correct syntax. Then you can rework that to make a .merlin file that Merlin will give priority to and Dune won't delete on clean.

@emillon
Copy link
Collaborator

emillon commented Aug 1, 2022

This is now implemented - you can start from the generated .merlin file and it will be picked if it exists in the source tree.

@emillon emillon closed this as completed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants