From 9da0d7106e94f6a1d90a67861e54123c30165a66 Mon Sep 17 00:00:00 2001 From: Morgan Bartholomew Date: Fri, 24 Oct 2025 15:41:55 +1000 Subject: [PATCH] [python] PY-85014/PY-85037 `PyLspToolConfigurable` work - fixed path mode not being able to find the executable at all - switched mode to a segmented button - don't show install button for path mode - don't show install button when no interpreter specified - use `PySdkListCellRenderer` for interpreter dropdown - hard code spacing of label column - auto detect tools in path mode - path validation (cherry picked from commit fe7d2b4701a5350896bb6ca173d133f8ffc54fb7) GitOrigin-RevId: 465a939326e86f284eda8fb3faa90165800df468 --- .../messages/PyBundle.properties | 21 ++++++++++++------- .../configuration/PyLspToolConfiguration.kt | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/python/pluginResources/messages/PyBundle.properties b/python/pluginResources/messages/PyBundle.properties index 64bcece6c638..bee41ed64e3e 100644 --- a/python/pluginResources/messages/PyBundle.properties +++ b/python/pluginResources/messages/PyBundle.properties @@ -1559,6 +1559,19 @@ sdk.not.configured.error.title=SDK not configured remote.sdk.exception.text=Invocation in Package mode is not allowed on remote SDKs getting.version=Getting version\u2026 select.path.to.executable=Select Path to Executable +tool.executable.not.found=Unable to auto-detect executable in $PATH +dialog.message.must.not.be.empty=Must not be empty +dialog.message.must.be.absolute=Must be absolute +dialog.message.not.found=Not found +dialog.message.must.not.be.directory=Must not be a directory +dialog.message.not.executable=Not executable +button.install=Install {0} +label.features=Features: +checkbox.inspections=Inspections +checkbox.completions=Completions +checkbox.inlay.hints=Inlay hints +label.package.not.installed.in.current.interpreter={0} package is not installed in the current interpreter +modal.progress.title.installing=Installing {0}\u2026 inlay.parameters.python.show.class.constructor.call.parameter.names=Class constructor calls inlay.parameters.python.show.hints.for.non-literal.arguments=Non-literal arguments @@ -1740,14 +1753,6 @@ pycharm.free.mode.upgrade.button=Purchase Subscription python.packaging.sync.packages=Syncing project dependencies python.sdk.read.only=Python SDK ''{0}'' is read only and operation cannot be performed. read.only.python.sdk.system.wide.read.only.message=Modify packages of System Python is forbidden. To modify use another interpreter. -button.install=Install {0} -label.features=Features: -checkbox.inspections=Inspections -checkbox.completions=Completions -checkbox.inlay.hints=Inlay hints -label.features=Features: -label.package.not.installed.in.current.interpreter={0} package is not installed in the current interpreter -modal.progress.title.installing=Installing {0}\u2026 tracecontext.detecting.poetry.executable=Detecting Poetry Executable tracecontext.detecting.pip.executable=Detecting Pip Executable tracecontext.detecting.uv.executable=Detecting uv Executable diff --git a/python/src/com/jetbrains/python/externaltools/configuration/PyLspToolConfiguration.kt b/python/src/com/jetbrains/python/externaltools/configuration/PyLspToolConfiguration.kt index d692a40b203d..8e0be2449f76 100644 --- a/python/src/com/jetbrains/python/externaltools/configuration/PyLspToolConfiguration.kt +++ b/python/src/com/jetbrains/python/externaltools/configuration/PyLspToolConfiguration.kt @@ -16,8 +16,8 @@ abstract class PyLspToolConfiguration> : P */ open var inlayHints: Boolean? = null var executableDiscoveryMode: ExecutableDiscoveryMode = ExecutableDiscoveryMode.INTERPRETER - var pathToExecutable: String? = null - val executablePath: Path? = pathToExecutable?.let { Path(it) } + var pathToExecutable: String = "" + val executablePath: Path? get() = pathToExecutable.ifEmpty { null }?.let { Path(it) } var sdkName: String = DEFAULT_ENVIRONMENT final override fun getState(): State = this as State