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

"Reveal definition aside" produces broken split editor state #2225

Open
3 tasks done
per1234 opened this issue Sep 14, 2023 · 1 comment
Open
3 tasks done

"Reveal definition aside" produces broken split editor state #2225

per1234 opened this issue Sep 14, 2023 · 1 comment
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 Sep 14, 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 "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

  1. Create the following sketch:
    void foo() {}
    void setup() {
      foo();
    }
    void loop() {}
  2. Select any board with language server support.
  3. Hold Ctrl+Alt while clicking the foo call on line 3 of the sketch.
    A split editor pane opens:
    image
  4. Try to find a way to unsplit the editor via the Arduino IDE primary interface.

🐛 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 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.

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:

  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 Sep 14, 2023
@Tilation

This comment was marked as duplicate.

@arduino arduino locked as too heated and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants