Sharing damlc instances between IDE and compile

My IDE uses damlc for syntax highlighting (DAML-on-vim), and I then separately use damlc in a Makefile to compile the same large project.

Each instances of that process uses several GB of memory. The former runs continuously in the background.

I’m wondreing whether there is some way for the compilation process to piggy-back onto the IDE process, as they’re both ingesting the exact same input files? This would save me a considerable amount of memory.
Could this also speed up part of the compilation as the IDE is continuously checking for syntax errors?

At the moment there is no way to do this.

In principle something like this would be possible and we did consider doing this at some point. There are few issues here:

  1. It means you have to load the whole project in the IDE instead of only the files you’re working on. Since the IDE does more in some regards than the compiler this could mean that the shared component takes up more memory than the IDE and compiler take up on their own.
  2. Non-deterministic compilation. You already get that in incremental mode so not a big deal but still annoying.
  3. You loose the ability to make optimizations that are beneficial to the IDE but detrimental to CLI compilation. For the former, displaying errors in the file you are currently working on quickly is much more important than the time it takes until all files that depend on this file have been retypechecked. For CLI compilation the primary metric is the total time it takes until you get the DAR.

None of this is a blocker and I think it’s still a reasonable idea but at the time, we decided to not prioritize it.