dune
dune copied to clipboard
Add command wrapping ocamlformat
Adds a command dune tools exec ocamlformat which downloads and builds ocamlformat as a dev tool before running it, passing all positional arguments to the ocamlformat executable. This is intended to be run by text editors.
I found an issue with this where if opam is installed but no switch is set then dune tools exec ocamlformat won't fall back to a globally-installed instance of ocamlformat. Will fix.
I found an issue with this where if opam is installed but no switch is set then
dune tools exec ocamlformatwon't fall back to a globally-installed instance of ocamlformat. Will fix.
This is now fixed.
I don't understand why the opam switch create test is failing. I can reproduce it on the main branch locally but error doesn't make sense to me based on the vendored copy of pp. In any case it's not related to this change.
I think we just need to update our vendored copy of pp
I've updated this PR to remove any fallback behaviour. Changes that extend environments to allow dev tools to call each other can come in a later change.
I've updated this PR to remove any fallback behaviour. Changes that extend environments to allow dev tools to call each other can come in a later change.
The dev tools calling each other is temporary ? I wonder when we start having different versions of ocamlformat in a global cache to prevent rebuilding ocamlformat when switching on different projects, how we could deal with it.
The dev tools calling each other is temporary ?
Why would it be temporary?
I wonder when we start having different versions of ocamlformat in a global cache to prevent rebuilding ocamlformat when switching on different projects, how we could deal with it.
We'll always have the option to extend the environment of dev tools to include all the other dev tools in PATH. That's what my ocamllsp wrapper script does, but this behavour could also be built in to dune (not in this PR though).
Is anything else required before this can be merged?
Ah looks like it doesn't build after rebasing. Will fix.
Ok I fixed the build error. Is anything else needed before this can be merged?