-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Feature Type
New Functionality
Priority/Impact
High
Problem Statement
Currently, there's no automated way to ensure that VSCode extensions listed in .vscode/extensions.json are properly synced with the extensions configured in .devcontainer/devcontainer.json. This can lead to inconsistent development environments where some extensions are recommended but not automatically available in the devcontainer. Developers may set up their local VSCode with recommended extensions but find that the same extensions aren't available when working in the devcontainer, causing confusion and reducing development efficiency.
Requires Proposal
No, straightforward implementation
Proposed Solution
Create a Python validation script in the scripts/ directory that:
-
Script:
scripts/check_extension_sync.py- Reads both
.vscode/extensions.jsonand.devcontainer/devcontainer.jsonfiles - Compares the recommended extensions in both configurations
- Validates that ALL extensions from
.vscode/extensions.jsonare present in the devcontainer configuration - Provides clear, actionable error messages when extensions are out of sync
- Reads both
-
Pre-commit Hook Integration:
- Add the script to the existing pre-commit configuration
- Fails the commit if extensions are not in sync
- Forces engineers to manually update the appropriate configuration files
-
Just Recipe: Add a
justfilerecipe:# Check if VSCode recommended extensions are synced with devcontainer check-extension-sync: uvx scripts/check_extension_sync.py -
Error Reporting Features:
- Lists specific extension IDs that are missing
- Clearly indicates which file needs to be updated (devcontainer.json)
- Provides easy-to-follow instructions for resolving sync issues
- Example output:
❌ VSCode extensions not synced with devcontainer configuration! Missing from .devcontainer/devcontainer.json: - ms-python.python - ms-python.black-formatter To fix: Add these extensions to the "customizations.vscode.extensions" array in .devcontainer/devcontainer.json
-
Implementation Details:
- Cross-platform compatibility (macOS, Linux, Windows)
- Robust JSON parsing with error handling
- Integration with existing pre-commit hook workflow
- Option to run manually:
uvx scripts/check_extension_sync.py
Script Specifications
- Location:
scripts/check_extension_sync.py - Execution: Run with
uv runand integrated into pre-commit hooks - Exit Codes:
0: Extensions are in sync1: Extensions are out of sync (with detailed error message)2: Script error (file not found, parsing error, etc.)
File Parsing Requirements
- Parse
.vscode/extensions.jsonto extract recommended extensions - Parse
.devcontainer/devcontainer.jsonto extract configured extensions fromcustomizations.vscode.extensions - Handle both string arrays and objects with version specifications
- Gracefully handle missing files or malformed JSON
Error Message Specifications
- Use clear, colored output (if terminal supports it)
- Provide specific extension IDs that are missing
- Include path to target file that needs updating
- Offer brief instructions on how to resolve the issue
- Use consistent formatting with other project tooling
Research Needed
No
Research Details
No response
Acceptance Criteria Confirmation
Yes
Pre-submission Confirmation
Yes