When I press M-.
or C-c C-l
it usually jumps to the function's declaration in .mli file. Oftentimes there is associated .ml file to which I can switch with C-c C-a
but then, I have to search for the implementation of this function in it manually.
If there is an easy way to either jump directly to a definition in .ml file or somehow position to the corresponding function location when switching between .mli and .ml?
This is governed by the merlin-locate-preference
variable, which documentation says:
Determine whether locate should in priority look in ml or mli files.
So you will land to the implementation, if it is available, once the variable is set to 'ml
:
(setq merlin-locate-preference 'ml)
It is interesting though, that it defaults to 'ml
so that either you overwrote it or merlin jumps to mli because it can't find the definition. If you want to jump to the definition in another project, then add corresponding S
and B
clauses to your .merlin
file.