From e71389d8b87929057095be8755c50029da314ebc Mon Sep 17 00:00:00 2001 From: Vitaly Legchilkin Date: Thu, 19 Feb 2026 15:53:15 +0100 Subject: [PATCH] PY-87710 Simplify Black formatter package installation (cherry picked from commit 43ee408dc90203f15b2c5d4bcef79652f73a1d37) GitOrigin-RevId: 42922f32cf5485da5a48e1ed2de4d3f986cc711e --- .../configuration/BlackFormatterConfigurable.kt | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/python/src/com/jetbrains/python/black/configuration/BlackFormatterConfigurable.kt b/python/src/com/jetbrains/python/black/configuration/BlackFormatterConfigurable.kt index e9183cccf7ae..570b35741e15 100644 --- a/python/src/com/jetbrains/python/black/configuration/BlackFormatterConfigurable.kt +++ b/python/src/com/jetbrains/python/black/configuration/BlackFormatterConfigurable.kt @@ -145,15 +145,10 @@ class BlackFormatterConfigurable(val project: Project) : BoundConfigurable(PyBun .applyToComponent { icon = AllIcons.General.Warning } .component installButton = button(PyBundle.message("black.install.button.label")) { - runWithModalProgressBlocking(ModalTaskOwner.project(project), PyBundle.message("black.installing.modal.title")) { - if (selectedSdk != null) { - PythonPackageManagerUI.forSdk(project, selectedSdk!!).installPackageBackground(BlackFormatterUtil.PACKAGE_NAME)?.let { - withContext(Dispatchers.EDT) { - isBlackFormatterPackageInstalled = true - enableOnReformatCheckBox.isSelected = true - } - } - } + val sdk = selectedSdk ?: return@button + PythonPackageManagerUI.forSdk(project, sdk).installPackagesWithModalProgressBlocking(BlackFormatterUtil.PACKAGE_NAME)?.let { + isBlackFormatterPackageInstalled = true + enableOnReformatCheckBox.isSelected = true } updateUiState() }.component