I am sure that the intersection of OCaml users and Acme users is small, but I have reason to believe it is a non-zero set . For those of you using this spartan editor, here are some plumbing rules that I use that allow me to right-click on error messages returned by the OCaml compilers, and jump to the referenced location in acme:
# example: in file "foo/bar.ml", line 155, characters 30-62
type is text
data matches '.*[Ff]ile "([^"]+)", line ([0-9]+), characters ([0-9]+)-([0-9]+).*'$nl'?'
arg isfile $1
data set $file
attr add addr=$2-#0+#$3,$2-#0+#$4
plumb to edit
plumb client $editor
# example: File "tests/dune", line 2, characters 7-22:
type is text
data matches '.*[Ff]ile "([^"]+)", lines ([0-9]+)-([0-9]+).*'$nl'?'
arg isfile $1
data set $file
attr add addr=$2,$3
plumb to edit
plumb client $editor
It could probably be extended to search ~/.opam
so you could plumb errors in files outside of your project, but I do not use opam, so I haven’t needed to do it.
Here is a short demo of its use: Plumb OCaml error messages from acme - YouTube
It’s not in OCaml, but I also wrote https://github.com/droyo/acme-autoformat and put an OcamlFmt
script in acme’s $PATH like so:
#!/bin/sh
exec /usr/local/bin/acme-autoformat -r '\.mli?$' \
-- ocamlformat --name='{{.Basename}}' --enable-outside-detected-project -
This calls ocamlformat
whenever I Put an .ml[i] file. This is probably obviated by combining acme-lsp and ocaml-lsp, but these two bits work well enough that I haven’t felt a need to pursue it.