Closed edwintorok closed 1 year ago
You're checking for the .merlin relative to the source file that is being syntax checked, right?
Yes it looks in the same directory as the source file, and then goes up the directory tree, if it finds a .merlin
it activates flycheck:
(when (and buffer-file-name (locate-dominating-file buffer-file-name ".merlin"))
Let's see if I managed to get this right. Haven't worked on flycheck in ages!
Ha, it seems that by the time I implemented this it's no longer relevant https://tarides.com/blog/2021-01-26-recent-and-upcoming-changes-to-merlin :-)
The .merlin
file is not necessary for a long time now, when you use dune
, and the project I am working on typically don’t have one. So I had to remove the check for flycheck-ocaml
to work again as intended.
@lthms I've already removed it here as well and I replaced it with a check for dune-project
.
FYI, this is both unnecessary (merlin definitely does not require dune, nor is a .merlin
file strictly required) as well as annoying (because now flycheck will refuse to check files that merlin itself could check fine; for example, a standalone .ml
script, or a file that uses other modules and .cmi
s are present). I recommend removing the check for dune-project
or .merlin
entirely.
@drvink I get that's not strictly necessary, but based on my experience you don't get anything meaningful from Merlin without some setup for it. Admittedly, I'm far from a Merlin expert, but if we remove this check we'd still need some meaningful way to tell the users what's missing on their end.
I think it's good enough to just show whether a .merlin
and/or dune-project
file was found in flycheck-verify-setup
rather than refusing to run the checker.
In doom-emacs I've activated
flycheck-ocaml
only when a.merlin
file is present in the project, and intend to do the same in Spacemacs.Should this be done in flycheck-ocaml itself?
The rationale is that if there is no
.merlin
file you will likely get a lot of errors reported because merlin won't be able to find the include paths for all the modules that you use and you'd end up turning off flycheck anyway. A.merlin
file is present if thejbuilder
/dune
build system is used, or if a project manually supplies one (they used to do that beforejbuilder
appeared).