Skip to content
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

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

Closed
3 tasks done
dankeboy36 opened this issue Feb 25, 2025 · 0 comments · Fixed by #2643
Closed
3 tasks done
Labels
type: enhancement Proposed improvement

Comments

@dankeboy36
Copy link
Contributor

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
@dankeboy36 dankeboy36 added the type: enhancement Proposed improvement label Feb 25, 2025
dankeboy36 added a commit to dankeboy36/arduino-ide that referenced this issue Feb 25, 2025
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
dankeboy36/esp-exception-decoder#28 (comment).

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#2642

Signed-off-by: dankeboy36 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant