How to inform nvim which *.ml files are OCaml vs ReScript

I actually prefer *.ml syntax to *.res syntax.

How do I inform nvim which *.ml files are OCaml and which are ReScript? (This matters for auto completion / syntax highlighting / firing up the right lsp server).

This seems to be connected to your other question about the completion when using the ocaml syntax to write rescript…did you get that solved?

A semi-long while back, you could use the normal tooling and it would work okay (I was doing it, but haven’t done it this way in a long time). But it seems it is not straightforward now (and I don’t mean that as a criticism, btw).

Not sure about vim specifically, but just to test it out in vscode, I first disabled the current ocaml lsp vscode plugin (it doesn’t work with rescript anymore), then installed the old reasonml-vscode extension, as well as bs-platform alongside the normal rescript plugin, and it worked “fine” (as in you get your autocompletion and highlighting and stuff in both the rescript and ocaml syntax files). So, you likely could get a setup working in vim as well. But note that all of these tools aren’t really supported anymore.

However, I think you should be aware that you are going to be swimming upstream so to speak if you are set on using the ocaml syntax. If you search through the forum post history on the subject you will see a lot of interesting posts with much more details, but my sense is that rescript should be written in rescript syntax going forward. (Other community members may have a different sense of it of course.)