Skip to content

Commit ced89d2

Browse files
authored
Fix notebook outline filters breaking outline view entirely (microsoft#209886)
* activeEntry if newActive !filtered * refactor 7 -> const value for readability + inline on compile * Revert "refactor 7 -> const value for readability + inline on compile" This reverts commit 49fb7ab.
1 parent 2e53cf0 commit ced89d2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProvider.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,21 @@ export class NotebookCellOutlineProvider {
263263
}
264264
}
265265
}
266-
if (newActive !== this._activeEntry) {
266+
267+
// @Yoyokrazy - Make sure the new active entry isn't part of the filtered exclusions
268+
const showCodeCells = this._configurationService.getValue<boolean>(NotebookSetting.outlineShowCodeCells);
269+
const showCodeCellSymbols = this._configurationService.getValue<boolean>(NotebookSetting.outlineShowCodeCellSymbols);
270+
const showMarkdownHeadersOnly = this._configurationService.getValue<boolean>(NotebookSetting.outlineShowMarkdownHeadersOnly);
271+
272+
// check the three outline filtering conditions
273+
// if any are true, newActive should NOT be set to this._activeEntry and the event should NOT fire
274+
if (
275+
(newActive !== this._activeEntry) && !(
276+
(showMarkdownHeadersOnly && newActive?.cell.cellKind === CellKind.Markup && newActive?.level === 7) || // show headers only + cell is mkdn + is level 7 (no header)
277+
(!showCodeCells && newActive?.cell.cellKind === CellKind.Code) || // show code cells + cell is code
278+
(!showCodeCellSymbols && newActive?.cell.cellKind === CellKind.Code && newActive?.level > 7) // show code symbols + cell is code + has level > 7 (nb symbol levels)
279+
)
280+
) {
267281
this._activeEntry = newActive;
268282
this._onDidChange.fire({ affectOnlyActiveElement: true });
269283
}

0 commit comments

Comments
 (0)