Allow customisation of VS Code executable

This commit is contained in:
baldurk
2026-08-13 17:46:44 +01:00
parent ca0ac6157a
commit c97850e39b
5 changed files with 55 additions and 4 deletions
@@ -388,6 +388,12 @@ DECLARE_REFLECTION_STRUCT(BugReport);
":type: str"); \
CONFIG_SETTING_VAL(public, QString, rdcstr, Python_DebugPyDir, "") \
\
DOCUMENT( \
"The path to the VSCode ``code`` command line executable to use." \
"" \
":type: str"); \
CONFIG_SETTING_VAL(public, QString, rdcstr, Python_VSCodePath, "") \
\
DOCUMENT( \
"List of extra directories to write python stubs into.\n" \
"\n:" \
@@ -2432,7 +2432,10 @@ void PythonContext::LaunchDebugger(QWidget *window, PersistantConfig &config, QS
PyGILState_Release(gil);
QString code_path = QStandardPaths::findExecutable(lit("code"));
QString code_path = config.Python_VSCodePath;
if(!QFileInfo(code_path).isExecutable())
code_path = QStandardPaths::findExecutable(lit("code"));
if(!debugger_connected && !code_path.isEmpty())
{
@@ -312,6 +312,7 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
ui->Python_PromptReloadUnchanged->setChecked(m_Ctx.Config().Python_PromptReloadUnchanged);
ui->Python_DebugPyDir->setText(m_Ctx.Config().Python_DebugPyDir);
ui->Python_VSCodePath->setText(m_Ctx.Config().Python_VSCodePath);
ui->Comments_ShowOnLoad->setChecked(m_Ctx.Config().Comments_ShowOnLoad);
@@ -873,6 +874,28 @@ void SettingsDialog::on_Python_DebugPyDir_textEdited(const QString &dir)
m_Ctx.Config().Save();
}
void SettingsDialog::on_Python_VSCodePathBrowse_clicked()
{
QString dir = RDDialog::getExecutableFileName(this, tr("Choose location of code executable"),
m_Ctx.Config().Python_VSCodePath, lit("code"));
if(!dir.isEmpty() && QFileInfo(dir).isExecutable())
{
m_Ctx.Config().Python_VSCodePath = dir;
ui->Python_VSCodePath->setText(dir);
}
m_Ctx.Config().Save();
}
void SettingsDialog::on_Python_VSCodePath_textEdited(const QString &path)
{
if(QFileInfo(path).isExecutable() || path.isEmpty())
m_Ctx.Config().Python_DebugPyDir = path;
m_Ctx.Config().Save();
}
void SettingsDialog::on_Python_DebugEnabled_toggled(bool checked)
{
m_Ctx.Config().Python_DebugEnabled = ui->Python_DebugEnabled->isChecked();
@@ -85,6 +85,8 @@ private slots:
void on_Python_StubPaths_clicked();
void on_Python_DebugPyDirBrowse_clicked();
void on_Python_DebugPyDir_textEdited(const QString &dir);
void on_Python_VSCodePathBrowse_clicked();
void on_Python_VSCodePath_textEdited(const QString &dir);
void on_Python_DebugEnabled_toggled(bool checked);
void on_Python_LaunchVSCode_toggled(bool checked);
void on_Python_PromptReloadUnchanged_toggled(bool checked);
+20 -3
View File
@@ -770,14 +770,31 @@ If disabled, debugging will do nothing and wait for a debugger connection.</stri
</property>
</widget>
</item>
<item row="5" column="0">
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="Python_VSCodePathLabel">
<property name="text">
<string>Location of VSCode 'code' executable</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLineEdit" name="Python_VSCodePath"/>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="Python_VSCodePathBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="Python_PromptReloadUnchangedLabel">
<property name="text">
<string>Prompt for reload unmodified scripts with changes from disk</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="7" column="1">
<widget class="QCheckBox" name="Python_PromptReloadUnchanged">
<property name="toolTip">
<string>If a script open in the python editor has changes on disk but has not been modified in the UI,
@@ -788,7 +805,7 @@ prompt when reloading from disk.</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="8" column="0" colspan="2">
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>