-
Notifications
You must be signed in to change notification settings - Fork 1.7k
theia-ide: add context menu for folders #18366
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?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,13 +3,41 @@ | |
| "description": "A modern and open IDE for cloud and desktop. Theia platform based. Formerly “Theia Blueprint”.", | ||
| "homepage": "https://theia-ide.org/#theiaide", | ||
| "license": "EPL-2.0, GPL-2.0, MIT", | ||
| "notes": "Settings are stored in '%APPDATA%\\Theia IDE', and are not persisted by Scoop.", | ||
| "notes": [ | ||
| "Added 'Open with Theia IDE' context menu entry for folders", | ||
| "To remove: reg import \"$dir\\uninstall-context.reg\"", | ||
| "Settings in '%APPDATA%\\Theia IDE' not persisted by Scoop" | ||
| ], | ||
| "architecture": { | ||
| "64bit": { | ||
| "url": "https://www.eclipse.org/downloads/download.php?mirror_id=1&file=/theia/ide/1.73.100/windows/TheiaIDESetup-1.73.100.exe#/dl.7z", | ||
| "hash": "sha512:649b3c552f9a4d046ebc8d64eaee9b27c7bf156d23e5012ed91c299cafedde986f4967ee1e71aa9ec37d894809d15dbd72ce736fecac952fbf774955234cf1a6" | ||
| } | ||
| }, | ||
| "post_install": [ | ||
| "$theia_path = $dir -replace '\\\\', '\\\\'", | ||
| "$scriptsdir = \"$bucketsdir\\$bucket\\scripts\\$app\"", | ||
| "if (-not (Test-Path $scriptsdir)) {", | ||
| " Write-Host \"Warning: reg script source not found at $scriptsdir\" -ForegroundColor Yellow", | ||
| "} else {", | ||
| " Get-ChildItem -Path $scriptsdir -Filter '*.reg' -File | ForEach-Object {", | ||
| " $content = Get-Content -Path $_.FullName -Encoding utf8", | ||
| " if ($global) { $content = $content -replace 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE' }", | ||
| " $content -replace '{{theia_dir}}', $theia_path | Set-Content -Path \"$dir\\$($_.Name)\" -Encoding unicode", | ||
| " }", | ||
| " reg import \"$dir\\install-context.reg\"", | ||
| "}" | ||
| ], | ||
| "uninstaller": { | ||
| "script": [ | ||
| "if ($cmd -eq 'uninstall')", | ||
| "{", | ||
| " if (Test-Path \"$dir\\uninstall-context.reg\") {", | ||
| " reg import \"$dir\\uninstall-context.reg\"", | ||
| " }", | ||
| "}" | ||
| ] | ||
| }, | ||
|
Comment on lines
+17
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== file list candidates =="
fd -a 'theia-ide\.json$' . || true
fd -a 'theia-ide' . || true
echo "== manifest =="
if [ -f bucket/theia-ide.json ]; then
cat -n bucket/theia-ide.json
fi
echo "== related files =="
git ls-files | rg 'theia|context\.reg|scripts|post_install|uninstall' || trueRepository: ScoopInstaller/Extras Length of output: 7688 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== theia scripts =="
cat -n scripts/theia-ide/install-context.reg
printf '\n-- uninstall --\n'
cat -n scripts/theia-ide/uninstall-context.reg
echo "== line endings for manifest and scripts =="
python3 - <<'PY'
from pathlib import Path
for p in [Path('bucket/theia-ide.json'), Path('scripts/theia-ide/install-context.reg'), Path('scripts/theia-ide/uninstall-context.reg')]:
blob=p.read_bytes()
print(f'{p}: CRLF={b"\r\n" in blob}, LF={b"\n" in blob}, LF_without_CRLF={b"\n" not in blob or b"\r\n" in blob}')
PY
echo "== PowerShell error behavior probe =="
if command -v pwsh >/dev/null 2>&1; then
pwsh -NoProfile -NonInteractive -Command '
Set-StrictMode -Version Latest
Write-Host "Available reg.exe: $(if ($env:windir -and (Test-Path ("$env:windir\system32\reg.exe"))){1}else{0})"
try { reg import nonexistent.reg }
catch { Write-Host "Caught"; Write-Host $_.FullyQualifiedErrorId }
'
else
echo "pwsh not available"
fiRepository: ScoopInstaller/Extras Length of output: 1653 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== manifest script blocks with call context =="
python3 - <<'PY'
from pathlib import Path
p=Path('bucket/theia-ide.json')
text=p.read_text(encoding='utf-8-sig')
for token in ['"post_install"', '"uninstaller"', '": {', '": [']:
if token in text:
idx=text.index(token)
lines=text[:idx].splitlines()
row=sum(1 for _ in range(len(lines)))+1
print(f'{token}: near line {row}')
for i,l in enumerate(text.splitlines(),1):
if 'reg import' in l or 'scriptsdir' in l or 'Write-Host' in l:
print(f'{i}: {l}')
PY
echo "== line endings =="
python3 - <<'PY'
from pathlib import Path
for p in ['bucket/theia-ide.json','scripts/theia-ide/install-context.reg','scripts/theia-ide/uninstall-context.reg']:
data=Path(p).read_bytes()
has_crlf=b'\r\n' in data
has_lf=b'\n' in data
lf_without_crlf=has_lf and not has_crlf
print(f'{p}: CRLF={has_crlf} LF={has_lf} LF_without_CRLF={lf_without_crlf}')
PY
echo "== PowerShell reg import error behavior =="
if command -v pwsh >/dev/null 2>&1; then
pwsh -NoProfile -NonInteractive -Command '
Set-StrictMode -Version Latest
$hasReg=if ($env:windir -and (Test-Path "$env:windir\system32\reg.exe")){1}else{0}
Write-Host "Available reg.exe: $hasReg"
try {
$output=& reg import "C:\ThisDoesNotExist.reg" 2>&1
Write-Host "LastExitCode: $LASTEXITCODE"
Write-Host "Output: $output"
} catch {
Write-Host "Caught exception in try block"
Write-Host $_.FullyQualifiedErrorId
}
if (Test-Path C:\ThisDoesNotExist.reg -PathType Leaf) { Remove-Item C:\ThisDoesNotExist.reg -Force }
'
else
echo "pwsh not available"
fi
echo "== comparable manifests handling context reg import =="
python3 - <<'PY'
import json, re
needles = re.compile(r"reg import|reg import|\.reg'")
for p in ['uninstall-context.reg','install-context.reg']:
pass
files = list(Path('scripts').glob('*/*.ps1')) + list(Path('scripts').glob('*/*.psm1'))
for p in files:
txt=p.read_text(encoding='utf-8-sig')
if 'reg import' in txt:
print(f'--- {p} ---')
for i,line in enumerate(txt.splitlines(),1):
if 'reg import' in line:
print(f'{i}: {line}')
PYRepository: ScoopInstaller/Extras Length of output: 1343 🌐 Web query:
💡 Result: When you use the PowerShell call operator (&) to execute a command that does not exist, PowerShell raises a CommandNotFoundException [1][2]. ### Understanding the Error By default, this is a non-terminating error [1][2]. This means that if the command fails, the PowerShell script or pipeline will continue executing the subsequent lines [1]. The error is reported to the error stream, but it does not stop the execution flow of your script [1][2]. ### How to Handle It If you need to treat this error as a terminating error or perform custom handling, you have several options: 1. Use $ErrorActionPreference: You can globally change the behavior by setting $ErrorActionPreference = 'Stop'. This will escalate all non-terminating errors, including CommandNotFoundException, into terminating errors [1][2]. Citations:
Fail clearly when registry integration cannot be completed.
🤖 Prompt for AI Agents |
||
| "extract_dir": "$PLUGINSDIR", | ||
| "installer": { | ||
| "script": "Expand-7zipArchive \"$dir\\app-64.7z\" \"$dir\" -Removal" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| Windows Registry Editor Version 5.00 | ||
|
|
||
| ; Register context menu entry: 'Open with Theia IDE' | ||
|
|
||
| [HKEY_CURRENT_USER\Software\Classes\Directory\shell\Open with &Theia IDE] | ||
| @="Open with &Theia IDE" | ||
| "Icon"="{{theia_dir}}\\TheiaIDE.exe" | ||
|
|
||
| [HKEY_CURRENT_USER\Software\Classes\Directory\shell\Open with &Theia IDE\command] | ||
| @="\"{{theia_dir}}\\TheiaIDE.exe\" \"%V\"" | ||
|
|
||
| [HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\Open with &Theia IDE] | ||
| @="Open with &Theia IDE" | ||
| "Icon"="{{theia_dir}}\\TheiaIDE.exe" | ||
|
|
||
| [HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\Open with &Theia IDE\command] | ||
| @="\"{{theia_dir}}\\TheiaIDE.exe\" \"%V\"" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Windows Registry Editor Version 5.00 | ||
|
|
||
| ; Unregister context menu entry: 'Open with Theia IDE' | ||
|
|
||
| [-HKEY_CURRENT_USER\Software\Classes\Directory\shell\Open with &Theia IDE] | ||
|
|
||
| [-HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\Open with &Theia IDE] |
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: ScoopInstaller/Extras
Length of output: 4378
🏁 Script executed:
Repository: ScoopInstaller/Extras
Length of output: 369
🏁 Script executed:
Repository: ScoopInstaller/Extras
Length of output: 600
🏁 Script executed:
Repository: ScoopInstaller/Extras
Length of output: 234
🏁 Script executed:
Repository: ScoopInstaller/Extras
Length of output: 235
🏁 Script executed:
Repository: ScoopInstaller/Extras
Length of output: 325
Make the removal note user-executable.
$diris a manifest-script variable, so the displayed note is not a command a user can paste into their shell. Since uninstall already importsuninstall-context.reg, change this to state that Scoop removes the context menu entry automatically on uninstall.Proposed wording
📝 Committable suggestion
🤖 Prompt for AI Agents