Eclipse progress bars hook
Would it be possible to have eclipse progress bars for what kind of stratego calls are running in the editor?
There are already progress bars for:
- builders from the menu
- running build project
But after building my project the cpu is busy for another 20 seconds (probably analysis), I would like to see what is actually the thing that is busy.
It would be very nice if there was a bar: analyzing, where the message would change with each next file.
Is there a hook for this in Spoofax?
(And the next thing would be to implement the cancel button, and have the top strategy fail)Submitted by Daco Harkes on 28 February 2014 at 14:26
Those 20 seconds are spent processing the background analysis queue which gets filled with jobs for all Stratego files in your project after building (because Stratego analysis is not incremental). There is no easy way to show a progress bar for this without hacking in the background analysis queue. If you’d like to try, check out the https://github.com/metaborg/spoofax/blob/master/org.strategoxt.imp.runtime/src/org/strategoxt/imp/runtime/services/StrategoAnalysisQueue.java class.
There are hooks for showing progress in Stratego, see bottom of lib/editor-common.generated.str.
I think this should go beyond just progress bars for Stratego. There are two worlds here: the Java world and the Stratego world, but both are glued together by Spoofax. If we want proper progress bars and cancellation support we probably need to make every Stratego/Java call a separate Job and run each asynchronously in a worker pool. The latter needs investigation anyway since it appears that on the one hand the pool is of infinite size and on the other hand that some things are not jobs. An issue here is as Lennart mentioned (in other issue) that some things in Spoofax still run in the UI thread.
Regarding cancellation i think i have an idea on how to improve cancellability of interpreted code, i need to look into whether this would work for compiled Stratego as well. In any case if a thread is stuck and loops in a single Stratego call (without altering the Stratego call frames) then graceful cancellation is virtually impossible. Forceful cancellation as we use in Labback is probably too dangerous in an IDE setting.
I investigated the progress bars from stratego, but these only work for background tasks, so you do not get the result of the task.
Also the implementation uses StrategoAnalysisQueueFactory, which seems to be specific for analysis but not for any stratego call in general.
Log in to post comments