Emacs on windows, merlin mode, merlin server remote on linux, tramp, ssh

I managed to set up Emacs + TRAMP + LSP to do remote development (not on the first attempt though, as these things were quite fiddly to set up).

Here’s what I got:

  1. You need opam install ocaml-lsp-server on the remote machine.
  2. Tell TRAMP to use path from the remote shell: (add-to-list 'tramp-remote-path 'tramp-own-remote-path)
  3. Use Eglot as an LSP client. Although, lsp-mode claims that they support remote servers, I couldn’t quite make it work with lsp-mode. This is what I have in my init.el:
(require 'eglot)
(add-hook 'tuareg-mode-hook #'eglot-ensure)