Show the CMake sidebar immediately with an initializing placeholder during activation - #5027
Open
Hannia Valera (hanniavalera) wants to merge 1 commit into
Open
Conversation
…g activation The CMake activity-bar container and all its views were gated on cmake:enableFullFeatureSet, which only flips true at the very end of the extension's init(), behind a serial chain of subprocess probes (cmake --version / -E capabilities, kit read, preset expansion, and the Visual Studio developer-environment bootstrap for cl.exe presets). On machines where process/file I/O is intermittently slow (e.g. antivirus scanning of spawned executables, or extension-host file-handle exhaustion / EMFILE), the entire sidebar disappears for minutes during activation. Introduce a two-phase reveal: a new cmake:isInitializing context key backs a transient, inert 'initializing' placeholder view so the activity-bar container appears immediately, while the real views, commands, and status bar remain gated on cmake:enableFullFeatureSet - nothing runs against a partially-initialized backend. The placeholder is shown when a cheap, fail-open preflight (variable expansion plus a single CMakeLists.txt stat, treating only ENOENT/ENOTDIR as absent so EMFILE and other transient filesystem errors still reveal the placeholder) finds a CMake project, and never in language-server-only mode. The key is set via setContextValue (UI-only, no command recompute) and cleared in a finally block so the icon never sticks on failure or when no project is found.
Hannia Valera (hanniavalera)
force-pushed
the
dev/hanniavalera/activation-initializing-view
branch
from
August 5, 2026 18:43
e3f9ea4 to
e6c95a8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The CMake Tools activity-bar sidebar, the container icon and all of its views (Project Status, Project Outline, Pinned Commands, Bookmarks), was hidden until the extension finished initializing. On machines where process/file I/O is intermittently slow, that can take minutes, during which the sidebar simply does not appear.
This PR introduces a two-phase reveal: the CMake activity-bar container now appears immediately with a lightweight, inert "CMake Tools is initializing…" placeholder, and hands off to the real views as soon as the backend is ready.
Why
The container and every view are gated on the
cmake:enableFullFeatureSetcontext key, which the extension only sets totrueat the very end ofExtensionManager.init()— behind a serial chain of subprocess probes (cmake --version/-E capabilities, the kit file read, preset parse/expansion, and the Visual Studio developer-environment bootstrap (vcvarsall) forcl.exepresets).When the environment makes process creation and file reads intermittently slow — e.g. antivirus scanning of every spawned executable, or extension-host file-handle exhaustion (
EMFILE) — those probes serialize into minutes of wall-clock time, and the entire sidebar stays hidden the whole time.cmake:enableFullFeatureSetalso gates ~255 other contributions (commands, menus, keybindings, the status bar), so it cannot simply be flipped early without exposing project actions against a not-yet-initialized backend.How
cmake:isInitializingcontext key backs a transient, inert placeholder view (cmake.initializing) whose content comes fromviewsWelcome. The activity-bar container'swhenbecomescmake:isInitializing || cmake:enableFullFeatureSet, and the placeholder view is gated oncmake:isInitializing && !cmake:enableFullFeatureSet.cmake:enableFullFeatureSet— nothing runs against a partially-initialized project. The transient placeholder and the real views are mutually exclusive, so there is no double-render and no empty-container flicker during the handoff.cmake:isInitializingis set right after the manager is constructed (viasetContextValue, so it does not trigger a command recompute) and cleared in afinallyafter activation settles, so the placeholder can never get stuck on failure or when no project is found.CMakeLists.txtstatper configured source directory (mirroringhasCMakeLists()), with no subprocess spawn, kit/preset init, or recursive scan. Crucially it fails open — onlyENOENT/ENOTDIRcount as "no project"; transient errors likeEMFILEstill show the placeholder, so the fix works in exactly the resource-starved environments it targets. It is skipped entirely in language-server-only mode.Scope
This is a UI-reveal fix. It does not change the actual initialization work, its ordering, or timing, the environmental slowness itself (antivirus,
EMFILE) is outside the extension's control. Deferring the individual probes (VS developer-environment acquisition, language-service asset loading) is a worthwhile but separate, higher-risk follow-upTesting
yarn backendTests(386 passing) — newactivation.test.ts(visibility policy + fail-open filesystem-error classification, incl.EMFILE) andactivation-contributions.test.ts(container/viewwhengating, the "placeholder and real views are never simultaneously visible" invariant, and thatcmake:isInitializingnever gates any command/menu/keybinding).yarn unitTests, 330 passing.tsc+gulp lintclean..cmakeworkspaces (no placeholder shown).