void () { // Delay scanning tasks until after all the scheduled dumb tasks are finished. // For example, PythonLanguageLevelPusher.initExtra is invoked from RequiredForSmartModeActivity and may submit additional dumb tasks. // We want scanning to start after all these "extra" dumb tasks are finished. // Note that a project may become dumb/smart immediately after the check // If a project becomes smart, in the worst case, we'll trigger additional short dumb mode. // If a project becomes dumb, not a problem at all - we'll schedule a scanning task out of dumb mode either way. if (DumbService.isDumb(myProject) && Registry.is("scanning.waits.for.non.dumb.mode", true)) { new DumbModeTask() { @Override public void performInDumbMode(@NotNull ProgressIndicator indicator) { UnindexedFilesScannerExecutor.getInstance(myProject).submitTask(UnindexedFilesScanner.this); } }.queue(myProject); } else { UnindexedFilesScannerExecutor.getInstance(myProject).submitTask(this); } }