From bd623dbdef7bfdc50d404b565a1ec975e537ccd5 Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Tue, 25 Feb 2025 15:26:04 +0100 Subject: [PATCH 01/11] fix(plugin): decouple state update from the LS To enhance the reliability of Arduino IDE extensions, the update process for `ArduinoState` has been modified to ensure independence from the language server's availability. This change addresses issues caused by `compileSummary` being `undefined` due to potential startup failures of the Arduino Language Server, as noted in https://github.com/dankeboy36/esp-exception-decoder/issues/28#issuecomment-2681800772. The `compile` command now resolves with a `CompileSummary` rather than `void`, facilitating a more reliable way for extensions to access necessary data. Furthermore, the command has been adjusted to allow resolution with `undefined` when the compiled data is partial. By transitioning to direct usage of the resolved compile value for state updates, the reliance on executed commands for extensions is eliminated. This update also moves the VSIX command execution to the frontend without altering existing IDE behavior. Closes arduino/arduino-ide#2642 Signed-off-by: dankeboy36 --- .../browser/arduino-ide-frontend-module.ts | 7 ++- .../contributions/update-arduino-state.ts | 27 +++++---- .../browser/contributions/verify-sketch.ts | 56 ++++++++++++++++-- .../src/common/protocol/core-service.ts | 2 +- .../src/node/core-service-impl.ts | 57 +++++------------- .../test/browser/update-arduino-state.test.ts | 18 ++++-- .../test/node/core-service-impl.slow-test.ts | 58 +++---------------- 7 files changed, 111 insertions(+), 114 deletions(-) diff --git a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts index d6779c302..342516c0d 100644 --- a/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts +++ b/arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts @@ -131,7 +131,10 @@ import { OpenSketch } from './contributions/open-sketch'; import { Close } from './contributions/close'; import { SaveAsSketch } from './contributions/save-as-sketch'; import { SaveSketch } from './contributions/save-sketch'; -import { VerifySketch } from './contributions/verify-sketch'; +import { + CompileSummaryProvider, + VerifySketch, +} from './contributions/verify-sketch'; import { UploadSketch } from './contributions/upload-sketch'; import { CommonFrontendContribution } from './theia/core/common-frontend-contribution'; import { EditContributions } from './contributions/edit-contributions'; @@ -788,6 +791,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => { Contribution.configure(bind, BoardsDataMenuUpdater); Contribution.configure(bind, AutoSelectProgrammer); + bind(CompileSummaryProvider).toService(VerifySketch); + bindContributionProvider(bind, StartupTaskProvider); bind(StartupTaskProvider).toService(BoardsServiceProvider); // to reuse the boards config in another window diff --git a/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts b/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts index 767fbbf8c..8c09fdb99 100644 --- a/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts +++ b/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts @@ -1,13 +1,11 @@ import { DisposableCollection } from '@theia/core/lib/common/disposable'; import URI from '@theia/core/lib/common/uri'; import { inject, injectable } from '@theia/core/shared/inversify'; -import { HostedPluginSupport } from '../hosted/hosted-plugin-support'; import type { ArduinoState } from 'vscode-arduino-api'; import { + BoardsConfig, BoardsService, CompileSummary, - isCompileSummary, - BoardsConfig, PortIdentifier, resolveDetectedPort, } from '../../common/protocol'; @@ -18,8 +16,10 @@ import { } from '../../common/protocol/arduino-context-mapper'; import { BoardsDataStore } from '../boards/boards-data-store'; import { BoardsServiceProvider } from '../boards/boards-service-provider'; +import { HostedPluginSupport } from '../hosted/hosted-plugin-support'; import { CurrentSketch } from '../sketches-service-client-impl'; import { SketchContribution } from './contribution'; +import { CompileSummaryProvider } from './verify-sketch'; /** * (non-API) exported for tests @@ -43,6 +43,8 @@ export class UpdateArduinoState extends SketchContribution { private readonly boardsDataStore: BoardsDataStore; @inject(HostedPluginSupport) private readonly hostedPluginSupport: HostedPluginSupport; + @inject(CompileSummaryProvider) + private readonly compileSummaryProvider: CompileSummaryProvider; private readonly toDispose = new DisposableCollection(); @@ -60,14 +62,9 @@ export class UpdateArduinoState extends SketchContribution { this.configService.onDidChangeSketchDirUri((userDirUri) => this.updateUserDirPath(userDirUri) ), - this.commandService.onDidExecuteCommand(({ commandId, args }) => { - if ( - commandId === 'arduino.languageserver.notifyBuildDidComplete' && - isCompileSummary(args[0]) - ) { - this.updateCompileSummary(args[0]); - } - }), + this.compileSummaryProvider.onDidChangeCompileSummary(() => + this.maybeUpdateCompileSummary() + ), this.boardsDataStore.onDidChange((event) => { const selectedFqbn = this.boardsServiceProvider.boardsConfig.selectedBoard?.fqbn; @@ -88,12 +85,20 @@ export class UpdateArduinoState extends SketchContribution { this.updateSketchPath(this.sketchServiceClient.tryGetCurrentSketch()); this.updateUserDirPath(this.configService.tryGetSketchDirUri()); this.updateDataDirPath(this.configService.tryGetDataDirUri()); + this.maybeUpdateCompileSummary(); } onStop(): void { this.toDispose.dispose(); } + private maybeUpdateCompileSummary() { + const { compileSummary } = this.compileSummaryProvider; + if (compileSummary) { + this.updateCompileSummary(compileSummary); + } + } + private async updateSketchPath( sketch: CurrentSketch | undefined ): Promise { diff --git a/arduino-ide-extension/src/browser/contributions/verify-sketch.ts b/arduino-ide-extension/src/browser/contributions/verify-sketch.ts index 4d8b445e3..b11288802 100644 --- a/arduino-ide-extension/src/browser/contributions/verify-sketch.ts +++ b/arduino-ide-extension/src/browser/contributions/verify-sketch.ts @@ -1,7 +1,7 @@ -import { Emitter } from '@theia/core/lib/common/event'; +import { Emitter, Event } from '@theia/core/lib/common/event'; import { nls } from '@theia/core/lib/common/nls'; import { inject, injectable } from '@theia/core/shared/inversify'; -import type { CoreService } from '../../common/protocol'; +import type { CompileSummary, CoreService } from '../../common/protocol'; import { ArduinoMenus } from '../menu/arduino-menus'; import { CurrentSketch } from '../sketches-service-client-impl'; import { ArduinoToolbar } from '../toolbar/arduino-toolbar'; @@ -15,6 +15,12 @@ import { } from './contribution'; import { CoreErrorHandler } from './core-error-handler'; +export const CompileSummaryProvider = Symbol('CompileSummaryProvider'); +export interface CompileSummaryProvider { + readonly compileSummary: CompileSummary | undefined; + readonly onDidChangeCompileSummary: Event; +} + export type VerifySketchMode = /** * When the user explicitly triggers the verify command from the primary UI: menu, toolbar, or keybinding. The UI shows the output, updates the toolbar items state, etc. @@ -46,13 +52,18 @@ export interface VerifySketchParams { type VerifyProgress = 'idle' | VerifySketchMode; @injectable() -export class VerifySketch extends CoreServiceContribution { +export class VerifySketch + extends CoreServiceContribution + implements CompileSummaryProvider +{ @inject(CoreErrorHandler) private readonly coreErrorHandler: CoreErrorHandler; private readonly onDidChangeEmitter = new Emitter(); private readonly onDidChange = this.onDidChangeEmitter.event; + private readonly onDidChangeCompileSummaryEmitter = new Emitter(); private verifyProgress: VerifyProgress = 'idle'; + private _compileSummary: CompileSummary | undefined; override registerCommands(registry: CommandRegistry): void { registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH, { @@ -117,6 +128,14 @@ export class VerifySketch extends CoreServiceContribution { super.handleError(error); } + get compileSummary(): CompileSummary | undefined { + return this._compileSummary; + } + + get onDidChangeCompileSummary(): Event { + return this.onDidChangeCompileSummaryEmitter.event; + } + private async verifySketch( params?: VerifySketchParams ): Promise { @@ -141,7 +160,7 @@ export class VerifySketch extends CoreServiceContribution { return options; } - await this.doWithProgress({ + const compileSummary = await this.doWithProgress({ progressText: nls.localize( 'arduino/sketch/compile', 'Compiling sketch...' @@ -160,6 +179,13 @@ export class VerifySketch extends CoreServiceContribution { nls.localize('arduino/sketch/doneCompiling', 'Done compiling.'), { timeout: 3000 } ); + + this._compileSummary = compileSummary; + this.onDidChangeCompileSummaryEmitter.fire(); + if (this._compileSummary) { + this.fireBuildDidComplete(this._compileSummary); + } + // Returns with the used options for the compilation // so that follow-up tasks (such as upload) can reuse the compiled code. // Note that the `fqbn` is already decorated with the board settings, if any. @@ -201,6 +227,28 @@ export class VerifySketch extends CoreServiceContribution { compilerWarnings, }; } + + // Execute the a command contributed by the Arduino Tools VSIX to send the `ino/buildDidComplete` notification to the language server + private fireBuildDidComplete(compileSummary: CompileSummary): void { + const params = { + ...compileSummary, + }; + console.info( + `Executing 'arduino.languageserver.notifyBuildDidComplete' with ${JSON.stringify( + params.buildOutputUri + )}` + ); + this.commandService + .executeCommand('arduino.languageserver.notifyBuildDidComplete', params) + .catch((err) => + console.error( + `Unexpected error when firing event on build did complete. ${JSON.stringify( + params.buildOutputUri + )}`, + err + ) + ); + } } export namespace VerifySketch { diff --git a/arduino-ide-extension/src/common/protocol/core-service.ts b/arduino-ide-extension/src/common/protocol/core-service.ts index 2b4a07652..f4b0d8f02 100644 --- a/arduino-ide-extension/src/common/protocol/core-service.ts +++ b/arduino-ide-extension/src/common/protocol/core-service.ts @@ -171,7 +171,7 @@ export interface CoreService { compile( options: CoreService.Options.Compile, cancellationToken?: CancellationToken - ): Promise; + ): Promise; upload( options: CoreService.Options.Upload, cancellationToken?: CancellationToken diff --git a/arduino-ide-extension/src/node/core-service-impl.ts b/arduino-ide-extension/src/node/core-service-impl.ts index 285c05f72..c25bc2dd5 100644 --- a/arduino-ide-extension/src/node/core-service-impl.ts +++ b/arduino-ide-extension/src/node/core-service-impl.ts @@ -1,7 +1,6 @@ import { type ClientReadableStream } from '@grpc/grpc-js'; import { ApplicationError } from '@theia/core/lib/common/application-error'; import type { CancellationToken } from '@theia/core/lib/common/cancellation'; -import { CommandService } from '@theia/core/lib/common/command'; import { Disposable, DisposableCollection, @@ -69,15 +68,13 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService { private readonly responseService: ResponseService; @inject(MonitorManager) private readonly monitorManager: MonitorManager; - @inject(CommandService) - private readonly commandService: CommandService; @inject(BoardDiscovery) private readonly boardDiscovery: BoardDiscovery; async compile( options: CoreService.Options.Compile, cancellationToken?: CancellationToken - ): Promise { + ): Promise { const coreClient = await this.coreClient; const { client, instance } = coreClient; const request = this.compileRequest(options, instance); @@ -91,7 +88,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService { ); const toDisposeOnFinally = new DisposableCollection(handler); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { let hasRetried = false; const handleUnexpectedError = (error: Error) => { @@ -164,50 +161,24 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService { call .on('data', handler.onData) .on('error', handleError) - .on('end', resolve); + .on('end', () => { + if (isCompileSummary(compileSummary)) { + resolve(compileSummary); + } else { + console.error( + `Have not received the full compile summary from the CLI while running the compilation. ${JSON.stringify( + compileSummary + )}` + ); + resolve(undefined); + } + }); }; startCompileStream(); - }).finally(() => { - toDisposeOnFinally.dispose(); - if (!isCompileSummary(compileSummary)) { - if (cancellationToken && cancellationToken.isCancellationRequested) { - // NOOP - return; - } - console.error( - `Have not received the full compile summary from the CLI while running the compilation. ${JSON.stringify( - compileSummary - )}` - ); - } else { - this.fireBuildDidComplete(compileSummary); - } }); } - // This executes on the frontend, the VS Code extension receives it, and sends an `ino/buildDidComplete` notification to the language server. - private fireBuildDidComplete(compileSummary: CompileSummary): void { - const params = { - ...compileSummary, - }; - console.info( - `Executing 'arduino.languageserver.notifyBuildDidComplete' with ${JSON.stringify( - params.buildOutputUri - )}` - ); - this.commandService - .executeCommand('arduino.languageserver.notifyBuildDidComplete', params) - .catch((err) => - console.error( - `Unexpected error when firing event on build did complete. ${JSON.stringify( - params.buildOutputUri - )}`, - err - ) - ); - } - private compileRequest( options: CoreService.Options.Compile & { exportBinaries?: boolean; diff --git a/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts b/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts index 31a534f33..856fcebc2 100644 --- a/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts +++ b/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts @@ -31,6 +31,7 @@ import { UpdateArduinoState, UpdateStateParams, } from '../../browser/contributions/update-arduino-state'; +import { CompileSummaryProvider } from '../../browser/contributions/verify-sketch'; import { NotificationCenter } from '../../browser/notification-center'; import { CurrentSketch, @@ -61,10 +62,12 @@ describe('update-arduino-state', function () { let currentSketchMock: CurrentSketch | undefined; let sketchDirUriMock: URI | undefined; let dataDirUriMock: URI | undefined; + let compileSummary: CompileSummary | undefined; let onCurrentSketchDidChangeEmitter: Emitter; let onDataDirDidChangeEmitter: Emitter; let onSketchDirDidChangeEmitter: Emitter; let onDataStoreDidChangeEmitter: Emitter; + let compileSummaryDidChangeEmitter: Emitter; beforeEach(async () => { toDisposeAfterEach = new DisposableCollection(); @@ -76,15 +79,18 @@ describe('update-arduino-state', function () { currentSketchMock = undefined; sketchDirUriMock = undefined; dataDirUriMock = undefined; + compileSummary = undefined; onCurrentSketchDidChangeEmitter = new Emitter(); onDataDirDidChangeEmitter = new Emitter(); onSketchDirDidChangeEmitter = new Emitter(); onDataStoreDidChangeEmitter = new Emitter(); + compileSummaryDidChangeEmitter = new Emitter(); toDisposeAfterEach.pushAll([ onCurrentSketchDidChangeEmitter, onDataDirDidChangeEmitter, onSketchDirDidChangeEmitter, onDataStoreDidChangeEmitter, + compileSummaryDidChangeEmitter, ]); const container = createContainer(); @@ -418,10 +424,8 @@ describe('update-arduino-state', function () { buildPlatform: undefined, buildOutputUri: 'file:///path/to/build', }; - await commandRegistry.executeCommand( - 'arduino.languageserver.notifyBuildDidComplete', - summary - ); + compileSummary = summary; + compileSummaryDidChangeEmitter.fire(); await wait(50); const params = stateUpdateParams.filter( @@ -585,6 +589,12 @@ describe('update-arduino-state', function () { new ContainerModule((bind, unbind, isBound, rebind) => { bindSketchesContribution(bind, unbind, isBound, rebind); bind(UpdateArduinoState).toSelf().inSingletonScope(); + bind(CompileSummaryProvider).toConstantValue({ + get compileSummary(): CompileSummary | undefined { + return compileSummary; + }, + onDidChangeCompileSummary: compileSummaryDidChangeEmitter.event, + }); rebind(BoardsService).toConstantValue({ getDetectedPorts() { return {}; diff --git a/arduino-ide-extension/src/test/node/core-service-impl.slow-test.ts b/arduino-ide-extension/src/test/node/core-service-impl.slow-test.ts index dd80bca56..52b0d0444 100644 --- a/arduino-ide-extension/src/test/node/core-service-impl.slow-test.ts +++ b/arduino-ide-extension/src/test/node/core-service-impl.slow-test.ts @@ -1,12 +1,11 @@ -import { CancellationTokenSource } from '@theia/core/lib/common/cancellation'; -import { CommandRegistry } from '@theia/core/lib/common/command'; import { DisposableCollection } from '@theia/core/lib/common/disposable'; import { isWindows } from '@theia/core/lib/common/os'; import { FileUri } from '@theia/core/lib/node/file-uri'; -import { Container, injectable } from '@theia/core/shared/inversify'; +import { Container } from '@theia/core/shared/inversify'; import { expect } from 'chai'; import { BoardsService, + CompileSummary, CoreService, SketchesService, isCompileSummary, @@ -36,11 +35,9 @@ describe('core-service-impl', () => { this.timeout(testTimeout); const coreService = container.get(CoreService); const sketchesService = container.get(SketchesService); - const commandService = - container.get(TestCommandRegistry); const sketch = await sketchesService.createNewSketch(); - await coreService.compile({ + const compileSummary = await coreService.compile({ fqbn: uno, sketch, optimizeForDebug: false, @@ -48,18 +45,9 @@ describe('core-service-impl', () => { verbose: true, }); - const executedBuildDidCompleteCommands = - commandService.executedCommands.filter( - ([command]) => - command === 'arduino.languageserver.notifyBuildDidComplete' - ); - expect(executedBuildDidCompleteCommands.length).to.be.equal(1); - const [, args] = executedBuildDidCompleteCommands[0]; - expect(args.length).to.be.equal(1); - const arg = args[0]; - expect(isCompileSummary(arg)).to.be.true; - expect('buildOutputUri' in arg).to.be.true; - expect(arg.buildOutputUri).to.be.not.undefined; + expect(isCompileSummary(compileSummary)).to.be.true; + expect((compileSummary).buildOutputUri).to.be.not + .undefined; const tempBuildPaths = await sketchesService.getBuildPath(sketch); if (isWindows) { @@ -68,7 +56,7 @@ describe('core-service-impl', () => { expect(tempBuildPaths.length).to.be.equal(1); } - const { buildOutputUri } = arg; + const { buildOutputUri } = compileSummary; const buildOutputPath = FileUri.fsPath(buildOutputUri).toString(); expect(tempBuildPaths.includes(buildOutputPath)).to.be.true; }); @@ -91,35 +79,5 @@ async function start( } async function createContainer(): Promise { - return createBaseContainer({ - additionalBindings: (bind, rebind) => { - bind(TestCommandRegistry).toSelf().inSingletonScope(); - rebind(CommandRegistry).toService(TestCommandRegistry); - }, - }); -} - -@injectable() -class TestCommandRegistry extends CommandRegistry { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - readonly executedCommands: [string, any[]][] = []; - - override async executeCommand( - commandId: string, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ...args: any[] - ): Promise { - const { token } = new CancellationTokenSource(); - this.onWillExecuteCommandEmitter.fire({ - commandId, - args, - token, - waitUntil: () => { - // NOOP - }, - }); - this.executedCommands.push([commandId, args]); - this.onDidExecuteCommandEmitter.fire({ commandId, args }); - return undefined; - } + return createBaseContainer(); } From af4ab3dce731b485300447707eb4eeb9d5cc1ca3 Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Tue, 25 Feb 2025 15:44:33 +0100 Subject: [PATCH 02/11] fix: install missing libx11-dev and libxkbfile-dev Signed-off-by: dankeboy36 --- .github/workflows/check-javascript.yml | 6 ++++++ .github/workflows/check-yarn.yml | 6 ++++++ .github/workflows/test-javascript.yml | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/.github/workflows/check-javascript.yml b/.github/workflows/check-javascript.yml index 23162a19e..c36ea9e07 100644 --- a/.github/workflows/check-javascript.yml +++ b/.github/workflows/check-javascript.yml @@ -73,6 +73,12 @@ jobs: cache: yarn node-version: ${{ env.NODE_VERSION }} + - name: Install Dependencies (Ubuntu) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libx11-dev libxkbfile-dev + - name: Install npm package dependencies env: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: diff --git a/.github/workflows/check-yarn.yml b/.github/workflows/check-yarn.yml index 3b2efe92c..b14752267 100644 --- a/.github/workflows/check-yarn.yml +++ b/.github/workflows/check-yarn.yml @@ -72,6 +72,12 @@ jobs: cache: yarn node-version: ${{ env.NODE_VERSION }} + - name: Install Dependencies (Ubuntu) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libx11-dev libxkbfile-dev + - name: Install npm package dependencies env: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: diff --git a/.github/workflows/test-javascript.yml b/.github/workflows/test-javascript.yml index 2ae001c7d..d068d5818 100644 --- a/.github/workflows/test-javascript.yml +++ b/.github/workflows/test-javascript.yml @@ -107,6 +107,12 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x + - name: Install Dependencies (Ubuntu) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libx11-dev libxkbfile-dev + - name: Install npm package dependencies env: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: From 6d499dd6e4a932d119420d4c81b8ef4e94e2a7f5 Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Tue, 25 Feb 2025 15:46:04 +0100 Subject: [PATCH 03/11] fix: pick better GH step name Signed-off-by: dankeboy36 --- .github/workflows/check-javascript.yml | 2 +- .github/workflows/check-yarn.yml | 2 +- .github/workflows/test-javascript.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-javascript.yml b/.github/workflows/check-javascript.yml index c36ea9e07..6fba6b53f 100644 --- a/.github/workflows/check-javascript.yml +++ b/.github/workflows/check-javascript.yml @@ -73,7 +73,7 @@ jobs: cache: yarn node-version: ${{ env.NODE_VERSION }} - - name: Install Dependencies (Ubuntu) + - name: Install dependencies (Linux only) if: runner.os == 'Linux' run: | sudo apt-get update diff --git a/.github/workflows/check-yarn.yml b/.github/workflows/check-yarn.yml index b14752267..5db335801 100644 --- a/.github/workflows/check-yarn.yml +++ b/.github/workflows/check-yarn.yml @@ -72,7 +72,7 @@ jobs: cache: yarn node-version: ${{ env.NODE_VERSION }} - - name: Install Dependencies (Ubuntu) + - name: Install dependencies (Linux only) if: runner.os == 'Linux' run: | sudo apt-get update diff --git a/.github/workflows/test-javascript.yml b/.github/workflows/test-javascript.yml index d068d5818..1a273f235 100644 --- a/.github/workflows/test-javascript.yml +++ b/.github/workflows/test-javascript.yml @@ -107,7 +107,7 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - - name: Install Dependencies (Ubuntu) + - name: Install dependencies (Linux only) if: runner.os == 'Linux' run: | sudo apt-get update From d064ee6e877e077273b24e5cd6a04da163551665 Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Tue, 25 Feb 2025 15:49:36 +0100 Subject: [PATCH 04/11] fix: install the required dependencies on Linux Signed-off-by: dankeboy36 --- .github/workflows/check-i18n-task.yml | 6 ++++++ .github/workflows/i18n-nightly-push.yml | 6 ++++++ .github/workflows/i18n-weekly-pull.yml | 6 ++++++ .github/workflows/themes-weekly-pull.yml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/.github/workflows/check-i18n-task.yml b/.github/workflows/check-i18n-task.yml index 22426313a..df0e04d42 100644 --- a/.github/workflows/check-i18n-task.yml +++ b/.github/workflows/check-i18n-task.yml @@ -76,6 +76,12 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x + - name: Install dependencies (Linux only) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libx11-dev libxkbfile-dev + - name: Install dependencies run: yarn install --immutable env: diff --git a/.github/workflows/i18n-nightly-push.yml b/.github/workflows/i18n-nightly-push.yml index 6f401a526..e95d61a17 100644 --- a/.github/workflows/i18n-nightly-push.yml +++ b/.github/workflows/i18n-nightly-push.yml @@ -34,6 +34,12 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x + - name: Install dependencies (Linux only) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libx11-dev libxkbfile-dev + - name: Install dependencies run: yarn install --immutable diff --git a/.github/workflows/i18n-weekly-pull.yml b/.github/workflows/i18n-weekly-pull.yml index ef87c8bbb..f677b2ba4 100644 --- a/.github/workflows/i18n-weekly-pull.yml +++ b/.github/workflows/i18n-weekly-pull.yml @@ -34,6 +34,12 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x + - name: Install dependencies (Linux only) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libx11-dev libxkbfile-dev + - name: Install dependencies run: yarn install --immutable diff --git a/.github/workflows/themes-weekly-pull.yml b/.github/workflows/themes-weekly-pull.yml index 0590e421f..e106dc78f 100644 --- a/.github/workflows/themes-weekly-pull.yml +++ b/.github/workflows/themes-weekly-pull.yml @@ -36,6 +36,12 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x + - name: Install dependencies (Linux only) + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libx11-dev libxkbfile-dev + - name: Install dependencies run: yarn install --immutable From dc6bb6d344ecc37663abd9f19e0f8e15d5b3d6ca Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Thu, 27 Feb 2025 18:18:07 +0100 Subject: [PATCH 05/11] fix(revert): do not manually install deps on Linux Signed-off-by: dankeboy36 --- .github/workflows/check-i18n-task.yml | 6 ------ .github/workflows/check-javascript.yml | 6 ------ .github/workflows/check-yarn.yml | 6 ------ .github/workflows/i18n-nightly-push.yml | 6 ------ .github/workflows/i18n-weekly-pull.yml | 6 ------ .github/workflows/test-javascript.yml | 6 ------ .github/workflows/themes-weekly-pull.yml | 6 ------ 7 files changed, 42 deletions(-) diff --git a/.github/workflows/check-i18n-task.yml b/.github/workflows/check-i18n-task.yml index df0e04d42..22426313a 100644 --- a/.github/workflows/check-i18n-task.yml +++ b/.github/workflows/check-i18n-task.yml @@ -76,12 +76,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - - name: Install dependencies (Linux only) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libx11-dev libxkbfile-dev - - name: Install dependencies run: yarn install --immutable env: diff --git a/.github/workflows/check-javascript.yml b/.github/workflows/check-javascript.yml index 6fba6b53f..23162a19e 100644 --- a/.github/workflows/check-javascript.yml +++ b/.github/workflows/check-javascript.yml @@ -73,12 +73,6 @@ jobs: cache: yarn node-version: ${{ env.NODE_VERSION }} - - name: Install dependencies (Linux only) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libx11-dev libxkbfile-dev - - name: Install npm package dependencies env: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: diff --git a/.github/workflows/check-yarn.yml b/.github/workflows/check-yarn.yml index 5db335801..3b2efe92c 100644 --- a/.github/workflows/check-yarn.yml +++ b/.github/workflows/check-yarn.yml @@ -72,12 +72,6 @@ jobs: cache: yarn node-version: ${{ env.NODE_VERSION }} - - name: Install dependencies (Linux only) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libx11-dev libxkbfile-dev - - name: Install npm package dependencies env: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: diff --git a/.github/workflows/i18n-nightly-push.yml b/.github/workflows/i18n-nightly-push.yml index e95d61a17..6f401a526 100644 --- a/.github/workflows/i18n-nightly-push.yml +++ b/.github/workflows/i18n-nightly-push.yml @@ -34,12 +34,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - - name: Install dependencies (Linux only) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libx11-dev libxkbfile-dev - - name: Install dependencies run: yarn install --immutable diff --git a/.github/workflows/i18n-weekly-pull.yml b/.github/workflows/i18n-weekly-pull.yml index f677b2ba4..ef87c8bbb 100644 --- a/.github/workflows/i18n-weekly-pull.yml +++ b/.github/workflows/i18n-weekly-pull.yml @@ -34,12 +34,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - - name: Install dependencies (Linux only) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libx11-dev libxkbfile-dev - - name: Install dependencies run: yarn install --immutable diff --git a/.github/workflows/test-javascript.yml b/.github/workflows/test-javascript.yml index 1a273f235..2ae001c7d 100644 --- a/.github/workflows/test-javascript.yml +++ b/.github/workflows/test-javascript.yml @@ -107,12 +107,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - - name: Install dependencies (Linux only) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libx11-dev libxkbfile-dev - - name: Install npm package dependencies env: # Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting: diff --git a/.github/workflows/themes-weekly-pull.yml b/.github/workflows/themes-weekly-pull.yml index e106dc78f..0590e421f 100644 --- a/.github/workflows/themes-weekly-pull.yml +++ b/.github/workflows/themes-weekly-pull.yml @@ -36,12 +36,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - - name: Install dependencies (Linux only) - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y libx11-dev libxkbfile-dev - - name: Install dependencies run: yarn install --immutable From b11bde1c473322c86dfde2dd3cec3ebbf92011fa Mon Sep 17 00:00:00 2001 From: Giacomo Cusinato <7659518+giacomocusinato@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:42:14 +0700 Subject: [PATCH 06/11] chore: pin `ubuntu-22.04` for linux actions --- .github/workflows/build.yml | 20 ++++++++++---------- .github/workflows/check-certificates.yml | 4 ++-- .github/workflows/check-containers.yml | 2 +- .github/workflows/check-i18n-task.yml | 4 ++-- .github/workflows/check-javascript.yml | 4 ++-- .github/workflows/check-yarn.yml | 4 ++-- .github/workflows/compose-full-changelog.yml | 2 +- .github/workflows/i18n-nightly-push.yml | 2 +- .github/workflows/i18n-weekly-pull.yml | 2 +- .github/workflows/push-container-images.yml | 2 +- .github/workflows/sync-labels.yml | 6 +++--- .github/workflows/test-javascript.yml | 4 ++-- .github/workflows/themes-weekly-pull.yml | 2 +- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4e09b73f..2be6632f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,7 +89,7 @@ env: name: Windows_X86-64_zip - config: name: Linux - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 container: | { \"image\": \"ghcr.io/arduino/arduino-ide/linux:main\" @@ -140,7 +140,7 @@ env: jobs: run-determination: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: result: ${{ steps.determination.outputs.result }} permissions: {} @@ -166,7 +166,7 @@ jobs: build-type-determination: needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: is-release: ${{ steps.determination.outputs.is-release }} is-nightly: ${{ steps.determination.outputs.is-nightly }} @@ -207,7 +207,7 @@ jobs: select-targets: needs: build-type-determination - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: artifact-matrix: ${{ steps.assemble.outputs.artifact-matrix }} build-matrix: ${{ steps.assemble.outputs.build-matrix }} @@ -434,7 +434,7 @@ jobs: - select-targets - build if: needs.select-targets.outputs.merge-channel-files == 'true' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: {} steps: - name: Set environment variables @@ -498,7 +498,7 @@ jobs: - select-targets - build if: always() && needs.build.result != 'skipped' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: BUILD_ARTIFACTS_FOLDER: build-artifacts @@ -524,7 +524,7 @@ jobs: needs: - build-type-determination - build - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: BODY: ${{ steps.changelog.outputs.BODY }} steps: @@ -583,7 +583,7 @@ jobs: needs.changelog.result == 'success' && needs.build-type-determination.outputs.publish-to-s3 == 'true' && needs.build-type-determination.outputs.is-nightly == 'true' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: ARTIFACTS_FOLDER: build-artifacts @@ -620,7 +620,7 @@ jobs: ) && needs.changelog.result == 'success' && needs.build-type-determination.outputs.is-release == 'true' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: ARTIFACTS_FOLDER: build-artifacts @@ -668,7 +668,7 @@ jobs: - release - artifacts if: always() && needs.build.result != 'skipped' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Remove unneeded job transfer artifacts diff --git a/.github/workflows/check-certificates.yml b/.github/workflows/check-certificates.yml index adf4052be..8311bbe2c 100644 --- a/.github/workflows/check-certificates.yml +++ b/.github/workflows/check-certificates.yml @@ -22,7 +22,7 @@ env: jobs: run-determination: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: result: ${{ steps.determination.outputs.result }} steps: @@ -64,7 +64,7 @@ jobs: name: ${{ matrix.certificate.identifier }} needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false diff --git a/.github/workflows/check-containers.yml b/.github/workflows/check-containers.yml index 964867cdd..7facb3878 100644 --- a/.github/workflows/check-containers.yml +++ b/.github/workflows/check-containers.yml @@ -20,7 +20,7 @@ on: jobs: run: name: Run (${{ matrix.image.path }}) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: {} services: registry: diff --git a/.github/workflows/check-i18n-task.yml b/.github/workflows/check-i18n-task.yml index 22426313a..485f52a73 100644 --- a/.github/workflows/check-i18n-task.yml +++ b/.github/workflows/check-i18n-task.yml @@ -24,7 +24,7 @@ on: jobs: run-determination: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 outputs: result: ${{ steps.determination.outputs.result }} permissions: {} @@ -52,7 +52,7 @@ jobs: check: needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout repository diff --git a/.github/workflows/check-javascript.yml b/.github/workflows/check-javascript.yml index 23162a19e..6dd43d971 100644 --- a/.github/workflows/check-javascript.yml +++ b/.github/workflows/check-javascript.yml @@ -33,7 +33,7 @@ on: jobs: run-determination: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: {} outputs: result: ${{ steps.determination.outputs.result }} @@ -59,7 +59,7 @@ jobs: check: needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: contents: read diff --git a/.github/workflows/check-yarn.yml b/.github/workflows/check-yarn.yml index 3b2efe92c..bdc850884 100644 --- a/.github/workflows/check-yarn.yml +++ b/.github/workflows/check-yarn.yml @@ -25,7 +25,7 @@ on: jobs: run-determination: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: {} outputs: result: ${{ steps.determination.outputs.result }} @@ -52,7 +52,7 @@ jobs: name: check-sync (${{ matrix.project.path }}) needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: contents: read diff --git a/.github/workflows/compose-full-changelog.yml b/.github/workflows/compose-full-changelog.yml index d126f37f4..a58af2a6f 100644 --- a/.github/workflows/compose-full-changelog.yml +++ b/.github/workflows/compose-full-changelog.yml @@ -13,7 +13,7 @@ env: jobs: create-changelog: if: github.repository == 'arduino/arduino-ide' - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/i18n-nightly-push.yml b/.github/workflows/i18n-nightly-push.yml index 6f401a526..ddbc7615e 100644 --- a/.github/workflows/i18n-nightly-push.yml +++ b/.github/workflows/i18n-nightly-push.yml @@ -11,7 +11,7 @@ on: jobs: push-to-transifex: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/i18n-weekly-pull.yml b/.github/workflows/i18n-weekly-pull.yml index ef87c8bbb..63e803045 100644 --- a/.github/workflows/i18n-weekly-pull.yml +++ b/.github/workflows/i18n-weekly-pull.yml @@ -11,7 +11,7 @@ on: jobs: pull-from-transifex: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/push-container-images.yml b/.github/workflows/push-container-images.yml index f6a2c9a5b..e3c912074 100644 --- a/.github/workflows/push-container-images.yml +++ b/.github/workflows/push-container-images.yml @@ -28,7 +28,7 @@ jobs: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'arduino/arduino-ide' ) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: contents: read packages: write diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 22fa0d0e9..691f87fc3 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -23,7 +23,7 @@ env: jobs: check: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout repository @@ -54,7 +54,7 @@ jobs: download: needs: check - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: @@ -81,7 +81,7 @@ jobs: sync: needs: download - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Set environment variables diff --git a/.github/workflows/test-javascript.yml b/.github/workflows/test-javascript.yml index 2ae001c7d..6cb6dc4a3 100644 --- a/.github/workflows/test-javascript.yml +++ b/.github/workflows/test-javascript.yml @@ -36,7 +36,7 @@ on: jobs: run-determination: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 permissions: {} outputs: result: ${{ steps.determination.outputs.result }} @@ -77,7 +77,7 @@ jobs: - path: . operating-system: - macos-latest - - ubuntu-latest + - ubuntu-22.04 - windows-latest steps: diff --git a/.github/workflows/themes-weekly-pull.yml b/.github/workflows/themes-weekly-pull.yml index 0590e421f..1ebabc1b3 100644 --- a/.github/workflows/themes-weekly-pull.yml +++ b/.github/workflows/themes-weekly-pull.yml @@ -13,7 +13,7 @@ env: jobs: pull-from-jsonbin: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 From 1f1d749cf0e91e5bf96eb23257a2ac546b7fd21a Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Thu, 27 Feb 2025 18:22:48 +0100 Subject: [PATCH 07/11] fix: restore accidentally removed dispose on finally Signed-off-by: dankeboy36 --- arduino-ide-extension/src/node/core-service-impl.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arduino-ide-extension/src/node/core-service-impl.ts b/arduino-ide-extension/src/node/core-service-impl.ts index c25bc2dd5..2e2eb21a2 100644 --- a/arduino-ide-extension/src/node/core-service-impl.ts +++ b/arduino-ide-extension/src/node/core-service-impl.ts @@ -176,6 +176,8 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService { }; startCompileStream(); + }).finally(() => { + toDisposeOnFinally.dispose(); }); } From bab2e58ca99dd1420f595e7bbdc617a08e7273eb Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Thu, 27 Feb 2025 18:24:09 +0100 Subject: [PATCH 08/11] fix(test): align mock naming :lipstick: Signed-off-by: dankeboy36 --- .../src/test/browser/update-arduino-state.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts b/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts index 856fcebc2..c2d108cda 100644 --- a/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts +++ b/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts @@ -62,7 +62,7 @@ describe('update-arduino-state', function () { let currentSketchMock: CurrentSketch | undefined; let sketchDirUriMock: URI | undefined; let dataDirUriMock: URI | undefined; - let compileSummary: CompileSummary | undefined; + let compileSummaryMock: CompileSummary | undefined; let onCurrentSketchDidChangeEmitter: Emitter; let onDataDirDidChangeEmitter: Emitter; let onSketchDirDidChangeEmitter: Emitter; @@ -79,7 +79,7 @@ describe('update-arduino-state', function () { currentSketchMock = undefined; sketchDirUriMock = undefined; dataDirUriMock = undefined; - compileSummary = undefined; + compileSummaryMock = undefined; onCurrentSketchDidChangeEmitter = new Emitter(); onDataDirDidChangeEmitter = new Emitter(); onSketchDirDidChangeEmitter = new Emitter(); @@ -424,7 +424,7 @@ describe('update-arduino-state', function () { buildPlatform: undefined, buildOutputUri: 'file:///path/to/build', }; - compileSummary = summary; + compileSummaryMock = summary; compileSummaryDidChangeEmitter.fire(); await wait(50); @@ -591,7 +591,7 @@ describe('update-arduino-state', function () { bind(UpdateArduinoState).toSelf().inSingletonScope(); bind(CompileSummaryProvider).toConstantValue({ get compileSummary(): CompileSummary | undefined { - return compileSummary; + return compileSummaryMock; }, onDidChangeCompileSummary: compileSummaryDidChangeEmitter.event, }); From d53d8b969075359c8dc9628e301b413998b6bc33 Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Thu, 27 Feb 2025 18:36:33 +0100 Subject: [PATCH 09/11] fix: let the ino contribution notify the LS + event emitter dispatches the new state. Signed-off-by: dankeboy36 --- .../src/browser/contributions/ino-language.ts | 39 +++++++++++++++++ .../contributions/update-arduino-state.ts | 20 ++++----- .../browser/contributions/verify-sketch.ts | 43 ++++++------------- 3 files changed, 62 insertions(+), 40 deletions(-) diff --git a/arduino-ide-extension/src/browser/contributions/ino-language.ts b/arduino-ide-extension/src/browser/contributions/ino-language.ts index 4f336ef3d..4f42d399c 100644 --- a/arduino-ide-extension/src/browser/contributions/ino-language.ts +++ b/arduino-ide-extension/src/browser/contributions/ino-language.ts @@ -8,6 +8,7 @@ import { ArduinoDaemon, BoardIdentifier, BoardsService, + CompileSummary, ExecutableService, isBoardIdentifierChangeEvent, sanitizeFqbn, @@ -23,6 +24,7 @@ import { HostedPluginEvents } from '../hosted/hosted-plugin-events'; import { NotificationCenter } from '../notification-center'; import { CurrentSketch } from '../sketches-service-client-impl'; import { SketchContribution, URI } from './contribution'; +import { CompileSummaryProvider } from './verify-sketch'; interface DaemonAddress { /** @@ -107,6 +109,8 @@ export class InoLanguage extends SketchContribution { private readonly notificationCenter: NotificationCenter; @inject(BoardsDataStore) private readonly boardDataStore: BoardsDataStore; + @inject(CompileSummaryProvider) + private readonly compileSummaryProvider: CompileSummaryProvider; private readonly toDispose = new DisposableCollection(); private readonly languageServerStartMutex = new Mutex(); @@ -173,6 +177,13 @@ export class InoLanguage extends SketchContribution { } } }), + this.compileSummaryProvider.onDidChangeCompileSummary( + (compileSummary) => { + if (compileSummary) { + this.fireBuildDidComplete(compileSummary); + } + } + ), ]); Promise.all([ this.boardsServiceProvider.ready, @@ -317,4 +328,32 @@ export class InoLanguage extends SketchContribution { params ); } + + // Execute the a command contributed by the Arduino Tools VSIX to send the `ino/buildDidComplete` notification to the language server + private async fireBuildDidComplete( + compileSummary: CompileSummary + ): Promise { + const params = { + ...compileSummary, + }; + console.info( + `Executing 'arduino.languageserver.notifyBuildDidComplete' with ${JSON.stringify( + params.buildOutputUri + )}` + ); + + try { + await this.commandService.executeCommand( + 'arduino.languageserver.notifyBuildDidComplete', + params + ); + } catch (err) { + console.error( + `Unexpected error when firing event on build did complete. ${JSON.stringify( + params.buildOutputUri + )}`, + err + ); + } + } } diff --git a/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts b/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts index 8c09fdb99..bce3fa850 100644 --- a/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts +++ b/arduino-ide-extension/src/browser/contributions/update-arduino-state.ts @@ -62,8 +62,12 @@ export class UpdateArduinoState extends SketchContribution { this.configService.onDidChangeSketchDirUri((userDirUri) => this.updateUserDirPath(userDirUri) ), - this.compileSummaryProvider.onDidChangeCompileSummary(() => - this.maybeUpdateCompileSummary() + this.compileSummaryProvider.onDidChangeCompileSummary( + (compilerSummary) => { + if (compilerSummary) { + this.updateCompileSummary(compilerSummary); + } + } ), this.boardsDataStore.onDidChange((event) => { const selectedFqbn = @@ -85,20 +89,16 @@ export class UpdateArduinoState extends SketchContribution { this.updateSketchPath(this.sketchServiceClient.tryGetCurrentSketch()); this.updateUserDirPath(this.configService.tryGetSketchDirUri()); this.updateDataDirPath(this.configService.tryGetDataDirUri()); - this.maybeUpdateCompileSummary(); - } - - onStop(): void { - this.toDispose.dispose(); - } - - private maybeUpdateCompileSummary() { const { compileSummary } = this.compileSummaryProvider; if (compileSummary) { this.updateCompileSummary(compileSummary); } } + onStop(): void { + this.toDispose.dispose(); + } + private async updateSketchPath( sketch: CurrentSketch | undefined ): Promise { diff --git a/arduino-ide-extension/src/browser/contributions/verify-sketch.ts b/arduino-ide-extension/src/browser/contributions/verify-sketch.ts index b11288802..22693085e 100644 --- a/arduino-ide-extension/src/browser/contributions/verify-sketch.ts +++ b/arduino-ide-extension/src/browser/contributions/verify-sketch.ts @@ -18,7 +18,7 @@ import { CoreErrorHandler } from './core-error-handler'; export const CompileSummaryProvider = Symbol('CompileSummaryProvider'); export interface CompileSummaryProvider { readonly compileSummary: CompileSummary | undefined; - readonly onDidChangeCompileSummary: Event; + readonly onDidChangeCompileSummary: Event; } export type VerifySketchMode = @@ -61,7 +61,9 @@ export class VerifySketch private readonly onDidChangeEmitter = new Emitter(); private readonly onDidChange = this.onDidChangeEmitter.event; - private readonly onDidChangeCompileSummaryEmitter = new Emitter(); + private readonly onDidChangeCompileSummaryEmitter = new Emitter< + CompileSummary | undefined + >(); private verifyProgress: VerifyProgress = 'idle'; private _compileSummary: CompileSummary | undefined; @@ -132,7 +134,14 @@ export class VerifySketch return this._compileSummary; } - get onDidChangeCompileSummary(): Event { + private updateCompileSummary( + compileSummary: CompileSummary | undefined + ): void { + this._compileSummary = compileSummary; + this.onDidChangeCompileSummaryEmitter.fire(this._compileSummary); + } + + get onDidChangeCompileSummary(): Event { return this.onDidChangeCompileSummaryEmitter.event; } @@ -180,11 +189,7 @@ export class VerifySketch { timeout: 3000 } ); - this._compileSummary = compileSummary; - this.onDidChangeCompileSummaryEmitter.fire(); - if (this._compileSummary) { - this.fireBuildDidComplete(this._compileSummary); - } + this.updateCompileSummary(compileSummary); // Returns with the used options for the compilation // so that follow-up tasks (such as upload) can reuse the compiled code. @@ -227,28 +232,6 @@ export class VerifySketch compilerWarnings, }; } - - // Execute the a command contributed by the Arduino Tools VSIX to send the `ino/buildDidComplete` notification to the language server - private fireBuildDidComplete(compileSummary: CompileSummary): void { - const params = { - ...compileSummary, - }; - console.info( - `Executing 'arduino.languageserver.notifyBuildDidComplete' with ${JSON.stringify( - params.buildOutputUri - )}` - ); - this.commandService - .executeCommand('arduino.languageserver.notifyBuildDidComplete', params) - .catch((err) => - console.error( - `Unexpected error when firing event on build did complete. ${JSON.stringify( - params.buildOutputUri - )}`, - err - ) - ); - } } export namespace VerifySketch { From 64fdaba5172169bf6c3556647bd216ce52fd817d Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Thu, 27 Feb 2025 18:55:37 +0100 Subject: [PATCH 10/11] fix(test): emit the new compiler summary state Signed-off-by: dankeboy36 --- .../src/test/browser/update-arduino-state.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts b/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts index c2d108cda..fbbf17510 100644 --- a/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts +++ b/arduino-ide-extension/src/test/browser/update-arduino-state.test.ts @@ -67,7 +67,7 @@ describe('update-arduino-state', function () { let onDataDirDidChangeEmitter: Emitter; let onSketchDirDidChangeEmitter: Emitter; let onDataStoreDidChangeEmitter: Emitter; - let compileSummaryDidChangeEmitter: Emitter; + let compileSummaryDidChangeEmitter: Emitter; beforeEach(async () => { toDisposeAfterEach = new DisposableCollection(); @@ -425,7 +425,7 @@ describe('update-arduino-state', function () { buildOutputUri: 'file:///path/to/build', }; compileSummaryMock = summary; - compileSummaryDidChangeEmitter.fire(); + compileSummaryDidChangeEmitter.fire(compileSummaryMock); await wait(50); const params = stateUpdateParams.filter( From 0daa919ad457d628032aa9a0338912f2d9ff8739 Mon Sep 17 00:00:00 2001 From: dankeboy36 Date: Sun, 2 Mar 2025 17:15:51 +0100 Subject: [PATCH 11/11] chore(revert): unpin linux version, use latest revert of https://github.com/arduino/arduino-ide/commit/b11bde1c473322c86dfde2dd3cec3ebbf92011fa Signed-off-by: dankeboy36 --- .github/workflows/build.yml | 20 ++++++++++---------- .github/workflows/check-certificates.yml | 4 ++-- .github/workflows/check-containers.yml | 2 +- .github/workflows/check-i18n-task.yml | 4 ++-- .github/workflows/check-javascript.yml | 4 ++-- .github/workflows/check-yarn.yml | 4 ++-- .github/workflows/compose-full-changelog.yml | 2 +- .github/workflows/i18n-nightly-push.yml | 2 +- .github/workflows/i18n-weekly-pull.yml | 2 +- .github/workflows/push-container-images.yml | 2 +- .github/workflows/sync-labels.yml | 6 +++--- .github/workflows/test-javascript.yml | 4 ++-- .github/workflows/themes-weekly-pull.yml | 2 +- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2be6632f4..e4e09b73f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,7 +89,7 @@ env: name: Windows_X86-64_zip - config: name: Linux - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest container: | { \"image\": \"ghcr.io/arduino/arduino-ide/linux:main\" @@ -140,7 +140,7 @@ env: jobs: run-determination: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: result: ${{ steps.determination.outputs.result }} permissions: {} @@ -166,7 +166,7 @@ jobs: build-type-determination: needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: is-release: ${{ steps.determination.outputs.is-release }} is-nightly: ${{ steps.determination.outputs.is-nightly }} @@ -207,7 +207,7 @@ jobs: select-targets: needs: build-type-determination - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: artifact-matrix: ${{ steps.assemble.outputs.artifact-matrix }} build-matrix: ${{ steps.assemble.outputs.build-matrix }} @@ -434,7 +434,7 @@ jobs: - select-targets - build if: needs.select-targets.outputs.merge-channel-files == 'true' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: {} steps: - name: Set environment variables @@ -498,7 +498,7 @@ jobs: - select-targets - build if: always() && needs.build.result != 'skipped' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest env: BUILD_ARTIFACTS_FOLDER: build-artifacts @@ -524,7 +524,7 @@ jobs: needs: - build-type-determination - build - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: BODY: ${{ steps.changelog.outputs.BODY }} steps: @@ -583,7 +583,7 @@ jobs: needs.changelog.result == 'success' && needs.build-type-determination.outputs.publish-to-s3 == 'true' && needs.build-type-determination.outputs.is-nightly == 'true' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest env: ARTIFACTS_FOLDER: build-artifacts @@ -620,7 +620,7 @@ jobs: ) && needs.changelog.result == 'success' && needs.build-type-determination.outputs.is-release == 'true' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest env: ARTIFACTS_FOLDER: build-artifacts @@ -668,7 +668,7 @@ jobs: - release - artifacts if: always() && needs.build.result != 'skipped' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Remove unneeded job transfer artifacts diff --git a/.github/workflows/check-certificates.yml b/.github/workflows/check-certificates.yml index 8311bbe2c..adf4052be 100644 --- a/.github/workflows/check-certificates.yml +++ b/.github/workflows/check-certificates.yml @@ -22,7 +22,7 @@ env: jobs: run-determination: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: result: ${{ steps.determination.outputs.result }} steps: @@ -64,7 +64,7 @@ jobs: name: ${{ matrix.certificate.identifier }} needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/.github/workflows/check-containers.yml b/.github/workflows/check-containers.yml index 7facb3878..964867cdd 100644 --- a/.github/workflows/check-containers.yml +++ b/.github/workflows/check-containers.yml @@ -20,7 +20,7 @@ on: jobs: run: name: Run (${{ matrix.image.path }}) - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: {} services: registry: diff --git a/.github/workflows/check-i18n-task.yml b/.github/workflows/check-i18n-task.yml index 44f13442b..3064dc602 100644 --- a/.github/workflows/check-i18n-task.yml +++ b/.github/workflows/check-i18n-task.yml @@ -24,7 +24,7 @@ on: jobs: run-determination: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest outputs: result: ${{ steps.determination.outputs.result }} permissions: {} @@ -52,7 +52,7 @@ jobs: check: needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/.github/workflows/check-javascript.yml b/.github/workflows/check-javascript.yml index fe75af049..26720d48b 100644 --- a/.github/workflows/check-javascript.yml +++ b/.github/workflows/check-javascript.yml @@ -33,7 +33,7 @@ on: jobs: run-determination: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: {} outputs: result: ${{ steps.determination.outputs.result }} @@ -59,7 +59,7 @@ jobs: check: needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/check-yarn.yml b/.github/workflows/check-yarn.yml index 604a63249..019cfec88 100644 --- a/.github/workflows/check-yarn.yml +++ b/.github/workflows/check-yarn.yml @@ -25,7 +25,7 @@ on: jobs: run-determination: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: {} outputs: result: ${{ steps.determination.outputs.result }} @@ -52,7 +52,7 @@ jobs: name: check-sync (${{ matrix.project.path }}) needs: run-determination if: needs.run-determination.outputs.result == 'true' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: contents: read diff --git a/.github/workflows/compose-full-changelog.yml b/.github/workflows/compose-full-changelog.yml index a58af2a6f..d126f37f4 100644 --- a/.github/workflows/compose-full-changelog.yml +++ b/.github/workflows/compose-full-changelog.yml @@ -13,7 +13,7 @@ env: jobs: create-changelog: if: github.repository == 'arduino/arduino-ide' - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/i18n-nightly-push.yml b/.github/workflows/i18n-nightly-push.yml index 537129ac8..7b3ba2efc 100644 --- a/.github/workflows/i18n-nightly-push.yml +++ b/.github/workflows/i18n-nightly-push.yml @@ -11,7 +11,7 @@ on: jobs: push-to-transifex: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/i18n-weekly-pull.yml b/.github/workflows/i18n-weekly-pull.yml index 799f04ded..6d75556d3 100644 --- a/.github/workflows/i18n-weekly-pull.yml +++ b/.github/workflows/i18n-weekly-pull.yml @@ -11,7 +11,7 @@ on: jobs: pull-from-transifex: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/push-container-images.yml b/.github/workflows/push-container-images.yml index e3c912074..f6a2c9a5b 100644 --- a/.github/workflows/push-container-images.yml +++ b/.github/workflows/push-container-images.yml @@ -28,7 +28,7 @@ jobs: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'arduino/arduino-ide' ) - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: contents: read packages: write diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 691f87fc3..22fa0d0e9 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -23,7 +23,7 @@ env: jobs: check: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repository @@ -54,7 +54,7 @@ jobs: download: needs: check - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: matrix: @@ -81,7 +81,7 @@ jobs: sync: needs: download - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Set environment variables diff --git a/.github/workflows/test-javascript.yml b/.github/workflows/test-javascript.yml index 6c2ee327f..a1665f4f5 100644 --- a/.github/workflows/test-javascript.yml +++ b/.github/workflows/test-javascript.yml @@ -36,7 +36,7 @@ on: jobs: run-determination: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: {} outputs: result: ${{ steps.determination.outputs.result }} @@ -77,7 +77,7 @@ jobs: - path: . operating-system: - macos-latest - - ubuntu-22.04 + - ubuntu-latest - windows-latest steps: diff --git a/.github/workflows/themes-weekly-pull.yml b/.github/workflows/themes-weekly-pull.yml index cdcdff74d..4daa767ba 100644 --- a/.github/workflows/themes-weekly-pull.yml +++ b/.github/workflows/themes-weekly-pull.yml @@ -13,7 +13,7 @@ env: jobs: pull-from-jsonbin: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4