Stop LS when user picks a board that has no core.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2021-02-25 15:25:18 +01:00 committed by Akos Kitta
parent cdadda85e5
commit 8e1feb36ff

View File

@ -234,6 +234,16 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
if (!details) { if (!details) {
// Core is not installed for the selected board. // 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.`); 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; return;
} }
if (fqbn === this.languageServerFqbn) { if (fqbn === this.languageServerFqbn) {