Skip to content

Sketchbook sidebar state #1102

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

Merged
merged 13 commits into from
Jul 4, 2022
Merged

Sketchbook sidebar state #1102

merged 13 commits into from
Jul 4, 2022

Conversation

AlbyIanna
Copy link
Contributor

Motivation

When opening a sketch from the sketchbook sidebar, the new IDE window should open with the sketchbook sidebar open. This should also happen when opening a sketch from the Remote Sketchbook (and of course in this case the Remote Sketchbook will be automatically open).

Expected Behavior

Local Sketchbook:

  1. launch IDE
  2. expand the Sketchbook sidebar
  3. select the Local Sketchbook
  4. double-click a Sketch that is not open
  5. 😄 it will open to another window and the Local Sketchbook sidebar will be open

Remote Sketchbook:

  1. launch IDE
  2. expand the Sketchbook sidebar
  3. select the Remote Sketchbook (sign in if necessary)
  4. double-click a Sketch that is not open
  5. 😄 it will open to another window and the Remote Sketchbook sidebar will be open

Change description

  • Added two commands to open the local and the remote sketchbook respectively.
  • Added a way to pass an array of commands to the WorkspaceService when opening a new sketch. Those commands will be subsequently run when the front-end is ready.

Other information

Fixes #442

Replaces #912

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

@AlbyIanna AlbyIanna requested review from kittaakos and per1234 June 23, 2022 07:37
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jun 23, 2022
@AlbyIanna AlbyIanna requested a review from kittaakos June 23, 2022 15:51
Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is looking good. Thank you! I added one remark.

Alberto Iannaccone and others added 5 commits June 30, 2022 12:34
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@AlbyIanna
Copy link
Contributor Author

@per1234 thanks for the suggestions! We improved that logic using a single command (REVEAL_SKETCH_NODE), and then we realized that such a command isn't really useful for the users, so we removed it from the command palette (and removed the label property accordingly).

@AlbyIanna AlbyIanna requested a review from per1234 June 30, 2022 11:22
Copy link

@ubidefeo ubidefeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the behaviour and it works, but there's a caveat.

If I select the Sketchbook and open another Sketch, the sidebar in the new window is correctly showing the current Sketch as highlighted.
If I then select the previously opened Sketch from this new window and double-click, the window at the back goes into focus but the Sidebar state is not changed

CleanShot 2022-06-30 at 15 18 08@2x

CleanShot 2022-06-30 at 15 18 32@2x

Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe the problem

🐛 When a sketch in a subfolder of the sketchbook is opened via the "Sketchbook" view, the tree structure is not expanded to show the sketch in the "Sketchbook" view of the opened sketch's window.

To reproduce

  1. Download the sketch from this link: SomeParent.zip
    Feel free to create your own sketch if you like. I had produced this ZIP previously while preparing a since abandoned issue report where it was more beneficial to provide a premade one.
  2. Extract the downloaded ZIP file in your sketchbook:
    Arduino/
    └── SomeParent/
        └── SomeSketch/
            └── SomeSketch.ino
    
  3. Open the "SomeSketch" sketch via the "Sketchbook" view.

🐛 The tree structure is not expanded to show the sketch in the "Sketchbook" view of the new window:

image

Please disregard the version shown in the screenshots. I produced these while preparing a since abandoned issue report for a previous build. The screenshot is still valid even though the issue applies to another version of the IDE.

Expected behavior

Tree structure is expanded to show the sketch in the "Sketchbook" view when a sketch is opened via the "Sketchbook" view:

image

Arduino IDE version

2.0.0-rc8-snapshot-529f811 (tester build for ebc63e8)

Operating system

Windows, Linux

Operating system version

  • Windows 10
  • Ubuntu 20.04

Additional context

This was working fine with 2.0.0-rc8-snapshot-7ac80b8 (tester build for 9630eb2), with one minor exception:

  • The first time a given sketch was opened on the user's machine (using that build, it worked as expected on all subsequent openings of the sketch).

The problem is the same for sketches from the "Remote Sketchbook".


It is not too serious of a problem, but I do think having the tree expanded to reveal the sketch is a better UX.

The fact that it was working before the most recent changes to this PR made me think it might be an easy fix.

@91volt
Copy link

91volt commented Jul 1, 2022

I have tested the behaviour and it works, but there's a caveat.

If I select the Sketchbook and open another Sketch, the sidebar in the new window is correctly showing the current Sketch as highlighted. If I then select the previously opened Sketch from this new window and double-click, the window at the back goes into focus but the Sidebar state is not changed

@ubidefeo I think that this behavior regarding already opened workspaces is right - and in any case I believe this nuance of the experience isn't really impactful for the user.

The already opened workspace shouldn't get the sketchbook on focus since the user might have interrupted a task that he needs to complete. I think is not ideal to change the sidebar state in an already opened window, without the user being aware of that.

@AlbyIanna
Copy link
Contributor Author

Thanks, @per1234! I've fixed the subfolder issue!

@AlbyIanna AlbyIanna requested a review from per1234 July 4, 2022 07:25
@AlbyIanna AlbyIanna force-pushed the sketchbook-sidebar-state branch from 1b745f9 to 77b7ef9 Compare July 4, 2022 08:41
Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! ❤️

@AlbyIanna AlbyIanna force-pushed the sketchbook-sidebar-state branch from 77b7ef9 to 80594de Compare July 4, 2022 09:04
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is working fine for me now.

Great work Alberto!

@AlbyIanna AlbyIanna merged commit 087cab1 into main Jul 4, 2022
@AlbyIanna AlbyIanna deleted the sketchbook-sidebar-state branch July 4, 2022 13:49
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: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sketchbook sidebar: opening a sketch will not show the last state of the sidebar in the new window
5 participants