From 1ef886f94b95e60a0213cd2f7b5dd18a559d382c Mon Sep 17 00:00:00 2001 From: Michalis Kamburelis Date: Tue, 24 Sep 2024 04:39:32 +0200 Subject: [PATCH] Do not start pasls without valid PP --- .vscode/settings.json | 1 + src/castleConfiguration.js | 1 - src/castlePascalLanguageServer.js | 8 ++++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c892181..702257a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,6 +20,7 @@ "markdowndescription", "pasls", "spammy", + "Testcase", "theangryepicbanana", "Typecheck", "unregisters", diff --git a/src/castleConfiguration.js b/src/castleConfiguration.js index f74bfd4..78b5efb 100644 --- a/src/castleConfiguration.js +++ b/src/castleConfiguration.js @@ -362,7 +362,6 @@ class CastleConfiguration { // exit with clear error message when FPC compiler not found if (fpcExe === '') { - vscode.window.showErrorMessage('FPC compiler executable not configured and not found on the PATH. Configure the FPC compiler location in the extension settings.'); return; } diff --git a/src/castlePascalLanguageServer.js b/src/castlePascalLanguageServer.js index 5c98b9d..ad6c747 100644 --- a/src/castlePascalLanguageServer.js +++ b/src/castlePascalLanguageServer.js @@ -46,6 +46,14 @@ class CastlePascalLanguageServer { this.environmentForPascalServer['FPCTARGET'] = this._castleConfig.fpcTargetOs; this.environmentForPascalServer['FPCTARGETCPU'] = this._castleConfig.fpcTargetCpu; + /* pasls cannot work without FPC executable. + Testcase: without this line, editing settings of PP back and forth + from valid to invalid FPC executable location, would cause a number + of errors that pasls cannot be stopped because it is still starting. */ + if (this._castleConfig.fpcExecutablePath === '') { + return false; + } + /* We need to set environment variable CASTLE_ENGINE_PATH, this is how we pass engine path (maybe from $CASTLE_ENGINE_PATH, maybe from VS extension config) to pasls. */