Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Open Keyboard Shortcuts (JSON)" is path to broken split editor state #1850

Open
3 tasks done
per1234 opened this issue Feb 1, 2023 · 0 comments · Fixed by 2lambda123/arduino-arduino-ide#9 · May be fixed by #2386
Open
3 tasks done

"Open Keyboard Shortcuts (JSON)" is path to broken split editor state #1850

per1234 opened this issue Feb 1, 2023 · 0 comments · Fixed by 2lambda123/arduino-arduino-ide#9 · May be fixed by #2386
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Feb 1, 2023

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 "Open Keyboard Shortcuts (JSON)" icon is clicked while using the "Keyboard Shortcuts" view. Once split, if the user creates or opens any sketch code file, it will not be possible to then unsplit the editor using the primary Arduino IDE interface.

To reproduce

  1. Select File > New Sketch from the Arduino IDE menus.
  2. Select File > Save As... from the Arduino IDE menus.
  3. Save the sketch in the sketchbook folder with the name SplitBugDemo
  4. Select File > Advanced > Keyboard Shortcuts from the Arduino IDE menus.
  5. Click the {} icon ("Open Keyboard Shortcuts (JSON)") on the right side of the editor toolbar.
    A keymaps.json tab opens in a split editor on the right side of the main panel.
  6. Hover the mouse pointer over the "keymaps.json tab.
    An X icon will appear.
  7. Click the X icon.
    🙂 The tab closes, as is expected to be possible for supplemental files opened in the IDE's editor.
    🙂 The editor is no longer split.
  8. Click the {} icon ("Open Keyboard Shortcuts (JSON)") on the right side of the editor toolbar.
    A keymaps.json tab opens in a split editor on the right side of the main panel.
  9. Click the ●●● icon on the right side of the editor toolbar.
    😕 The context menu opens in an unexpected location.
    image
  10. Select "New Tab" from the menu.
    The "Name for new file" dialog opens.
  11. Type foo in the field.
  12. Click the "OK" button.
    🐛 The "foo.ino" editor tab was opened in the right split editor.
    image
  13. Try to find a way to unsplit the editor via the Arduino IDE primary interface.
    🐛 It is not possible.
  14. Select File > Preferences... from the Arduino IDE menus.
  15. Check the box next to "☐ Show files inside Sketches (if it is not already checked).
  16. Click the OK button.
  17. Open the "SKETCHBOOK" view.
  18. Click the icon to the left of the "SplitBugDemo" sketch to expand the tree (if it is not already expanded).
  19. Click the "SplitBugDemo.ino" file.
    🐛 An additional tab for the "SplitBugDemo.ino" editor tab was opened in the right split editor.
  20. Try to find a way to close this duplicate tab via the editor via the Arduino IDE primary interface.
    🐛 It is not possible.

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

692f29f

Operating system

Windows

Operating system version

11

Additional context

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 the keymaps.json editor alongside the "Keyboard Shortcuts" GUI view. But the average user is unlikely to open keymaps.json, so it wouldn't be a significant loss if the behavior was changed to opening the file without splitting the editor panel.


Originally reported at https://forum.arduino.cc/t/cant-create-a-split-view-edited/1023920/17

Workaround

The IDE editor can be recovered from its split state by performing the following instructions:

  1. Press the Ctrl+Shift+P keyboard shortcut (Command+Shift+P for macOS users) to open the "Command Palette".
  2. Select the "View: Reset Workbench Layout" command from the menu.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Feb 1, 2023
kittaakos pushed a commit that referenced this issue Feb 23, 2024
The complete support for split editor is yet to be added to IDE2.
For now, this commit turns off opening the keymaps in the JSON
split editor. So that it cannot get the primary IDE2 layout into an
inconsistent state.

Closes #1850

Signed-off-by: Akos Kitta <[email protected]>
@kittaakos kittaakos linked a pull request Feb 23, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
2 participants