From 8e1feb36ff11169579359cbe3e6868407ed3f2c2 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Thu, 25 Feb 2021 15:25:18 +0100 Subject: [PATCH] Stop LS when user picks a board that has no core. Signed-off-by: Akos Kitta --- .../src/browser/arduino-frontend-contribution.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx b/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx index 0e7b68a2..092834fc 100644 --- a/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx +++ b/arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx @@ -234,6 +234,16 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut if (!details) { // Core is not installed for the selected board. console.info(`Could not start language server for ${fqbn}. The core is not installed for the board.`); + if (this.languageServerFqbn) { + try { + await this.commandRegistry.executeCommand('arduino.languageserver.stop'); + console.info(`Stopped language server process for ${this.languageServerFqbn}.`); + this.languageServerFqbn = undefined; + } catch (e) { + console.error(`Failed to start language server process for ${this.languageServerFqbn}`, e); + throw e; + } + } return; } if (fqbn === this.languageServerFqbn) {