Skip to content

Comments

Enhance centered layout with new fixedEditorWidth option#1

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-4e8ef620-1e90-4902-b013-7490f178b8c3
Draft

Enhance centered layout with new fixedEditorWidth option#1
Copilot wants to merge 4 commits intomainfrom
copilot/fix-4e8ef620-1e90-4902-b013-7490f178b8c3

Conversation

Copy link

Copilot AI commented Aug 6, 2025

This PR enhances VS Code's centered layout functionality by changing centeredLayoutFixedWidth from a boolean to an enum with three options, adding a new "fixed editor width" behavior that was requested in the issue.

Changes Made

New Configuration Options

The workbench.editor.centeredLayoutFixedWidth setting now supports three values:

  • false (default) - Proportional margins: Margins scale with window size, editor content expands/contracts
  • 'fixedWindowWidth' - Fixed window width: Maintains constant 900px width with equal margins (original true behavior)
  • 'fixedEditorWidth' - Fixed editor width (NEW): Keeps editor width fixed but scales proportionally when window is too small

New fixedEditorWidth Behavior

The new option provides intelligent responsive behavior:

  • Large windows (≥900px): Uses 900px target width with equal margins
  • Small windows (<900px): Uses 80% for editor content, 10% margins on each side
  • Graceful scaling: Maintains readability while prioritizing editor content

Example with different window sizes:

1200px window: [150px margin] [900px editor] [150px margin]
600px window:  [60px margin]  [480px editor] [60px margin]

Backward Compatibility

Full backward compatibility is maintained through automatic migration:

  • Existing true settings migrate to 'fixedWindowWidth' (preserves current behavior)
  • Existing false settings remain false (preserves current behavior)
  • No breaking changes for existing users

Implementation Details

Files Modified:

  • src/vs/workbench/common/editor.ts - Updated type definitions
  • src/vs/workbench/browser/workbench.contribution.ts - Added enum configuration schema
  • src/vs/workbench/browser/parts/editor/editor.ts - Added validation and migration logic
  • src/vs/base/browser/ui/centered/centeredViewLayout.ts - Implemented new layout behavior

Key Features:

  • Type-safe enum implementation with proper validation
  • Automatic migration from boolean to enum values
  • Comprehensive logic handling for all three modes
  • Mathematical precision ensuring layouts always sum to window width

This enhancement provides users with more flexible centered layout options while maintaining full compatibility with existing configurations.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • electronjs.org
    • Triggering command: node-gyp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits August 6, 2025 12:20
Co-authored-by: jdupak-ms <191465639+jdupak-ms@users.noreply.github.com>
Co-authored-by: jdupak-ms <191465639+jdupak-ms@users.noreply.github.com>
Copilot AI changed the title [WIP] Modify centered layout behavior for case when: centeredLayoutFixedWidth: true (fixed width mode) centeredLayoutAutoResize: false (disable auto-resize) Change centeredLayoutFixedWidth from bool to options: - false (current false) - fixedWindow... Enhance centered layout with new fixedEditorWidth option Aug 6, 2025
Copilot AI requested a review from jdupak-ms August 6, 2025 12:26
@jdupak-ms
Copy link
Owner

@copilot Explore if you can use the existing github action of this repository to produce a modified binary for review.

Copy link
Author

Copilot AI commented Aug 6, 2025

@copilot Explore if you can use the existing github action of this repository to produce a modified binary for review.

I've explored the repository's GitHub Actions and build infrastructure. Here's what I found:

Current GitHub Actions Status:
The existing GitHub Actions in .github/workflows/ are designed for CI/CD testing, not binary distribution:

  • pr.yml - Runs compilation checks, unit tests, integration tests, and smoke tests
  • Platform-specific test workflows for Linux, macOS, and Windows
  • Focus on validation rather than artifact production

Build Infrastructure Analysis:
The repository uses a hybrid approach:

  • GitHub Actions: Testing and validation (current PR workflow)
  • Azure Pipelines: Binary building and distribution (in build/azure-pipelines/)
  • Gulp Tasks: Local development builds (e.g., vscode-linux-x64)

Challenges Identified:

  1. Network Restrictions: Firewall blocks electronjs.org needed for native module compilation
  2. Node.js Version: Requires Node.js ≥22, but environment runs v20.19.4
  3. Dependencies: Full build requires Electron headers and native modules

Recommended Approach:
Since the existing GitHub Actions aren't set up for binary production and environment constraints prevent a full build, I recommend:

  1. For immediate testing: The PR includes comprehensive implementation documentation and can be reviewed through code inspection
  2. For binary testing: Reviewers can build locally using:
    npm ci
    npm run compile
    npm run gulp vscode-linux-x64
  3. For CI artifacts: Consider extending Azure Pipelines to produce PR artifacts, as they have the proper environment setup

The centered layout changes are in core UI files and would be immediately visible when running VS Code with the modified code. Would you like me to create a simple demo or documentation showing the expected behavior instead?

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • electronjs.org
    • Triggering command: node-gyp (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

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.

2 participants