Skip to content

Skips Starting DartToolingDaemonService after initial 'pub get' #419

@JavadAsadi

Description

@JavadAsadi
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions