-
Notifications
You must be signed in to change notification settings - Fork 1.6k
vscode: Refactor manifest and align registry scripts with official installer #16868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughRefactors VS Code Windows manifest and scripts to add portable-mode orchestration (pre_install/post_install), broaden manifest surface (env_add_path, shortcuts, persist), normalize extension paths, and consolidate Windows registry context/association keys under a VSCode namespace; also updates checkver.jsonpath to use productVersion. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Installer
participant Manifest as "bucket/vscode.json"
participant PreInstall as "pre_install (script)"
participant PostInstall as "post_install (script)"
participant Registry
participant FS as "Filesystem (extensions/user data)"
Installer->>Manifest: read manifest fields (env_add_path, pre_install, post_install, persist, shortcuts)
Manifest->>PreInstall: invoke pre_install sequence
PreInstall->>FS: detect & migrate existing extensions/user data -> portable data dir
PreInstall->>PostInstall: emit migration plan & path mappings
Installer->>PostInstall: run post_install
PostInstall->>Registry: generate/write registry scripts (register/unregister, context, associations)
PostInstall->>FS: normalize/patch extensions.json paths to portable dir
Registry-->>Installer: registry keys created/updated
FS-->>Installer: extensions/user data relocated
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2025-10-13T09:37:06.093ZApplied to files:
📚 Learning: 2025-10-14T11:24:17.524ZApplied to files:
📚 Learning: 2025-10-14T11:15:55.229ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
All changes look good. Wait for review from human collaborators. vscode
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
bucket/vscode.jsonscripts/vscode/install-associations.regscripts/vscode/install-context.regscripts/vscode/register-installed-program.regscripts/vscode/uninstall-associations.regscripts/vscode/uninstall-context.regscripts/vscode/unregister-installed-program.reg
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-10-13T09:37:06.093Z
Learnt from: o-l-a-v
Repo: ScoopInstaller/Extras PR: 16328
File: bucket/winutil.json:0-0
Timestamp: 2025-10-13T09:37:06.093Z
Learning: When reviewing code in Scoop manifests, always verify the actual file content if the diff appears incomplete or unusual, as diff context can be truncated or displayed incorrectly. The pattern `[string[]](...).ForEach{...}` is commonly used in post_uninstall scripts across the Extras repository.
Applied to files:
scripts/vscode/uninstall-associations.reg
📚 Learning: 2025-10-16T13:42:43.224Z
Learnt from: o-l-a-v
Repo: ScoopInstaller/Extras PR: 16349
File: bucket/debugviewpp.json:14-21
Timestamp: 2025-10-16T13:42:43.224Z
Learning: In the DebugViewPP project (CobaltFusion/DebugViewPP), the executable name changed from "DebugView++.exe" (in v1.8.0.103 and earlier) to "Debugviewpp.exe" (in v1.9.0.28 and later). The manifest bucket/debugviewpp.json correctly uses "Debugviewpp.exe" for current versions.
Applied to files:
bucket/vscode.json
📚 Learning: 2025-10-14T11:24:17.524Z
Learnt from: SorYoshino
Repo: ScoopInstaller/Extras PR: 16333
File: bucket/potplayer.json:55-64
Timestamp: 2025-10-14T11:24:17.524Z
Learning: In PotPlayer manifests (bucket/potplayer.json), the Capture and Playlist folders are created at runtime (after running the application), not included in the installer, so they should only be in the persist list and not in post_install scripts.
Applied to files:
bucket/vscode.json
📚 Learning: 2025-10-14T11:15:55.229Z
Learnt from: SorYoshino
Repo: ScoopInstaller/Extras PR: 16333
File: bucket/potplayer.json:55-64
Timestamp: 2025-10-14T11:15:55.229Z
Learning: In PotPlayer manifests (bucket/potplayer.json), the Model and Engine folders are created at runtime (not included in the installer), so they should only be in the persist list and not in post_install scripts that handle .original directories.
Applied to files:
bucket/vscode.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: WindowsPowerShell
🔇 Additional comments (8)
scripts/vscode/unregister-installed-program.reg (1)
1-3: LGTM!The registry deletion file correctly uses the
[-KEY]syntax to remove the installed program entry, and the GUID matches the registration file.scripts/vscode/register-installed-program.reg (1)
1-10: LGTM!The registry template correctly creates an installed-program entry that enables integration with other applications. The
{{vscode_dir}}placeholder will be replaced during post_install. OmittingUninstallStringis appropriate since Scoop manages uninstallation.scripts/vscode/uninstall-context.reg (1)
3-9: LGTM!The uninstall registry correctly removes all four context menu entries (
*,Directory\Background,Directory,Drive) that are created byinstall-context.reg.scripts/vscode/uninstall-associations.reg (1)
973-979: Good coverage of additional file types.The file now includes uninstall entries for the additional file types mentioned in the PR objectives (
.json5,.jsonc,.zshrc, etc.), and properly cleans up theVSCodeSourceFileclass at the end.scripts/vscode/install-context.reg (1)
3-32: LGTM!The context menu registrations are well-structured:
- Correct use of
%1for files and%Vfor directories/drives- Consistent
{{vscode_dir}}placeholder for Code.exe paths- Keyboard accelerator (
&i) properly placed in "Open w&ith Code"bucket/vscode.json (3)
70-77: LGTM - Standard Scoop manifest fields.The
env_add_path,shortcuts, andpersistfields are correctly configured for portable mode operation.
87-89: LGTM - Version detection improvement.Changing from
$.nameto$.productVersionfor checkver is a reliable improvement, asproductVersiondirectly provides the semantic version string.
27-42: No changes needed for thereturnstatement on line 30.The
returnstatement in the pre_install script behaves as intended. In Scoop's script execution model, manifest scripts are invoked as separate script blocks wherereturnexits the script execution without affecting parent scope—this is the correct and standard behavior for PowerShell in this context.
|
/verify |
|
All changes look good. Wait for review from human collaborators. vscode
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (2)
bucket/vscode.json (2)
44-44: Backslash escaping is still incorrect for .reg file format.The pattern
-replace '\\\\', '\\\\'matches two literal backslashes and replaces with two - effectively a no-op for standard Windows paths likeC:\Users\.... The intent is to escape each single backslash for.regfile format (e.g.,C:\Users\...→C:\\Users\\...).🔎 Recommended fix using .Replace() method
- "$vscode_path = $dir -replace '\\\\', '\\\\'", + "$vscode_path = $dir.Replace('\\', '\\\\')",Using the string
.Replace()method avoids regex escaping complexity and correctly replaces each single backslash with a double backslash for the.regfile format.
60-61: Unconditional cleanup risks data loss if migration fails.Lines 60-61 unconditionally delete the original data locations (
$env:USERPROFILE\.vscode\argv.json,$env:USERPROFILE\.vscode\extensions,$env:AppData\Code) immediately after the copy operations on lines 52-58. If a copy fails silently (e.g., due to permissions, disk space, or I/O errors), user extensions and settings will be permanently lost.🔎 Recommended approaches
Option 1: Verify before cleanup
+ "# Verify migration succeeded before cleanup", + "$migration_ok = (Test-Path \"$dir\\data\\user-data\\User\\settings.json\") -or (Test-Path \"$dir\\data\\extensions\\extensions.json\")", + "if (-not $migration_ok) {", + " warn 'Migration verification failed - original data preserved in AppData and .vscode'", + " return", + "}", "$remove_list = 'argv.json', 'extensions' | ForEach-Object { \"$env:USERPROFILE\\.vscode\\$_\" }", "$remove_list + @(\"$env:AppData\\Code\") | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue"Option 2: Skip automatic cleanup (safer)
- "$remove_list = 'argv.json', 'extensions' | ForEach-Object { \"$env:USERPROFILE\\.vscode\\$_\" }", - "$remove_list + @(\"$env:AppData\\Code\") | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue" + "info 'Migration complete. Original data preserved in:'", + "info ' - $env:USERPROFILE\\.vscode (argv.json, extensions)'", + "info ' - $env:AppData\\Code (user-data)'", + "info 'You may remove these manually after verifying the portable installation.'"
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
bucket/vscode.jsonscripts/vscode/install-associations.regscripts/vscode/install-context.regscripts/vscode/register-installed-program.regscripts/vscode/uninstall-associations.regscripts/vscode/uninstall-context.regscripts/vscode/unregister-installed-program.reg
✅ Files skipped from review due to trivial changes (1)
- scripts/vscode/unregister-installed-program.reg
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-13T09:37:06.093Z
Learnt from: o-l-a-v
Repo: ScoopInstaller/Extras PR: 16328
File: bucket/winutil.json:0-0
Timestamp: 2025-10-13T09:37:06.093Z
Learning: When reviewing code in Scoop manifests, always verify the actual file content if the diff appears incomplete or unusual, as diff context can be truncated or displayed incorrectly. The pattern `[string[]](...).ForEach{...}` is commonly used in post_uninstall scripts across the Extras repository.
Applied to files:
scripts/vscode/uninstall-context.regbucket/vscode.jsonscripts/vscode/uninstall-associations.reg
📚 Learning: 2025-10-14T11:24:17.524Z
Learnt from: SorYoshino
Repo: ScoopInstaller/Extras PR: 16333
File: bucket/potplayer.json:55-64
Timestamp: 2025-10-14T11:24:17.524Z
Learning: In PotPlayer manifests (bucket/potplayer.json), the Capture and Playlist folders are created at runtime (after running the application), not included in the installer, so they should only be in the persist list and not in post_install scripts.
Applied to files:
bucket/vscode.json
📚 Learning: 2025-10-14T11:15:55.229Z
Learnt from: SorYoshino
Repo: ScoopInstaller/Extras PR: 16333
File: bucket/potplayer.json:55-64
Timestamp: 2025-10-14T11:15:55.229Z
Learning: In PotPlayer manifests (bucket/potplayer.json), the Model and Engine folders are created at runtime (not included in the installer), so they should only be in the persist list and not in post_install scripts that handle .original directories.
Applied to files:
bucket/vscode.json
🔇 Additional comments (8)
scripts/vscode/install-context.reg (1)
1-32: LGTM! Registry syntax and structure are correct.The consolidation under the
VSCodenamespace with{{vscode_dir}}templates is well-structured. The context menu entries for files, directories, backgrounds, and drives follow Windows registry conventions correctly.scripts/vscode/uninstall-context.reg (1)
1-9: LGTM! Uninstall entries correctly match installation.The deletion entries properly remove all four VSCode context menu keys using correct registry syntax. This ensures complete cleanup of context menu integration.
scripts/vscode/uninstall-associations.reg (1)
1-969: LGTM! Comprehensive file association cleanup.The uninstall registry entries correctly remove VSCode file associations using proper
.regsyntax. The pattern is consistent throughout: remove OpenWithProgIDs entries, then delete associated VSCode.* class keys. The final removal ofVSCodeSourceFilecompletes the cleanup.bucket/vscode.json (4)
3-16: LGTM! Improved description and clearer registry integration notes.The enhanced description better captures VS Code's capabilities, and the updated notes clearly explain the purpose of each registry file. The rename from
install-github-integration.regtoregister-installed-program.regaccurately reflects its actual function.
78-86: LGTM! Uninstaller now properly removes all registry entries.The uninstaller correctly imports all three registry cleanup files:
uninstall-context.reg- removes context menu entriesuninstall-associations.reg- removes file associationsunregister-installed-program.reg- removes installed program entryThis addresses the previous issue where
uninstall-context.regwas duplicated and file associations were not removed.
70-77: The manifest fields at lines 70-77 are correctly configured. VS Code includes a bin directory, and Scoop's env_add_path functionality adds the specified directory to the system path, where the directory is relative to the install location. The shortcut and persist settings are also appropriate for portable mode. No issues found.
87-90: Verify that the VS Code update API actually returns aproductVersionfield.The checkver jsonpath changed from
$.nameto$.productVersion. Since I cannot directly test the endpoint in this environment, you should confirm that the update API returns theproductVersionfield and that it contains the version string in the expected format.scripts/vscode/register-installed-program.reg (1)
3-3: GUID is correct.The GUID
{771FD6B0-FA20-440A-A002-3B3BAC16DC50}_is1matches the official VS Code 64-bit user installation and is properly registered underHKEY_CURRENT_USERfor user-scope detection by other installers and applications.
|
/verify |
|
All changes look good. Wait for review from human collaborators. vscode
|
Summary
Refactors the
vscodemanifest to improve portability, data migration, and maintainability.Separately, the registry (
.reg) scripts have been updated to better align with entries and behavior observed in the official Visual Studio Code installer.Related issues or pull requests
Changes
.reg) scripts based on entries generated by the official VS Code installer, ensuring:notesto better reflect available registry integration optionspost_installlogic to dynamically apply registry templates and support both user-level and global installsuninstallerbehavior to properly unregister registry entriescheckverto rely onproductVersionfor more reliable version detectionNotes
pre_installscript to ensure extension paths are adjusted correctly. The rationale behind this logic is as follows:_sep,fsPath, andexternalfields within thelocationobject inextensions.json.locationobject no longer contains the above fields, and auuidfield is added to itsidentifierobject, with the value equal tometadata.id.extensions.json; the previously modified metadata for extension A remains unchanged.pre_installscript intentionally emulates this behavior. It assumes that the application can derive the other two path representations fromlocation.pathalone (as evidenced by the current structure ofextensions.json). Updating all three path variants would introduce unnecessary complexity, so the script limits itself to normalizinglocation.pathonly, which is sufficient and consistent with observed behavior.install-associations.regare derived from the official installer. In addition to the existing associations, this update adds support for.json5,.jsonc,.zshrc, and other related file types.install-context.regare also based on the official installer. The only difference is that the official installer registers the relevant values asREG_EXPAND_SZ, whereas this PR usesREG_SZ. Both registry value types function correctly in this context.install-github-integration.regis potentially misleading. It has therefore been renamed toregister-installed-program.reg, and the corresponding entries in thenotesfield have been updated accordingly.Testing
The test results are as follows:
<manifest-name[@version]|chore>: <general summary of the pull request>Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.