Skip to content

2.0.0-beta.3 – Updated to 2.0.0-beta.3. Use CLI 0.16.1. #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arduino-ide-extension",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"description": "An extension for Theia building the Arduino IDE",
"license": "MIT",
"scripts": {
Expand Down Expand Up @@ -124,11 +124,7 @@
],
"arduino": {
"cli": {
"version": {
"owner": "arduino",
"repo": "arduino-cli",
"commitish": "scerza/lib-install-deps"
}
"version": "0.16.1"
}
}
}
44 changes: 33 additions & 11 deletions arduino-ide-extension/src/browser/arduino-frontend-contribution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,27 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
protected async startLanguageServer(fqbn: string, name: string | undefined): Promise<void> {
const release = await this.languageServerStartMutex.acquire();
try {
await this.hostedPluginSupport.didStart;
const details = await this.boardsService.getBoardDetails({ fqbn });
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) {
// NOOP
return;
}
await this.hostedPluginSupport.didStart;
this.logger.info(`Starting language server: ${fqbn}`);
const log = this.arduinoPreferences.get('arduino.language.log');
let currentSketchPath: string | undefined = undefined;
Expand All @@ -249,16 +265,22 @@ export class ArduinoFrontendContribution implements FrontendApplicationContribut
this.fileSystem.fsPath(new URI(cliUri)),
this.fileSystem.fsPath(new URI(lsUri)),
]);
this.languageServerFqbn = await this.commandRegistry.executeCommand('arduino.languageserver.start', {
lsPath,
cliPath,
clangdPath,
log: currentSketchPath ? currentSketchPath : log,
board: {
fqbn,
name: name ? `"${name}"` : undefined
}
});
this.languageServerFqbn = await Promise.race([
new Promise<undefined>((_, reject) => setTimeout(() => reject(new Error(`Timeout after ${20_000} ms.`)), 20_000)),
this.commandRegistry.executeCommand<string>('arduino.languageserver.start', {
lsPath,
cliPath,
clangdPath,
log: currentSketchPath ? currentSketchPath : log,
board: {
fqbn,
name: name ? `"${name}"` : undefined
}
})
]);
} catch (e) {
console.log(`Failed to start language server for ${fqbn}`, e);
this.languageServerFqbn = undefined;
} finally {
release();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ export class BoardsServiceProvider implements FrontendApplicationContribution {
if (selectedBoard && selectedBoard.fqbn) {
const uninstalledBoard = event.item.boards.find(({ name }) => name === selectedBoard.name);
if (uninstalledBoard && uninstalledBoard.fqbn === selectedBoard.fqbn) {
// We should not unset the FQBN, if the selected board is an attached, recognized board.
// Attach Uno and install AVR, select Uno. Uninstall the AVR core while Uno is selected. We do not want to discard the FQBN of the Uno board.
// Dev note: We cannot assume the `selectedBoard` is a type of `AvailableBoard`.
// When the user selects an `AvailableBoard` it works, but between app start/stops,
// it is just a FQBN, so we need to find the `selected` board among the `AvailableBoards`
const selectedAvailableBoard = AvailableBoard.is(selectedBoard)
? selectedBoard
: this._availableBoards.find(availableBoard => Board.sameAs(availableBoard, selectedBoard));
if (selectedAvailableBoard && selectedAvailableBoard.selected && selectedAvailableBoard.state === AvailableBoard.State.recognized) {
return;
}
this.logger.info(`Board package ${event.item.id} was uninstalled. Discarding the FQBN of the currently selected ${selectedBoard.name} board.`);
const selectedBoardWithoutFqbn = {
name: selectedBoard.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ export class LibraryListWidget extends ListWidget<LibraryPackage> {
installDependencies = false;
}
}
} else {
// The lib does not have any dependencies.
installDependencies = false;
}

if (typeof installDependencies === 'boolean') {
Expand Down
4 changes: 2 additions & 2 deletions browser-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "browser-app",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"license": "MIT",
"dependencies": {
"@theia/core": "next",
Expand All @@ -18,7 +18,7 @@
"@theia/process": "next",
"@theia/terminal": "next",
"@theia/workspace": "next",
"arduino-ide-extension": "2.0.0-beta.2"
"arduino-ide-extension": "2.0.0-beta.3"
},
"devDependencies": {
"@theia/cli": "next"
Expand Down
4 changes: 2 additions & 2 deletions electron-app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "electron-app",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"license": "MIT",
"main": "src-gen/frontend/electron-main.js",
"dependencies": {
Expand All @@ -20,7 +20,7 @@
"@theia/process": "next",
"@theia/terminal": "next",
"@theia/workspace": "next",
"arduino-ide-extension": "2.0.0-beta.2"
"arduino-ide-extension": "2.0.0-beta.3"
},
"devDependencies": {
"@theia/cli": "next"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arduino-editor",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"description": "Arduino IDE",
"repository": "https://github.com/bcmi-labs/arduino-editor.git",
"author": "Arduino SA",
Expand Down