From 1926f35d7493e4407fa7e1fd86497184d72f8299 Mon Sep 17 00:00:00 2001 From: "Vladimir.Koshelev" Date: Mon, 3 Nov 2025 13:27:23 +0100 Subject: [PATCH] [python] PY-83881 use project service to cancel project configuration on closing the project. (cherry picked from commit fb57a6ca4cdd77d2a725a083e91659829924748a) IJ-CR-181097 GitOrigin-RevId: 845c1c89b2ff86eace4d1e9b2b9f2e283d4b8995 --- .../pycharm/community/ide/impl/PythonSdkConfigurator.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/python/ide/impl/src/com/intellij/pycharm/community/ide/impl/PythonSdkConfigurator.kt b/python/ide/impl/src/com/intellij/pycharm/community/ide/impl/PythonSdkConfigurator.kt index a5ef08e87932..1823c6b4a81b 100644 --- a/python/ide/impl/src/com/intellij/pycharm/community/ide/impl/PythonSdkConfigurator.kt +++ b/python/ide/impl/src/com/intellij/pycharm/community/ide/impl/PythonSdkConfigurator.kt @@ -33,7 +33,6 @@ import com.intellij.python.sdkConfigurator.common.enableSDKAutoConfigurator import com.intellij.util.PlatformUtils import com.jetbrains.python.PyBundle import com.jetbrains.python.getOrLogException -import com.jetbrains.python.packaging.utils.PyPackageCoroutine import com.jetbrains.python.sdk.* import com.jetbrains.python.sdk.conda.PyCondaSdkCustomizer import com.jetbrains.python.sdk.configuration.CreateSdkInfo @@ -80,7 +79,7 @@ class PythonSdkConfigurator : DirectoryProjectConfigurator { StartupManager.getInstance(project).runWhenProjectIsInitialized(object : Runnable, DumbAware { override fun run() { if (module.isDisposed) return - service().coroutineScope.launch { + project.service().coroutineScope.launch { val sdkInfos = findSuitableCreateSdkInfos(module) withBackgroundProgress(project, PySdkBundle.message("python.configuring.interpreter.progress"), true) { val lifetime = suppressTipAndInspectionsFor(module, "all suitable extensions") @@ -271,5 +270,5 @@ class PythonSdkConfigurator : DirectoryProjectConfigurator { } } -@Service -private class MyCoroutineScopeProvider(val coroutineScope: CoroutineScope) +@Service(Service.Level.PROJECT) +private class MyCoroutineScopeProvider(private val project: Project, val coroutineScope: CoroutineScope)