Description
Describe the problem
Arduino sketches may consist of multiple files, which are shown in the Arduino IDE as tabs when that sketch is open. All the .ino
files of the sketch are concatenated before compiling, starting with the file that matches the sketch name, followed by the rest in lexicographical order:
https://arduino.github.io/arduino-cli/dev/sketch-build-process/#pre-processing
The resulting program structure is conveyed to the user in an intuitive manner by the order of the .ino
sketch tabs in the IDE reflecting their concatenation order.
🐛 Tabs of newly added files follow the order of addition rather than the order of sketch concatenation. The concatenation behavior for these files will not be intuitive to a user unfamiliar with the obscure low level details of sketch pre-processing.
To reproduce
- Click the ▼ button on the right side of the editor toolbar.
- Select "New Tab" from the menu.
- In the "Name for new file" field, type
b.ino
- Click the OK button.
- Click the ▼ button on the right side of the editor toolbar.
- In the "Name for new file" field, type
a.ino
- Click the OK button.
🐛 The "a.ino" tab is added to the right of the "b.ino" tab.
Expected behavior
The editor tabs of .ino
sketch files match their concatenation order.
Arduino IDE version
Original report
2.0.0-rc6-snapshot-289f9d7
Last verified with
Operating system
Windows
Operating system version
10
Additional context
The bug also occurs when files are added to the sketch externally
The bug also occurs when files are renamed.
Arduino IDE 1.x handles ordering of tabs for added sketch files as expected.
Additional reports
Issue checklist
- I searched for previous reports in the issue trackerI verified the problem still occurs when using the latest nightly buildMy report contains all necessary details
Activity
kittaakos commentedon Nov 7, 2022
Could you please help slightly generalize the expectation and help define the tab order for non
.ino
and.pde
files? I want to tackle them together (also with #643).The spec says:
What about the other files and their order?
IDE2 allows creating files with these extensions so that they can open up in an editor:
arduino-ide/arduino-ide-extension/src/common/protocol/sketches-service.ts
Lines 164 to 177 in 8a85b5c
On the first sketch open, IDE2 opens the main sketch file (
MainFile
) and the files in the root folder (RootFolderFiles
):arduino-ide/arduino-ide-extension/src/common/protocol/sketches-service.ts
Lines 137 to 140 in 8a85b5c
Is there any expectation of opening non-sketch-related editors in the main area? For example, when opening the Advanced Settings JSON or graphical editor?
Thank you!