Add entrypoint for compile progress notifications
See original GitHub issueBuild tools have ways to hook into compilers to get progress notifications. For example, this is Zinc’s interface:
/*
* Zinc - The incremental compiler for Scala.
* Copyright 2011 - 2017, Lightbend, Inc.
* Copyright 2008 - 2010, Mark Harrah
* This software is released under the terms written in LICENSE.
*/
package xsbti.compile;
/**
* An API for reporting when files are being compiled.
*
* This design is tied to the Scala compiler but it is used
* by the Java compiler too, check the docs of the methods.
*/
public interface CompileProgress {
/**
* Start the progress of a concrete phase for the path of a given
* compilation unit.
*
* @param phase The phase of the compiler being run.
* @param unitPath The path of the compilation unit. It will be empty
* when a Java compiler is reporting the progress.
*/
void startUnit(String phase, String unitPath);
/**
* Advance the progress of the current unit.
*
* @param current The current progress.
* @param total The total of the progress that has to be achieved.
*
* @return Whether the user has cancelled compilation or not.
*/
boolean advance(int current, int total);
}
Progress notifications are useful to notify users of IDEs and editors how is compilation going, and have a feeling of what are the slow phases (or even the slow compilation units) to compile. The best way to know that you have a slow project to compile is to expose this information to the users!
This ticket registers my intention of adding such an entrypoint in BSP, under the name of buildTarget/showCompileProgress
. I haven’t yet figured out the right interface, but it would look similar to Zinc’s interface. We may even need to define two events to support every method, and then an event kind to the ShowCompileProgressParams
.
This entrypoint would allow IntelliJ, for example, to mimic the same user experience than the built-in “Build Project” which shows compilation progress notifications in a small event window at the bottom right.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:14 (14 by maintainers)
Top GitHub Comments
For reference, the progress API in the IntelliJ build tool window looks like this:
Yes that seems better. We can define standard data objects that will be sent for compile, test and other builtins, but allow the server to define their own.
In that vein, should we replace compileResult / testResult notifications with taskFinish notifications with result data object?