Show progress when pre-calculating the AST during save #2414 - #2415
Show progress when pre-calculating the AST during save #2414#2415fedejeanne wants to merge 1 commit into
Conversation
|
Test failures are unrelated. I ran them all and they pass locally. |
In general you cannot conclude that there is no issue when tests run through locally. It might be right in this case but is not in general. |
596a4ae to
086a0a4
Compare
|
@carstenartur the test failures are unrelated and they are documented in #2423. Since that issue has been fixed last week (see https://ci.eclipse.org/jdt/job/eclipse.jdt.ui-github/job/master/474/testReport/), I rebased on |
|
I'm drafting this PR since I have no intention of merging it before M1 |
086a0a4 to
15548ff
Compare
|
This PR is ready to be reviewed. Even if the progress bar doesn't move (which is outside of the control of this PR), showing the progress dialog will IMO still improve the UX since the user at least will know that something is being done in the background. Better than a UI freeze. |
d36ec68 to
abffb5f
Compare
abffb5f to
f8d950e
Compare
f8d950e to
fcd1c39
Compare
|
I used I updated the description of this PR to reflect these changes. This PR is ready to be reviewed. |
What it does
Fixes #2414
Show a progress dialog (after a delay) if the precalculation of the AST during a save takes too long.
RequiresMay be tested together withThe aforementioned PRs must not necessarily be merged before this one, but it would be nice to have them since they would avoid the "flickering" of the progress dialog showing up and immediately disappearing when the calculations of the AST and/or the cleanup changes take just a few milliseconds.
How to test
Expected outcome
If the AST takes a while to calculate then you should see a (non-cancelable) progress dialog with a moving progress bar (
IProgressMonitor.UNKNOWN).Also, if calculating the changes takes a while, you should see another (non-cancelable) progress dialog with a moving progress bar (
IProgressMonitor.UNKNOWN).A small hack to help testing
You can simulate these long-running operations from the issue...
... by adding a delay like this one...
...to
org.eclipse.jdt.internal.corext.fix.CleanUpPostSaveListener.createAst(ICompilationUnit, Map<String, String>, IProgressMonitor)(1) and another delay inorg.eclipse.jdt.core.dom.ASTParser.createAST(IProgressMonitor)(2). Technically, the delay in theASTParsershould be enough to simulate both scenarios, but since the call toSharedASTProviderCore.getAST(...);insideCleanUpPostSaveListener.createAst(...)passesSharedASTProviderCore.WAIT_NOas parameter, it is really unlikely that the call will reach as deep asASTParser::createAST.Author checklist