Arduino IDE 2.0.x

Community!

The Arduino IDE version 2.x is a huge step forward.
But there is nothing that could not be better, right?

Therefore a few ideas or better said wishes what I, as an intensive user of Visual Studio, still miss in the Arduino IDE.

And:
What do you think about these ideas?
What else is missing?

(The list does not claim to be complete.
The chosen order does not represent a valuation/prioritization.)

  1. It should be possible to split the editor window horizontally.
    Each region should have its own field to search (and replace).
    (like Visual Studio).

  2. The font size in the editor window should be able to be increased and decreased
    via keyboard shortcut and not only be set in the "Settings".

  3. A yellow warning image should appear in the green bar above the editor window,
    highlighted when a sketch has been uploaded and then the sketch has been modified.

  4. The tab width in the editor should be configurable under "File" -> ... -> "Settings" should be configurable.

  5. By default the option "Editor Quick Suggestions" should be enabled.

  6. It should be possible to select multiple lines in the editor and comment or uncommented
    with two new buttons in the green bar above the editor.

  7. Unnecessary spaces to the right of a command should be removed automatically.

  8. Github integration.

Try Ctrl and + or -

@UKHeliBob
lol ...
Thanks and strange that I doesnt figure that out!

Hi @ur64. Thanks so much for your suggestions!

This feature request is tracked by the Arduino IDE developers here:

If you have a GitHub account, you can subscribe to that issue to get notifications of any new developments related to this subject.

It can be done already:

  • Increase: Ctrl+=
  • Decrease: Ctrl+-

These keyboard shortcuts are also customizable via File > Advanced > Keyboard Chortcuts

Note that the behavior of the keyboard shortcut depends on the setting of the "Interface scale: ☐ Automatic" checkbox in the File > Preferences dialog.

I would oppose a warning symbol, since this communicates to the user that something is wrong, whereas the sketch being unsaved is normal and not any cause for concern since Arduino IDE will always show a confirmation dialog when the user takes an action that would result in the loss of unsaved changes.

A as used in VS Code and in the Arduino IDE editor tabs would be reasonable though.

If you would like to request this, you are welcome to submit a formal feature request to the Arduino IDE developers here:

https://github.com/arduino/arduino-ide/issues/new/choose

I see Arduino IDE actually even already offers the option to add such an indicator via the customizable window title system in the advanced settings. Unfortunately I found it does not work for me. I reported that to the developers:

It is. I'll provide instructions:

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
  2. Select the "Preferences: Open Settings (UI)" command from the menu.
  3. A "Preferences" tab will now open in the Arduino IDE main panel. In the "Search Settings" field, type editor.tabSize
  4. Set your preferred tab width in the field under the "Editor: Tab Size" setting.
  5. Close the Preferences tab by clicking its X icon.

Note that the Edit > Auto Format feature will continue to use the standard 2 space indentation. You can customize the Auto Format code style by following this tutorial:

All that said, I strongly recommend you to simply follow the official standardized Arduino code style as implemented in Arduino IDE by default. This will provide code style consistency throughout the Arduino code ecosystem. Such consistency is far more important than whatever benefits might come to each developer from diverging to their own arbitrary style preferences.

It was intentionally disabled by default after quite some consideration by the team who produced Arduino IDE 2.x.

If you like it enabled, feel free to do so in your own preferences.

A fundamental principle in the design of Arduino IDE is avoiding unnecessary complexity in the primary UI. We intentionally avoid adding UI elements such as this.

You can use the Edit > Comment/Uncomment menu item or the associated keyboard shortcut to accomplish this.

Edit > Auto Format does this.

Arduino IDE also automatically removes trailing spaces when they were automatically added by the IDE to maintain indentation level when starting a new line (controlled by the "Editor: Trim Auto Whitespace" advanced setting).

There is an advanced setting that causes the IDE to automatically remove trailing spaces whenever you manually save the sketch. It is disabled by default. I'll provide instructions for enabling it in case this is something that would be useful to you:

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
  2. Select the "Preferences: Open Settings (UI)" command from the menu.
  3. A "Preferences" tab will now open in the Arduino IDE main panel. In the "Search Settings" field, type files.trimTrailingWhitespace
  4. Check the checkbox under the "Files: Trim Trailing Whitespace" setting.
  5. Close the Preferences tab by clicking its X icon.

This has been considered by the Arduino IDE team and it is our opinion that it is out of scope for the project.

A far better approach is to use one of the existing excellent standalone Git/GitHub clients:

https://git-scm.com/downloads/guis

This allows you to use the same client for all your version control needs, rather than having to learn the interface of the integration of each of the development tools you use (and surely still having to resort to using a standalone client or command line Git in cases where there is no integrated capability in the tool you are using for a specific project.

For some of these cases, I use the "Column select" not sure what it is called here, but for example on WIndows, with mouse with track wheel you can press down . you click down and select a set of columns in the lines you wish to update. This allows you to make the same edits on multiple lines.

I might hit home if I need to or the like, and the type //
Which is added to each line. Or the delete key to remove.

Note: I do the same in sublime text as well

1 Like

Thanks @KurtE
LOL ... I should search for Win 11 short cuts ...
Works for me!

@ptillisch
Thanks for your fast and all topic hitting answer!

Finally I get the impression I should FIRST deep dive in the IDE possibilities and learn&understand them - before I start writing such a post. :frowning: Shame on me.

But finally I learned a lot and so it was worth it.

Thank you very much!

Note: I am guessing that this feature works on Linux and MAC as well.
In sublime text the way you do the selection is different.
Instead on Linux you hold down the ALT key while mouse selecting and on MAC you use the option key... But I have not tried these on those platforms with IDE2.

I should also note, I use this for several things, like, for example recently I pasted in a table of BLE Services and Declarations... from pdf file, which had table of names and hex values

I then column selected all of those lines, and do things like: use shift arrow keys (or shift ctrl arrow) to select words, do ctrl+x to cut them out. Type some additional stuff, do a paste operation... And generate code like:

      // Services
      case 0x1800: return "Generic Access service";
      case 0x1801: return "Generic Attribute service";
      case 0x1802: return "Immediate Alert service";
      case 0x1803: return "Link Loss service";
      case 0x1804: return "Tx Power service";
      case 0x1805: return "Current Time service";
      case 0x1806: return "Reference Time Update service";
      case 0x1807: return "Next DST Change service";
      case 0x1808: return "Glucose service";
      case 0x1809: return "Health Thermometer service";
      case 0x180A: return "Device Information service";

Sorry for the digression from the topic.

No reason at all for shame. You are always welcome to make suggestions or ask questions here. That is what the Arduino Forum is all about!

I happen to have a good familiarity with the advanced usage of Arduino IDE, as well as fairly obscure information about the current bugs/quirks of some of the advanced functionality, through years of extensive beta testing for Arduino during the development of the project. I'm always happy to share whatever knowledge I happen to have here on the forum.

In the process, I often learn more either about Arduino IDE or about what the users need. For example, I discovered that bug with the menu title customization earlier because, even though I had done some general testing of the setting, I never before tried using the ${dirty} feature.

Be careful. I would guess that for the most part, users, particularly less technical Arduino users, don't look at things like library code that much. They just want something that works for them.
i.e. coding style consistencies is likely to be pretty low on their list of concerns.

I agree that consistency is a good thing particularly within a project and consistency should be enforced by the developers within a project.
But to attempt to coerce all projects by everyone- even unrelated ones - to use the same style is well, a bridge too far. It is never going to happen.

I would say the most important thing is producing high quality code with fewer issues & bugs.
If using a particular coding or indention style can make that happen for a project then, IMO, it trumps any desire to attempt to force all projects, even unrelated ones, to all use the same coding / indention style.

With Arduino 2.x if a user wants to see the code in his preferred coding / indention style he can bring up the code in the IDE and have the IDE re-format it to his preferred style preferences - pretty much whatever that is.
This is a very cool feature - that I have already used when looking at code that users have posted here in forum posts.

Me personally, I totally abhor the default IDE coding/indention style and will never use it on my projects as I prefer the Allman style; but that is just my personal preference.
IMO, the most important thing is consistency within a project.
Which means all files within project should use the same style and if a developer edits files in a project they should not ever alter the existing format / style.
i.e. each project should adopt a coding / indention style and be consistent within all the files of that project and later developers should not deviate away from that style by using their own preferences when editing the files.

All that said, one really cool feature for the IDE would be have two styles.
one that determines what to show in the IDE gui, and a second one for how to save it in the file.
That way, users could get the best of both worlds.
The user can view and edit the files in their preferred style in the IDE but then save it out in the project preferred style.
Kind of like Burger King "Have it you way".

--- bill

I guess you missed the part where I provided detailed instructions for customizing the code style of the Arduino IDE editor and auto formatter, as I always do when people ask about it here on the forum.

I have also been the driving force behind adding, documenting, and maintaining such capabilities in the Arduino IDE 2.x project.

Oh no, I didn't miss it. I saw that but then literally right after that, and maybe you didn't intend it the way you actually stated it, but you stated that coding / style consistency is far more important than whatever benefits might come from developers diverging to their own personal style.
That is literally saying that using the Arduino IDE default coding style is the most important thing above any other benefit that may come from using a different style.

All that said, I strongly recommend you to simply follow the official standardized Arduino code style as implemented in Arduino IDE by default. This will provide code style consistency throughout the Arduino code ecosystem. Such consistency is far more important than whatever benefits might come to each developer from diverging to their own arbitrary style preferences.

Having lead and run many project teams and groups of developers numbering in the 100s for a given project, across developing many projects / products, across many simultaneous groups of development teams, across a few decades during the 80s and 90s, I can with 100% certainty say that attempting to enforce a single style across all projects is a fools game and will not happen.
It isn't as easy as many people think, particularly when a project / product can involve one or more licensed code bases that each may use different styles.

The best you can do and actually get buy in from the developers is to make the style consistent within the project for the project files that are locally developed for the project / product and to not mess with the style of any foreign licensed code that is part of the project / product.
And even that can be challenging when you get some stubborn or PrimaDonna type developers. - And every company has them.

--- bill

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.