private suspend fun startAnalysisServerIfNeeded(project: Project) {
if (DartModuleBuilder.isPubGetScheduledForNewlyCreatedProject(project)) {
// We want to start Analysis Server after the initial 'pub get' is finished, this will be done in DartPubActionBase
return
}
if (DartSdk.getDartSdk(project) == null) return
if (ModuleManager.getInstance(project).modules.find { DartSdkLibUtil.isDartSdkEnabled(it) } == null) return
readActionBlocking {
DartAnalysisServerService.getInstance(project).serverReadyForRequest()
}
if (Registry.`is`("dart.launch.dtd.and.devtools", false)) {
DartToolingDaemonService.getInstance(project).startService()
}
}
In DartStartupActivity.kt in the startAnalysisServerIfNeeded function when the first condition is true the code does not call DartToolingDaemonService.getInstance(project).startService().
In DartPubActionBase.kt:242:
override fun processTerminated(event: ProcessEvent) {
ourInProgress.set(false)
ApplicationManager.getApplication().invokeLater {
if (!module.isDisposed) {
excludeBuildAndToolCacheFolders(module, pubspecYamlFile)
// refresh later than exclude, otherwise IDE may start indexing excluded folders
VfsUtil.markDirtyAndRefresh(true, true, true, pubspecYamlFile.parent)
if (DartSdkLibUtil.isDartSdkEnabled(module)) {
DartAnalysisServerService.getInstance(module.project).serverReadyForRequest()
}
}
}
}
DartAnalysisServerService is started but not the DartToolingDaemonService. So I think the DartToolingDaemonService is not initiated in the first run.
One more note I would like to mention regarding the DartStartupActivity.kt:
- It uses the CoroutineScope from DartAnalysisServerService to run DartToolingDaemonService.
In DartStartupActivity.kt in the startAnalysisServerIfNeeded function when the first condition is true the code does not call
DartToolingDaemonService.getInstance(project).startService().In
DartPubActionBase.kt:242:DartAnalysisServerService is started but not the DartToolingDaemonService. So I think the DartToolingDaemonService is not initiated in the first run.
One more note I would like to mention regarding the
DartStartupActivity.kt: