"Reveal definition aside" produces broken split editor state #2225
Labels
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Describe the problem
Sketch tab management
The unit of the Arduino sketch project is a folder. Even though many of the common sketches consist of only a single file, the folder may contain multiple sketch code files. All the source files present in that folder are compiled to a single program.
In order to intuitively communicate the nature of the sketch to the user and avoid confusion that might be caused by code from files not visible to the user still being compiled, each Arduino IDE window contains a single sketch, with all primary code files of the sketch open as tabs. These tabs are not closeable as would be the case if Arduino IDE was a general purpose editor instead of a tool specifically designed for development of Arduino sketches.
Split editor feature
The Eclipse Theia IDE framework Arduino IDE is built on supports the "split editor" feature, where multiple panels can be created in the editor view so that content can be viewed side-by-side while editing. This includes having the same file open in two tabs.
Problems with split editor in Arduino IDE
Arduino IDE gained a split editor capability by chance rather than design through an update of the Theia dependency. The users discovered this new feature, but also discovered that it did not work correctly: the system for preventing primary sketch code file tabs from being closed did not allow the redundant tabs created by the split editor feature to be closed (#552). Since it did not work correctly and had not been planned, Arduino IDE project managers decided the split editor feature should be disabled (#940) until resources were available to implement it in a fully functional state (#909).
🐛 Despite the efforts to disable the feature, the editor is still split when the "editor.action.revealDefinitionAside" command is executed. If the definition is in a root sketch file, it will not be possible to then unsplit the editor using the primary Arduino IDE interface.
To reproduce
foo
call on line 3 of the sketch.A split editor pane opens:
🐛 It is not possible to unsplit the editor.
Expected behavior
Opening primary sketch code files as tabs of a split editor panel is only possible once the split editor feature is in a fully functional state.
Arduino IDE version
2.2.1
Operating system
Windows
Operating system version
11
Additional context
In addition to the Ctrl+Alt+click trigger for editor.action.revealDefinitionAside command used in the demo above, it also has a default keyboard shortcut Ctrl+K Ctrl+F12, which should also be disabled by default in order to prevent the users from accidentally putting the IDE into the broken split editor state via that path.
Since
keymaps.json
is a supplemental file and thus closeable, the IDE's behavior of opening this file in a split editor is not a problem in itself. It is actually a fairly reasonable default behavior since the user might like to view thekeymaps.json
editor alongside the "Keyboard Shortcuts" GUI view. But the average user is unlikely to openkeymaps.json
, so it wouldn't be a significant loss if the behavior was changed to opening the file without splitting the editor panel.Additional reports
Related
Originally reported at https://forum.arduino.cc/t/cant-close-tab/1143314
Workaround
The IDE editor can be recovered from its split state by performing the following instructions:
Issue checklist
The text was updated successfully, but these errors were encountered: