Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Cannot activate the Arduino extension #1616

Closed
ae-warp opened this issue Mar 5, 2023 · 8 comments
Closed

Cannot activate the Arduino extension #1616

ae-warp opened this issue Mar 5, 2023 · 8 comments
Labels
bug needs-more-info More details about this issue are needed for it to be actionable. serial Issues with serial ports stale

Comments

@ae-warp
Copy link

ae-warp commented Mar 5, 2023

vscode-arduino version: 0.5.0
vscode-serial-monitor version: 0.8.0
Visual studio code version: 1.76.0
Windows build: 19044.2604
Raspbian Desktop version: 11 (bullseye)
Raspberry Pi OS Lite version: 11 (bullseye)

Reproducible steps:
You'll need an Arduino (in my case a Due, but one can use Uno or any other), plugged in a machine to which you log into via e.g. vscode Remote SSH plugin.
VSCode's host OS is Win10, remote host is a Raspberry (the one to which Arduino is plugged in) with either RPi OS Lite or Raspbian Desktop OS version.
Tests have been made for both vscode-arduino and vscode-serial-monitor with release and pre-release versions.
RPi OS Lite has been installed with the purpose to test this issue.

What you expected to see, versus what you actually saw:

  1. (with 0.4.13 plugin version) I was able to write, debug, compile and upload code on the Arduino board, open Serial Monitor, etc. using the configuration described above.
  2. (with 0.5.0 plugin version) I can't use the same chain of tools to work with Arduino. I get this error "arduino.openSerialCommand not found", and the like.

Images, animations, or a link to a video showing the issue occurring:
nothing to say, normal and expected UI behaviour.

A code snippet that demonstrates the issue:
none.

Errors from the Dev Tools Console:
This one (available on UI and Dev Tools>Console): "Cannot activate the 'Arduino' extension because it depends on the 'Serial Monitor' extension, which is not loaded. Would you like to reload the window to load the extension?" (Reloading does not solve the issue).
Serial Monitor tip for remote host plugin instance says: "This extension is enabled in the Local Extension Host because it prefers to run there."

Last consideration:
I think Modify to use standalone Serial Monitor Extension (#1577) is relevant.

Thank you for your time.

@github-actions github-actions bot added the triage New issues that have not been reviewed. label Mar 5, 2023
@Alexia
Copy link

Alexia commented Mar 7, 2023

+1 from me. This is broken to the point that I can not even uninstall the Serial Monitor extension in an attempt to fix this. It claims that the Arduino extension requires it even after I uninstall the Arduino extension.

@benmcmorran
Copy link
Member

I think this is the same issue as microsoft/vscode-serial-monitor#77. Can you try adding this snippet to your settings.json to force the Serial Monitor to run on the remote?

  "remote.extensionKind": {
    "ms-vscode.vscode-serial-monitor": [
      "workspace"
    ]
  },

@benmcmorran benmcmorran added bug needs-more-info More details about this issue are needed for it to be actionable. serial Issues with serial ports and removed triage New issues that have not been reviewed. labels Mar 7, 2023
@ae-warp
Copy link
Author

ae-warp commented Mar 8, 2023

Can you try adding this snippet to your settings.json to force the Serial Monitor to run on the remote?

Everything below is under this configuration: vscode arduino 0.5.0 and vscode serial monitor 0.8.0 versions.

So I configured the json with the snippet you posted - much appreciated, really, and my bad, couldn't find the issue on that repo. Anyway, with that I no longer see the "Serial Monitor Extension not loaded" exception.

PLEASE NOTE: until I withdraw this below, in this scenario I have vsc arduino and vsc serial monitor installed locally and remotely.

I get this error, from the dev tools console

  [workbench.desktop.main.js:615 ]
  ERR Could not find pty on pty host: CodeExpectedError: Could not find pty on pty host
    at S.L (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:27:6849)
    at S.updateTitle (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:27:2630)
    at Object.call (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:17:5043)
    at l.s (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:15:5412)
    at l.q (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:15:4915)
    at /home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:15:4326
    at n.invoke (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:11:145)
    at E.deliver (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:11:2070)
    at c.fire (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:11:1708)
    at process.T (/home/pi/.vscode-server/bin/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/platform/terminal/node/ptyHostMain.js:9:20949)
    at process.emit (node:events:526:28)
    at emit (node:internal/child_process:938:14)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

Please note that the above error can be present more than once, even consecutively.
Finally, I get this in OUTPUT panel

[Starting] Analyzing sketch '/whatever/dir/script/script.ino'
Please see the build logs in output path: /whatever/dir/arduino/.build
Error: unknown option: --no-color
[Warning] Failed to generate IntelliSense configuration.
[Error] Analyzing sketch '/whatever/dir/script/script.ino': Exit with code=3

Tried to grep the --no-color option: honestly, I get a bunch of results from anywhere inside the project (i also use npm, dunno how much this weighs), that I don't know what to post. Nothing seemed relevant to me, though, or somehow related to my actions.

So what I did was uninstalling both extensions from local and remote envs and reloading vscode.
Subsequently I installed the extensions only in the remote host: I see, in Running Extensions, both of them working only in remote, as expected.
I then open my script and after clicking on verify button I get this tip:
Cannot find Arduino tools. Use Arduino CLI bundled with this extension instead?
After selecting "Use bundled arduino-cli", vscode reloads. I then see the same loop of errors, warnings, etc.

How can I be of further help?
I got very few time right now to further investigate this: suggestions on next steps would be most appreciated.

Thank you again for the snippet and, lbnl, for your time.

@benmcmorran
Copy link
Member

I'm guessing the --no-color flag is coming from here, which was changed relatively recently to improve the IntelliSense configuration generation for Arduino CLI. I'm not sure why that flag wouldn't be available from Arduino CLI unless perhaps the version of the CLI was very old.

It's concerning that the bundled CLI doesn't seem to be initializing correctly. We can try to reproduce that case in a remote environment, but as a workaround can you try manually installing Arduino CLI in your remote environment, then set arduino.useArduinoCli to true, arduino.path to the path to the directory containing the Arduino CLI executable, and arduino.commandPath to the name of the Arduino CLI executable (probably just arduino-cli on Linux). Reload VS Code and in theory it will correctly find the CLI in the remote environment.

@arsegorov
Copy link

arsegorov commented Mar 9, 2023

I get the same --no-color error in WSL 2/ Ubuntu 22.04 when using the CLI packaged with the extension (Arduino extension 0.5.0).

When switching to a standalone CLI, the error is gone.

In my case, it is the path to the CLI in the Arduino Path setting and arduino-cli in the Arduino Command.

@ae-warp
Copy link
Author

ae-warp commented Mar 10, 2023

@benmcmorran
Hello again; sorry for the delay, couldn't get back earlier to the project.
So, I followed your suggestion and installed arduino-cli.
Now the extension works as expected at least for what I tested - verify, upload, board manager, serial monitor.

Summing it up: I can work with the most recent version of arduino extension for vscode, though I won't close the thread, leaving it to you to decide.
Thank you very much, I really appreciated your feedback and help.

PS: I have a spare SD that I can experiment with on RPi. Please let me know if I can be of any help.

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

This issue has been automatically marked as stale because it has been inactive for 30 days. To reactivate the issue, simply post a comment with the requested information to help us diagnose this issue. If this issue remains inactive for another 7 days, it will be automatically closed.

@github-actions github-actions bot added the stale label Apr 9, 2023
@github-actions
Copy link

This issue has been automatically closed due to inactivity. If you are still experiencing problems, please open a new issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug needs-more-info More details about this issue are needed for it to be actionable. serial Issues with serial ports stale
Projects
None yet
Development

No branches or pull requests

4 participants