mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-15 02:07:31 +01:00
* Avoid :has() selectors that trigger workbench-wide style invalidation A :has() whose anchor exists in the live DOM makes Blink re-evaluate it on DOM mutations anywhere in the document - including the inline style writes the editor performs on every layout. With a populated chat working set, every forced style recalc traversed the whole visible workbench (~218ms per Recalculate Style in a large workspace; sash drag nearly frozen). Same issue class as #324985. Per-rule profiling showed the chat editing session scrollbar rule alone accounted for 77% of the per-recalc cost; the root-anchored rules in floatingPanels.css and sessionsPolicyBlocked.css are the same hazard. - chat.css: key the scrollbar padding off an 'overflowing' class toggled in chatInputPart.ts, which already computes the condition. The padding now applies whenever the list overflows instead of only while the auto-hide scrollbar is faded in. - floatingPanels.css: use 'activitybar-compact' (mirrored by activitybarPart.ts) and 'noactivitybar' (toggled by layout.ts like the other part visibility classes). - sessionsPolicyBlocked.css: toggle a class for the overlay's lifetime. - build/stylelint.ts: error on root-anchored :has() (body/html/:root/ .monaco-workbench), with a has-anchor-checker disable escape. * Match root-anchored :has() as complete tokens at any compound position Addresses Copilot review feedback: the previous regex missed root tokens that are not first in the compound (.style-override.monaco-workbench:has()) and matched incomplete tokens (.monaco-workbench-test, bodyguard). Extracted into build/lib/stylelint/validateHasSelectors.ts with focused tests. * Use layoutService.mainContainer for the policy-blocked root class Review feedback: inject IWorkbenchLayoutService instead of walking the DOM with container.closest(). The caller already passes mainContainer as the overlay container. Stub the layout service in the component fixture. * small tweaks * Drop build/ changes; lint rule moves to a separate PR * build: prevent root-anchored :has() selectors Add a stylelint check for root-level :has() selectors that cause workbench-wide style invalidation, together with focused parser tests. This is split from #327052 and should merge after it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: zmr233 <zmr_233@outlook.com> Co-authored-by: zmr-233 <132034425+zmr-233@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>