Skip to content

Make the Arduino state update (for extensions) independent of the language server availability #2642

Closed
@dankeboy36

Description

@dankeboy36

Describe the request

To enhance the reliability of Arduino IDE extensions, IDE needs to ensure that the Arduino state updates are independent of the language server's availability.

As highlighted at dankeboy36/esp-exception-decoder#28 (comment), the compileSummary of the ArduinoState may be undefined due to potential startup failures of the Arduino Language Server. This scenario can lead to issues for extensions developed for the Arduino IDE.

To mitigate this issue, I propose decoupling the ArduinoState update process from the language server itself. Given that the compile summary is already accessible, IDE should modify the compile command to resolve with a CompileSummary rather than void. Additionally, the compile command should be relaxed to resolve with undefined when the data is partial.

Instead of relying on executed commands to monitor the compile summary, IDE will directly use the resolved compile value to update the state for extensions. Furthermore, the frontend will dispatch the notification that a build has occurred directly from the frontend to the VS Code extension. This should help provide data for extensions reliably and not change the existing IDE behavior.

Describe the current behavior

IDE backend directly executes the command to update the build path after a verify:

this.fireBuildDidComplete(compileSummary);

IDE updates the ArduinoState after the successful command execution:

if (
commandId === 'arduino.languageserver.notifyBuildDidComplete' &&
isCompileSummary(args[0])
) {
this.updateCompileSummary(args[0]);
}

Arduino IDE version

2.3.4

Operating system

macOS

Operating system version

15.3.1

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions