override fun setupConfigurationFromContext()

in rider/src/main/kotlin/com/jetbrains/aspire/rider/run/host/AspireHostRunConfigurationProducer.kt [42:74]


    override fun setupConfigurationFromContext(
        configuration: AspireHostConfiguration,
        context: ConfigurationContext,
        sourceElement: Ref<PsiElement?>
    ): Boolean {
        val selectedProjectFilePath = context.getSelectedProject()?.getFile()?.systemIndependentPath
            ?: return false

        val runnableProjects = context.project.solution.runnableProjectsModel.projects.valueOrNull ?: return false
        val runnableProject = runnableProjects.firstOrNull {
            it.kind == AspireRunnableProjectKinds.AspireHost &&
                    FileUtil.toSystemIndependentName(it.projectFilePath) == selectedProjectFilePath
        } ?: return false

        if (configuration.name.isEmpty()) {
            configuration.name = runnableProject.name
        }

        val projectOutput = runnableProject
            .projectOutputs
            .firstOrNull()
        val profile = LaunchSettingsJsonService
            .getInstance(context.project)
            .getFirstOrNullLaunchProfileProfile(runnableProject)

        configuration.parameters.setUpFromRunnableProject(
            runnableProject,
            projectOutput,
            profile
        )

        return true
    }