Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Centered Layout FixNew to Visual Studio Code? Get it now.
Centered Layout Fix

Centered Layout Fix

slam

|
1 install
| (0) | Free
Reliably enables centered layout on startup via workbench.editor.centeredLayout
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Centered Layout Fix

Fixes microsoft/vscode#286692 — workbench.editor.centeredLayout: true does not reliably restore on startup.

Usage

No new settings. Just configure VS Code as you normally would:

// settings.json
{
  "workbench.editor.centeredLayout": true
}

The extension applies the setting on startup and re-syncs whenever a new file is opened.

Why this extension exists

VS Code provides a Centered Layout mode toggled via View: Toggle Centered Layout. The setting workbench.editor.centeredLayout is supposed to persist this preference across restarts, but due to a startup sequencing bug the UI state is reset to false even when the setting is true.

This extension activates after VS Code finishes loading (onStartupFinished) and forces the UI state to match the setting value. It also re-syncs on onDidOpenTextDocument to handle edge cases where VS Code resets the layout mid-session (e.g. diff editors).

Behavior

Event Action
VS Code starts Apply workbench.editor.centeredLayout value
New file opened (file:// or untitled://) Re-sync if state drifted
Setting changed at runtime Apply immediately, no restart needed

Limitations

  • VS Code does not expose a public API to read the current centered layout state. The extension tracks state in memory per window session, assuming VS Code always resets to false on restart (which matches the bug behavior). If the user manually toggles centered layout outside the setting, the extension will re-apply the setting value on the next relevant event.
  • Centered layout is automatically disabled by VS Code when multiple editor groups are present. This extension does not override that behavior.

Development

git clone <repo>
cd centered-layout-fix
npm install
npm run compile   # or: npm run watch

# Package
npx @vscode/vsce package --no-dependencies --allow-missing-repository

# Install locally
code --install-extension centered-layout-fix-0.1.0.vsix
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft