Extending and interacting with the Arduino IDE #8
Replies: 2 comments 2 replies
-
This request is being tracked at arduino/arduino-ide#2135 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback!
It's already possible, but I would neither use nor recommend it. If there are other extensions that want to write the shared Output, and IDE2 also writes it, there will be chaos. It's better when every extension writes its own output. We can propose a feature to IDE2 to show other channels in the primary UI. I highly recommend looking into VS Code tasks and the task provides. It has a terminal; you do not have to write to an output channel. The Code guys have an example for everything:
In the long run, I want to enable all Arduino IDE 2.x features in VS Code; it will take some time, but if you do not make a tight connection in your extension to the Output channel (or anything too IDE2 specific) now, later, your extension will run in VS Code without zero code changes. You need to create an const channel = vscode.window.createOutputChannel('Arduino');
channel.show();
channel.appendLine('printed from an extension'); reuse-Arduino-channel.mp4
I do not think IDE2 will expose such a feature ever. Giving extension developers the freedom to open and close connections is a no-go. What should the IDE2 devs do when one of the extensions has a bug and does not release/acquire the monitor connection?
async function runTask<T>(port: Port, fqbn: string, task: () => Promise<T>, timeout?: number): Promise<T>;
await runTask({ protocol: 'serial', address: 'COM2' }, 'rp2040:rp2040:arduino_nano_connect', async () => {
// by the time your task runs, IDE2 has made sure to disconnect `serial://COM2` monitor for the board if it was running
// do your extension logic, such as FS upload
// when IDE2 has executed your task, it will make sure to reconnect the monitor if it was running before your task has started to execute.
}) Please bear with us with the API evolution. Once something is available for extension devs, IDE2 must support it (forever). So we must be very careful; this is the main reason all APIs are read-only for now, but I am open to any feedback and proposal. |
Beta Was this translation helpful? Give feedback.
-
This is only a suggestion, and maybe is better handled in the
arduino-ide
repo, (and maybe already exists) but I think a few additions could improve the quality of life for users of 3rd party extensions:Tools
menu for plug-ins. Basically replicating in some shape or form what IDE 1.x had (nice to have, but not critical)Output
console vs. making a new one (nice to have, but not critical)Serial Monitor
to release/re-acquire the serial port connection. This is needed for unimpeded FS uploads (IMHO a big quality-of-life improvement)Beta Was this translation helpful? Give feedback.
All reactions