Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion bucket/vscode.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@
"post_install": [
"$dirpath = \"$dir\".Replace('\\', '\\\\')",
"$exepath = \"$dir\\Code.exe\".Replace('\\', '\\\\')",
"$targetpath = $dirpath",
"if (Test-Path \"$dir\\bin\\code\") {",
" if ((Get-Content \"$dir\\bin\\code\" -Raw) -match 'VERSIONFOLDER=\"([^\"]+)\"') {",
" $targetpath = \"$dir\\$($matches[1])\".Replace('\\', '\\\\')",
" }",
"}",
"'install-associations', 'uninstall-associations', 'install-context', 'uninstall-context', 'install-github-integration', 'uninstall-github-integration' | ForEach-Object {",
" if (Test-Path \"$bucketsdir\\extras\\scripts\\vscode\\$_.reg\") {",
" $content = Get-Content \"$bucketsdir\\extras\\scripts\\vscode\\$_.reg\"",
" $content = $content.Replace('$codedir', $dirpath)",
" if ($_ -match 'github') {$tmppath = $dirpath} else {$tmppath = $targetpath}",
" $content = $content.Replace('$codedir', $tmppath)",
" $content = $content.Replace('$code', $exepath)",
" if ($global) {",
" $content = $content.Replace('HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE')",
Expand All @@ -57,12 +64,23 @@
"if ((Test-Path \"$extensions_file\")) {",
" info 'Adjusting path in extensions file...'",
" (Get-Content \"$extensions_file\") -replace '(?<=vscode(/|\\\\\\\\)).*?(?=(/|\\\\\\\\)data(/|\\\\\\\\)extensions)', $version | Set-Content \"$extensions_file\"",
"}",
"$appRoot = Split-Path $dir -Parent",
"$otherVersions = @(Get-ChildItem $appRoot -Directory | Where-Object { $_.FullName -ne $dir -and $_.Name -ne 'current' -and ($_.Name -match '^[0-9.]+$') })",
"if ($otherVersions.Count -gt 0) {",
" 'uninstall-associations', 'uninstall-context', 'uninstall-github-integration' | ForEach-Object {",
" $regFile = \"$dir\\$_.reg\"",
" if (Test-Path $regFile) {",
" regedit /s \"$regFile\"",
" }",
" }",
"}"
Comment on lines +68 to 77
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use reg import instead of regedit /s for consistency and reliability.

The uninstaller block (lines 83–85) uses reg import, but this cleanup block uses regedit /s. regedit is a GUI application — even with /s, it runs asynchronously and can behave differently under UAC/elevation. reg import is the CLI counterpart, runs synchronously, and is the standard used throughout Scoop manifests.

Proposed fix
     "'uninstall-associations', 'uninstall-context', 'uninstall-github-integration' | ForEach-Object {",
         "$regFile = \"$dir\\$_.reg\"",
         "if (Test-Path $regFile) {",
-            "regedit /s \"$regFile\"",
+            "reg import \"$regFile\"",
         "}",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"$appRoot = Split-Path $dir -Parent",
"$otherVersions = @(Get-ChildItem $appRoot -Directory | Where-Object { $_.FullName -ne $dir -and $_.Name -ne 'current' -and ($_.Name -match '^[0-9.]+$') })",
"if ($otherVersions.Count -gt 0) {",
" 'uninstall-associations', 'uninstall-context', 'uninstall-github-integration' | ForEach-Object {",
" $regFile = \"$dir\\$_.reg\"",
" if (Test-Path $regFile) {",
" regedit /s \"$regFile\"",
" }",
" }",
"}"
"$appRoot = Split-Path $dir -Parent",
"$otherVersions = @(Get-ChildItem $appRoot -Directory | Where-Object { $_.FullName -ne $dir -and $_.Name -ne 'current' -and ($_.Name -match '^[0-9.]+$') })",
"if ($otherVersions.Count -gt 0) {",
" 'uninstall-associations', 'uninstall-context', 'uninstall-github-integration' | ForEach-Object {",
" $regFile = \"$dir\\$_.reg\"",
" if (Test-Path $regFile) {",
" reg import \"$regFile\"",
" }",
" }",
"}"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bucket/vscode.json` around lines 68 - 77, The cleanup loop that builds
$regFile in the block starting with "$appRoot = Split-Path $dir -Parent" uses
"regedit /s \"$regFile\"" which is GUI-based and async; replace that call with
the synchronous CLI "reg import \"$regFile\"" to match the rest of the manifest.
Locate the loop that iterates over 'uninstall-associations',
'uninstall-context', 'uninstall-github-integration' (the $regFile variable) and
swap the regedit invocation for reg import so registry files are imported
reliably under UAC/elevation.

],
"uninstaller": {
"script": [
"if ($cmd -eq 'uninstall')",
"{",
" reg import \"$dir\\uninstall-associations.reg\" ",
" reg import \"$dir\\uninstall-context.reg\" ",
" reg import \"$dir\\uninstall-github-integration.reg\" ",
"}"
Expand Down