Closing Tabs in the 2.0 IDE

Please can we have a way of closing - not deleting - tabs.

My sketch has over 20 tabs - header and class files - and there is a fair way to go yet. It's getting difficult to manage and is slowing down the IDE.

Do I have to move over to VS Code and PlatformIO?

2 Likes

Right. Let's have a good IDE finally. With file tree and adequate tabs.
Just take look at JetBrains products – those are polished nicely.

$0.00

vs

image

There is a way to close tabs in the current version of the IDE (2.0.0-rc5).
If you open the explorer tab (on the left) you can see all the groups and tabs currently opened. When you have the mouse over a file, a cross appears. You can use this cross to close the file on the editor.

Not sure but even if closed, the code in the extra tabs will still be part of the compiled program.

Yes it is included in a compile.

However, next time the sketch is opened the closed tabs are re-opened.

Personally I am OK with the above behaviour, but then, I do not use a lot of tabs in any of my sketches.

Closing a tab does not delete the file from the sketch folder so it is no wonder that they are included when compiling the code and reopen if the sketch is closed and reopened

It sounds like it is working as intended, but being able to close a tab does not seem such a good idea as it could easily confuse the user when invisible code is included in the sketch

1 Like

I’m building my code using the single responsibility principle, so have numerous classes - and one class or header per file. So there are many files.

I also use lots of files(14 in current project) and navigate them easily using the explorer I never bother to close them.

In this case, you may prefer to put some of the files under the src subfolder of the sketch. Only the code files from the root of the sketch folder are automatically opened in the Arduino IDE editor tabs.

This is how the popular Marlin 3D printer firmware sketch is structured. Only the configuration files the average user of that sketch needs access to are in the root of the sketch folder. The other hundreds of files are under the src subfolder, well organized in folder structures under that (the contents of src subfolder are compiled recursively):

https://github.com/MarlinFirmware/Marlin/tree/2.0.x/Marlin

There are some things you should be aware of when using the src subfolder of the sketch:

Non-closable bug (IDE 2.x)

Even though Arduino IDE 2.x does not open the files by default, you are able to open them as needed via the "Sketchbook" view if you have enabled the "☐ Show files inside Sketches" setting in the File > Preferences... dialog.

That is the intended behavior of course. However, there was a bug that prevented you from closing those tabs via the IDE's primary user interface once you opened them. A fix for that bug has already been prepared and approved, but it is currently only available in the beta tester builds of the Arduino IDE:

Even with the bug, you can still close those via the "Explorer" view, as described by anubis1429.

Save as... bug (IDE 1.x)

Although Arduino IDE 1.x does support the src subfolder, it has a bug that causes the src folder to not be copied over from the original sketch to the new sketch when you do a "Save as..." operation:

Arduino IDE 2.x does not have this bug, so this is only a problem if you are using your sketch with Arduino IDE 1.x or sharing it with people using Arduino IDE 1.x.

Not supported by Arduino Web Editor

The Arduino Web Editor does not support subfolder in sketches.

Thank you for that, I wasn’t aware of it. I’m currently using RC5. Overall it’s far better than the 1.8.X ide.

Do you know if the betas include a fix for the slowdown? I find that after a hole the ide slows down noticeably and eventually needs restarting. This is on an M1 MacBook Air with 8GB of memory.

Unfortunately, even though it has been reported by multiple users from the community, nobody at Arduino is experiencing this level of low performance, so I don't know whether any of the development work will improve it.

Nightly builds are available with all the development work. The download links are here:

https://github.com/arduino/arduino-ide#nightly-builds

The startup and loading of new windows is certainly slower than I would like, but it is on the order of seconds, not minutes as others are reporting. And I don't have a high spec computer, and primarily use Windows (which is historically the OS where Arduino IDE has the worst performance). The language server is slower than the ones I use in other IDEs for development in other languages, but again not at the order of slowness from the reports.

This makes it difficult to investigate. There are some very talented developers working on the project, so I'm sure they will be able to improve on the situation over time, but I think the community could assist with that effort such as by identifying and providing high quality reports on whatever the specific conditions are that result in this problem.

Tester builds of the Arduino IDE are generated every time someone submits a pull request to propose a change.

All interested parties are invited to try these out and provide feedback via pull request reviews.

I'll provide instructions for getting the tester builds:

  1. Sign in to your GitHub account.
    (GitHub only allows downloads of the tester builds when you are signed in)
  2. Open the pull request you are interested in. They are listed here:
    https://github.com/arduino/arduino-ide/pulls
  3. Click the "Checks" tab.
  4. From the list of workflow runs on the left side of the page, click on "Arduino IDE" (this is the build workflow).
  5. From the "Artifacts" section of the page, click the download link for your operating system.
  6. Wait for the download to finish.
  7. Extract or install the downloaded file as usual.

:exclamation: (for macOS users only) Due to security restrictions imposed by the automated build system, the tester builds for pull requests by 3rd parties are not notarized. You can learn about testing these pull requests here.

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