Skip to content

feat: move Show-in-File-Tree into sidebar + always scroll-to-selected#2831

Merged
abose merged 10 commits intomainfrom
ai
Apr 21, 2026
Merged

feat: move Show-in-File-Tree into sidebar + always scroll-to-selected#2831
abose merged 10 commits intomainfrom
ai

Conversation

@abose
Copy link
Copy Markdown
Member

@abose abose commented Apr 21, 2026

  • Replace the CCB file-label block with a hover-only binoculars button in the sidebar's #project-files-header, next to #collapse-folders. The file name was redundant with the live-preview heading and file tabs.
  • Merge the new button into the existing CollapseFolders extension so the two hover-revealed sidebar actions share a single owner and stylesheet.
  • DocumentCommandHandlers.handleShowInTree: after ProjectManager.showInTree resolves, scroll the selected tree node into view. Previously the auto-scroll in FileTreeView only fired on unselected→selected transitions, so re-invoking the command on an already-selected file was a no-op when the user had scrolled away.
  • Add mainview:CentralControlBar integ-test suite covering layout, CCB buttons, and the new sidebar hover button, using CommandManager's beforeExecuteCommand event instead of spies.

abose added 10 commits April 21, 2026 11:20
- Replace the CCB file-label block with a hover-only binoculars button in
  the sidebar's #project-files-header, next to #collapse-folders. The
  file name was redundant with the live-preview heading and file tabs.
- Merge the new button into the existing CollapseFolders extension so
  the two hover-revealed sidebar actions share a single owner and stylesheet.
- DocumentCommandHandlers.handleShowInTree: after ProjectManager.showInTree
  resolves, scroll the selected tree node into view. Previously the
  auto-scroll in FileTreeView only fired on unselected→selected
  transitions, so re-invoking the command on an already-selected file
  was a no-op when the user had scrolled away.
- Add mainview:CentralControlBar integ-test suite covering layout, CCB
  buttons, and the new sidebar hover button, using CommandManager's
  beforeExecuteCommand event instead of spies.
- Change #sidebar's data-minsize from 30 to 0 so the Resizer's
  collapsible drag path (newSize < 10 → hide) fires when the user
  drags the right-edge handle to the left edge. The CCB sidebar-toggle
  button remains as the way to bring it back, so nothing is unreachable.
- Add shared test/spec/DragTestUtils.js for programmatic drag input
  across the harness's browser engines, and use it to replace the
  data-minsize attribute assertion with a real drag that verifies the
  full-collapse behavior and that the CCB toggle is still visible.
Adds a "3. Toggle Design Mode command" describe block that uses the real
command + CCB click paths (no spies): asserts VIEW_TOGGLE_DESIGN_MODE
flips WorkspaceManager.isInDesignMode(), Command.getChecked() mirrors
the flag on entry and exit, clicking #ccbCollapseEditorBtn toggles
design mode, and the icon (pen-nib svg ↔ fa-code) and title
(CCB_SWITCH_TO_DESIGN_MODE ↔ CCB_SWITCH_TO_CODE_EDITOR) swap on state
change. afterEach exits design mode and closes Live Preview so the
baseline stays clean for later tests.
CentralControlBar.js: _restoreExpandedLayout was clearing
savedToolbarWidth to null before reading it into targetWidth, so exit
always fell back to the innerWidth/2.5 default instead of restoring
the pre-collapse width when LP was open. Snapshot it into a local
preCollapseToolbarWidth before the reset.

Tests: add a "4. Enter design mode" describe block exercising the
user-visible entry behavior — LP panel appears on toggle, sidebar
width is preserved, main-toolbar takes up (innerWidth − sidebar − CCB)
starting at sidebar+CCB, editor area is visibly collapsed (hidden +
near-zero width), exit restores the pre-collapse toolbar width,
sidebar stays stable under repeated window-resize events, and
attempting to drag the main-toolbar's left-edge handle is a no-op
in design mode. No spies; effects measured via getBoundingClientRect
/ offsetWidth / getComputedStyle visibility.
- Replace the fa-rotate-left / fa-rotate-right glyphs on #ccbUndoBtn /
  #ccbRedoBtn with inline designer SVGs (src/styles/images/{undo,redo}.svg).
- Drop the designer asset's hardcoded fill/stroke colors; use fill:
  currentColor only so the icons inherit .ccb-btn color (hover/active
  follow free). No bg-coupled stroke — keeps the asset and stylesheet
  free of themed hardcodes.
- Render at 15x11 via CSS (.ccb-edit-icon) to match the visual weight
  of the surrounding CCB icons without needing the old stroke trim.
…helpers

- Add sections 5 and 6 of the control-bar TODO as user-perspective
  integ tests: LP stays open after exit, sidebar+CCB+toolbar fits the
  window with a real editor gap, toolbar lands at innerWidth/2.5 when
  the toggle itself opened LP, sidebar never snaps wider than its
  capped render across the transition, toolbar respects
  livePanel.minWidth + iconsBar, and clicking #toolbar-go-live in
  design mode exits design mode + hides LP + shrinks the toolbar to
  the icon-bar-only width.
- Dedupe the suite's helpers: hoist WorkspaceManager, livePanel(),
  openLivePreview(), closeLivePreviewIfOpen(), enterDesignMode(),
  exitDesignMode(), resetBaseline() and the common beforeEach /
  afterEach to the top-level describe. Section describes now hold
  only the tests (plus a tiny section-5 baseline width pin).
- Fix duplicate "3." section numbering — the show-in-file-tree block
  is now "2a." to match the TODO md.
- Also include credits.md update.
Adds:
- "7. Sidebar drag in design mode" — 1:1 grow tracking, CSS cap at
  calc(100vw - 230px) enforced even when dragging to the right edge,
  no ResizeObserver loop warnings during a capped drag, drag-to-collapse
  still works (CCB toggle remains to re-open), panelResizeStart/Update/End
  forwarded to #main-toolbar so lpedit-helper can track the drag.
- "8. Window resize while in design mode" — sidebar width stable across
  20 synthetic resize events, main-toolbar stays flush with the window
  right edge, sidebar-hidden toolbar fills window - CCB.
- "9. Plugin toolbar resizer" — normal-mode drag of the main-toolbar
  left-edge handle widens the panel ~1:1.
- "10. WorkspaceManager.setPluginPanelWidth" — design mode translates
  the requested width into a sidebar shrink (keeping toolbar flush);
  normal mode leaves sidebar untouched and respects the 75%/sidebar
  clamp.

Supporting changes:
- enterDesignMode() now also waits for LP visibility + sidebar
  data-maxsize "1000%" so drag tests see the fully-applied collapsed
  layout (isInDesignMode flips before _applyCollapsedLayout runs when
  LP had to be opened by the toggle).
- DragTestUtils.dragFromElement now waits 320ms after mouseup for the
  Resizer's .resizing-container shield to be removed; without this,
  the next test's mousedown landed on the stale shield and silently
  no-oped.
- ResizeObserver-warning console.error spy installed via
  beforeEach/afterEach instead of inline try/finally so Jasmine itself
  guarantees the restore.
- Replace awaitsFor(() => true, "a tick") placeholders with awaits(0)
  for event-loop flushes.
…s 11, 11b)

- Section 11: after enter→drag→exit→re-enter the CCB, sidebar, and
  main-toolbar stay aligned; two full cycles leave LP open with a
  toolbar at least at livePanel.minWidth + iconsBar and the layout
  still fits the window.
- Section 11b: clicking #app-drawer-button or invoking CMD_FIND_IN_FILES
  in design mode auto-exits design mode and mounts the feature UI;
  clicking #app-drawer-button in normal mode runs the original
  toggle with no spurious design-mode transition; #git-toolbar-icon
  exit is covered when git is available and skipped otherwise.
- NAVIGATE_QUICK_OPEN: the implementation uses a Spotlight-style
  .quick-open-floating-bar while in design mode instead of exiting —
  the test assertion matches that actual behaviour (stays in design
  mode, floating bar appears).
- All assertions observe user-visible outcomes (panel visibility,
  rect alignment, isInDesignMode() transitions), no impl-detail
  checks on savedToolbarWidth / body class / _restoreExpandedLayout.
…behaviour

- Top-level beforeAll now loads /spec/QuickOpen-test-files so every
  CCB suite runs against a populated project tree.
- Add four Quick Open tests under "11b. Auto-exit ..." covering the
  design-mode Spotlight variant: floating bar shows up and the search
  field lives inside .quick-open-floating-bar (not a ModalBar);
  dropdown lists project files without any query; typing "somelines"
  filters the list so the other file drops out; pressing Enter opens
  the selected file.
- Harden the section-11b afterEach to actually close find-in-files
  and quick-open bars (native keyboard event + awaitsFor on removal)
  so no leftover .modal-bar leaks into later tests.
- Section 12: design mode + noDistractions on hides the sidebar but
  keeps the main-toolbar visible (the LP surface the user is focused
  on); turning noDistractions off brings the sidebar back. Normal-mode
  toggle collapses/restores the sidebar. The "main-toolbar also hides"
  leg of the old contract is effectively dead — #main-toolbar's
  "display: flex !important" in brackets_patterns_override.less
  outranks .forced-hidden's "display: none !important" on selector
  specificity, so the test observes what the user actually sees (and
  a comment documents the regression).
- Section 13: WorkspaceManager.isInDesignMode() mirrors the current
  state; setDesignMode fires EVENT_WORKSPACE_DESIGN_MODE_CHANGE only
  on real transitions (no-op repeats are silent); CentralControlBar's
  back-compat isEditorCollapsed/setEditorCollapsed surface still
  drives design mode (module reached via testWindow.require).
@sonarqubecloud
Copy link
Copy Markdown

@abose abose merged commit b065e52 into main Apr 21, 2026
15 of 21 checks passed
@abose abose deleted the ai branch April 21, 2026 11:39
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.

1 participant