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

PR: Greatly improve Outline performance and update it correctly when it becomes visible #19448

Merged
merged 11 commits into from
Oct 11, 2022

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented Sep 14, 2022

Description of Changes

  • Simplify and greatly speed up updating trees when new symbols arrive from PyLSP. For instance, this decreases the time necessary to update the tree of our codeeditor.py file from 700 ms to 30 ms in my laptop.
  • Update trees when the Outline is undocked, but not if its window is minimized.
  • Avoid the Editor plugin to update the current tree when given focus (this was very inefficient).
  • Dock plugins if they are undocked before hiding them when going to the Panes > View menu. I discovered that UX bug while working on this PR.
  • Add a test to check that we update (don't update) the Outline when it becomes visible (is not visible) under different circumstances.

Issue(s) Resolved

Fixes #16634

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct:

@ccordoba12 ccordoba12 added this to the v5.4.0 milestone Sep 14, 2022
@ccordoba12 ccordoba12 self-assigned this Sep 14, 2022
Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

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

Thanks @ccordoba12 ! Seems like things are working as described in the OP 👍

However, regarding the issue of the undocked panes not respecting the selection on the View Panes menu, we shouldn't instead of docking the pane, save the window pane geometry and restored it when checking the pane entry again from the menu (keeping the undocked panes state)?

Also, while checking this, I noticed another issue related with maximizing the Editor action and the Outline pane state on the View > Panes menu. Seems like although the Outline is being showed along side the Editor (being the Outline previously not visible), the checkbox state for the Outline is not showing is visible. I think this is not caused by the changes done here but maybe could be worthy to fix it here?

@ccordoba12
Copy link
Member Author

ccordoba12 commented Sep 17, 2022

However, regarding the issue of the undocked panes not respecting the selection on the View Panes menu, we shouldn't instead of docking the pane, save the window pane geometry and restored it when checking the pane entry again from the menu (keeping the undocked panes state)?

That's a very interesting idea! And something that will bring cool interactions in Spyder, like showing certain plugins on demand out of the main window. In other words, if users hide a plugin by going to View > Panes while it's undocked, and then press the shortcut to show it, with your suggestion it'd be displayed as undocked again.

I started to work on this idea but I think we'd need to differentiate between the Dock (bring back to the main window) and Close (hide) actions when the plugin is undocked for users to make sense of it. So I think it's work for another PR because my proposed fix is really simple but what you suggest would require things out of the current scope of this PR.

Seems like although the Outline is being showed along side the Editor (being the Outline previously not visible), the checkbox state for the Outline is not showing is visible. I think this is not caused by the changes done here but maybe could be worthy to fix it here?

That's a good point too, but we could discuss how to solve it (or even if we should show the Outline next to the Editor) when we're migrating the editor to the new API. What do you think?

@dalthviz
Copy link
Member

Then I think we need to create follow-up issues for both things for further discussion: the behavior when an undocked pane is requested to be hidden and the coherence between the Panes menu checkboxes and the maximize action (mostly for the Editor case where also the Outline is shown)

…bols

- The previous algorithm was quite inefficient because it sort of
recreated the tree structure after new symbols arrived, but with a lot
of comparisons.
- Even after making it work for the added and deleted symbols, I noticed
that it's faster to simply recreate the tree structure with the new
symbols because IntervalTree takes too much time merging changes to the
previous structure.
This will help to better understand how it's working
This makes our mechanism to not update it really work when the Outline
is hidden at startup.
The previous mechanism was trying to update editors under more
situations than we really need to.
@ccordoba12
Copy link
Member Author

the behavior when an undocked pane is requested to be hidden

See PR #19784. I'll rebase and finish it after this one is merged.

the coherence between the Panes menu checkboxes and the maximize action (mostly for the Editor case where also the Outline is shown)

Instead of opening a new issue, I posted #16265 (comment) because precisely tracking if the Outline is visible when the Editor is maximized would help us to solve that issue in an intuitive way.

@ccordoba12
Copy link
Member Author

Note: I decided to rebase this PR in order to re-run our tests and check that everything is green, given that it's almost a month old.

@ccordoba12
Copy link
Member Author

@dalthviz, this should be ready to be merged, unless you have further comments.

@dalthviz dalthviz merged commit 93986ee into spyder-ide:5.x Oct 11, 2022
dalthviz added a commit that referenced this pull request Oct 11, 2022
@ccordoba12 ccordoba12 deleted the improve-outline-performance branch October 11, 2022 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants