Skip to content

fix(search): only show Notebook Find Filters toggle for visible notebooks#309137

Open
yogeshwaran-c wants to merge 1 commit into
microsoft:mainfrom
yogeshwaran-c:fix/notebook-find-filters-visibility
Open

fix(search): only show Notebook Find Filters toggle for visible notebooks#309137
yogeshwaran-c wants to merge 1 commit into
microsoft:mainfrom
yogeshwaran-c:fix/notebook-find-filters-visibility

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

Fixes #224043

The Notebook Find Filters toggle in the Search view appeared whenever any notebook editor was present in the list of opened editors, even if no notebook was actually visible on screen. With tabs disabled this is easy to hit: a notebook can stay opened (still in the editor stack) without being the active editor in any group, and the toggle would still show even though there is no visible notebook to filter against.

This change:

  • Switches _hasNotebookOpen to use editorService.visibleEditors so we only consider notebooks that are currently active in some editor group.
  • Listens to onDidVisibleEditorsChange instead of onDidEditorsChange (filtered by EDITOR_OPEN/EDITOR_CLOSE), so the toggle reacts to a notebook becoming visible/hidden, not just to it being added/removed from the list of opened editors.

The result is that the Notebook Find Filters button only appears when a notebook editor is actually visible.

Test plan

  • Open a workspace with no notebooks. Open the Search view. Confirm the Notebook Find Filters toggle is hidden.
  • Open a .ipynb file. Confirm the toggle appears in the Search view.
  • With the notebook visible, switch the editor group to a different (non-notebook) file so no notebook is visible. Confirm the toggle disappears.
  • Disable tabs (workbench.editor.showTabs: 'none'), open a notebook, then open a non-notebook editor on top. Confirm the toggle disappears even though the notebook is still in the editor stack.
  • Make the notebook visible again (e.g. via Quick Open). Confirm the toggle reappears.

Previously the Notebook Find Filters button appeared in the search
panel whenever any notebook editor was present in the list of open
editors. With tabs disabled a notebook can stay opened without being
visible, which caused the filter toggle to show when no notebook was
actually on screen.

Switch the check to editorService.visibleEditors and listen to
onDidVisibleEditorsChange so the toggle only shows when a notebook is
currently the active editor in some group.

Fixes microsoft#224043
if (this.searchInput &&
e.event.editor instanceof NotebookEditorInput &&
(e.event.kind === GroupModelChangeKind.EDITOR_OPEN || e.event.kind === GroupModelChangeKind.EDITOR_CLOSE)) {
this._register(this.editorService.onDidVisibleEditorsChange(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why removing the check here? Shouldn't the hasNotebookOpen change do the trick?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Notebook Find Filters" button shows in search when no notebook is active

2 participants