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 last seen editor, not last created #9542

Merged
merged 1 commit into from
Jun 3, 2021

Conversation

colin-grant-work
Copy link
Contributor

@colin-grant-work colin-grant-work commented Jun 1, 2021

What it does

Fixes #9475 by changing the method by which the counter is found in EditorWidgetManager.getCounterForUri. Formerly, the largest existing counter was returned (most-recently opened editor), now the first entry for the widget in the array of recentlyVisibleIds is returned, instead.

This also required some modification of the logic for handling the recentlyVisibleIds. Previously, a widget would be removed as soon as it was no longer visible. Now the widget is removed only if it is disposed of. In addition, widgets are moved to the front of the line on activation, not only onVisibilityChanged.

How to test

  1. Open a file (henceforth 'File A') in a full editor (not editor preview).
  2. Then open another copy of the file to the side (ctrl + \) or through the command palette.
  3. Open two new editors and put them in the tabbars with the existing editor widgets so that neither of the editors for File A is visible.
  4. Click on the file node for File A in the navigator.
  5. Whichever copy of File A was last visible / active should be revealed.
  6. Try activating / hiding the editors for File A in different orders, and check that (5) still holds.

Review checklist

Reminder for reviewers

Signed-off-by: Colin Grant [email protected]

@vince-fugnitto vince-fugnitto added the editor issues related to the editor label Jun 2, 2021
Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

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

I confirm that the behavior works as expected using the described use-case.
The last visible editor is opened and not the last created 👍

@colin-grant-work colin-grant-work merged commit 9b9cc2b into master Jun 3, 2021
@colin-grant-work colin-grant-work deleted the bugfix/show-last-active-not-last-opened branch June 3, 2021 14:09
@github-actions github-actions bot added this to the 1.15.0 milestone Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor issues related to the editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking on filename in FileNavigator should reveal last-activated widget when multiple editors open
2 participants