diff --git a/qrenderdoc/Code/Interface/PersistantConfig.h b/qrenderdoc/Code/Interface/PersistantConfig.h index c2ca7b1c3..690e5896a 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.h +++ b/qrenderdoc/Code/Interface/PersistantConfig.h @@ -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:" \ diff --git a/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp b/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp index 26de3b7fb..954200c11 100644 --- a/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp +++ b/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp @@ -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()) { diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp index 53f77fab2..47062d809 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp @@ -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(); diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.h b/qrenderdoc/Windows/Dialogs/SettingsDialog.h index 1d23fb592..af7fff685 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.h +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.h @@ -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); diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.ui b/qrenderdoc/Windows/Dialogs/SettingsDialog.ui index aeab48043..975a9e86f 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.ui +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.ui @@ -770,14 +770,31 @@ If disabled, debugging will do nothing and wait for a debugger connection. - + + + + Location of VSCode 'code' executable + + + + + + + + + + Browse + + + + Prompt for reload unmodified scripts with changes from disk - + 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. - + Qt::Vertical