If I have a different version of myFile (or main.ml) in-memory only, I want to use dune to compile that version of the file and get the compilation output for errors or warnings.
is one of this possible?:
can I ask dune to compile that edited source code from stdin and get the compilation output ? (ideal scenario)
can I save the file to a temp directory and ask dune to build just that file from a project directory ?
If not possible can I ask dune for some compilation flags and use ocamlc to do the compilation ?
context: this is for editor integration. I don’t use LSP/merlin.
Sure, but you will need to also generate a corresponding dune file.
context: this is for editor integration. I don’t use LSP/merlin.
Maybe it would be easier if you explained what your endgoal is. The next version of dune will have an RPC protocol to interact with editors (see Dune RPC — Dune documentation), perhaps it wil be helpful?
My end goal is to get compilation errors/warnings for an edited file that is in memory only, to report these errors as user edit the file.
I didn’t know about dune rpc, but in my view, it would be better if I can avoid to start a daemon process and just use a one time background process when needed.
I didn’t know about dune rpc, but in my view, it would be better if I can avoid to start a daemon process and just use a one time background process when needed.
If your plan is to provide information as soon as the user inputs something you probably want to spare the starting time of the dune process which can be quite long in big projects.