diff --git a/python/pluginResources/intellij.python.community.impl.xml b/python/pluginResources/intellij.python.community.impl.xml index 87b2c43ca45d..daa6e6805cca 100644 --- a/python/pluginResources/intellij.python.community.impl.xml +++ b/python/pluginResources/intellij.python.community.impl.xml @@ -198,6 +198,7 @@ overrides="true"/> + diff --git a/python/src/com/jetbrains/python/run/PythonCommandLineState.java b/python/src/com/jetbrains/python/run/PythonCommandLineState.java index 8dd3893a8e91..f448dcef3b9a 100644 --- a/python/src/com/jetbrains/python/run/PythonCommandLineState.java +++ b/python/src/com/jetbrains/python/run/PythonCommandLineState.java @@ -95,6 +95,7 @@ import java.util.function.Function; import static com.intellij.execution.util.EnvFilesUtilKt.configureEnvsFromFiles; import static com.jetbrains.python.run.PythonScriptCommandLineState.getExpandedWorkingDir; import static com.jetbrains.python.run.features.PyRunToolExtKt.useRunTool; +import static com.jetbrains.python.run.features.PyRunToolProviderKt.getEnableRunTool; /** * Since this state is async, any method could be called on any thread @@ -352,7 +353,7 @@ public abstract class PythonCommandLineState extends CommandLineState { .toList(); PyRunToolParameters runToolParameters = null; - if (sdk != null) { + if (sdk != null && getEnableRunTool()) { PyRunToolProvider runToolProvider = PyRunToolProvider.forSdk(sdk); if (runToolProvider != null && useRunTool(myConfig, sdk)) { runToolParameters = runToolProvider.getRunToolParameters(); diff --git a/python/src/com/jetbrains/python/run/configuration/AbstractPythonConfigurationFragmentedEditor.kt b/python/src/com/jetbrains/python/run/configuration/AbstractPythonConfigurationFragmentedEditor.kt index 75a266087659..57744e494a0f 100644 --- a/python/src/com/jetbrains/python/run/configuration/AbstractPythonConfigurationFragmentedEditor.kt +++ b/python/src/com/jetbrains/python/run/configuration/AbstractPythonConfigurationFragmentedEditor.kt @@ -12,6 +12,7 @@ import com.jetbrains.python.run.AbstractPythonRunConfiguration import com.jetbrains.python.run.PyCommonFragmentsBuilder import com.jetbrains.python.run.PythonRunConfigurationExtensionsManager import com.jetbrains.python.run.features.PyRunToolProvider +import com.jetbrains.python.run.features.enableRunTool import com.jetbrains.python.run.features.useRunTool import java.awt.event.ComponentAdapter import java.awt.event.ComponentEvent @@ -31,9 +32,9 @@ abstract class AbstractPythonConfigurationFragmentedEditor - createRunToolTag(sdk)?.let { fragments.add(it) } - } + runConfiguration.sdk?.takeIf { enableRunTool } + ?.let { createRunToolTag(it) } + ?.let { fragments.add(it) } customizeFragments(fragments) fragments.add(PyEditorExtensionFragment()) diff --git a/python/src/com/jetbrains/python/run/features/PyRunToolProvider.kt b/python/src/com/jetbrains/python/run/features/PyRunToolProvider.kt index 05af09be6645..06aeb31b6980 100644 --- a/python/src/com/jetbrains/python/run/features/PyRunToolProvider.kt +++ b/python/src/com/jetbrains/python/run/features/PyRunToolProvider.kt @@ -3,10 +3,16 @@ package com.jetbrains.python.run.features import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.projectRoots.Sdk +import com.intellij.openapi.util.registry.Registry import org.jetbrains.annotations.ApiStatus import org.jetbrains.annotations.Nls import org.jetbrains.annotations.NonNls +/** + * Feature flag for Python "Run with …" tool integration. + */ +internal val enableRunTool: Boolean get() = Registry.`is`("run.with.py.tool") + @JvmInline @ApiStatus.Internal value class PyRunToolId(@param:NonNls val value: String)