feat(open-in): add Android Studio Canary support#1989
Conversation
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR adds Android Studio Canary as a new "Open In" app entry, using a new
Confidence Score: 3/5Safe to merge for macOS users, but Windows and Linux users with stable Android Studio installed will see Canary falsely reported as available and may launch the wrong app. The macOS implementation is solid. On Windows, identical checkCommands to stable Android Studio mean the Canary entry appears for every stable-AS user and clicking it opens the wrong app. On Linux, the studio fallback in checkCommands has the same problem. Both are present defects on live user machines. src/shared/openInApps.ts — specifically the win32 and linux platform blocks for android-studio-canary
|
| Filename | Overview |
|---|---|
| src/shared/openInApps.ts | Adds the android-studio-canary app config and mdfindQuery field to PlatformConfig. macOS detection is solid; Win32 checkCommands are identical to stable Android Studio (false-positive detection); Linux studio fallback in checkCommands also produces false positives. |
| src/main/core/app/utils.ts | Adds checkMacMdfindQuery helper using execFile('mdfind', [query]). Logic is correct for passing a compound query expression. Missing a timeout option, unlike similar helpers in the same file. |
| src/main/core/app/service.ts | Adds the mdfindQuery availability check as a new branch in checkInstalledApps, gated on platform === 'darwin'. Logic is correct and consistent with existing detection branches. |
| src/assets/images/android-studio-canary.svg | New SVG icon asset for Android Studio Canary. Well-formed; missing a trailing newline (minor). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[checkInstalledApps] --> B{bundleIds?}
B -- yes --> C[checkMacApp per bundleId]
C --> D{found?}
D -- yes --> AVAIL[isAvailable = true]
D -- no --> E{appNames?}
B -- no --> E
E -- yes --> F[checkMacAppByName per name]
F --> G{found?}
G -- yes --> AVAIL
G -- no --> H{checkCommands?}
E -- no --> H
H -- yes --> I[checkCommand per cmd]
I --> J{found?}
J -- yes --> AVAIL
J -- no --> K{mdfindQuery AND darwin?}
H -- no --> K
K -- yes --> L[checkMacMdfindQuery]
L --> M{results?}
M -- yes --> AVAIL
M -- no --> UNAVAIL[isAvailable = false]
K -- no --> UNAVAIL
AVAIL --> N[availability record]
UNAVAIL --> N
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
src/shared/openInApps.ts:460-463
**Win32 Canary detection is identical to stable Android Studio**
The `checkCommands` for `android-studio-canary` on Win32 (`studio64`, `studio`) are identical to the stable `android-studio` entry. Because `hideIfUnavailable: true` only hides the app when the commands are *not* found, any machine with stable Android Studio installed will show the Canary entry as available. Clicking it will then open stable instead of Canary, since both entries point to the same executable on PATH. There is no way to distinguish the two on Windows with this approach.
### Issue 2 of 3
src/shared/openInApps.ts:464-468
**Linux `studio` fallback causes false-positive detection of Canary**
`checkCommands: ['studio-preview', 'studio']` means that on a machine where only stable Android Studio (`studio`) is on PATH — with no `studio-preview` — Canary is still reported as available. When the user clicks it, `studio-preview {{path}}` fails silently, then `studio {{path}}` runs, opening stable Android Studio instead of Canary. Consider removing `'studio'` from `checkCommands` (keeping only `'studio-preview'`) so the entry is hidden unless the Canary-specific binary is actually present.
### Issue 3 of 3
src/main/core/app/utils.ts:188-193
**Missing timeout on `mdfind` invocation**
`checkMacMdfindQuery` passes no `timeout` option to `execFile`, so a slow or unresponsive Spotlight daemon could hang indefinitely. Every other `execFile`/`exec` call in this file (e.g., `execFileCommand`) defaults to 30 s. Consider adding `{ timeout: 30_000, env: buildExternalToolEnv() }` for consistency.
Reviews (1): Last reviewed commit: "feat(open-in): add Android Studio Canary..." | Re-trigger Greptile
| win32: { | ||
| openCommands: ['studio64 {{path}}', 'studio {{path}}'], | ||
| checkCommands: ['studio64', 'studio'], | ||
| }, |
There was a problem hiding this comment.
Win32 Canary detection is identical to stable Android Studio
The checkCommands for android-studio-canary on Win32 (studio64, studio) are identical to the stable android-studio entry. Because hideIfUnavailable: true only hides the app when the commands are not found, any machine with stable Android Studio installed will show the Canary entry as available. Clicking it will then open stable instead of Canary, since both entries point to the same executable on PATH. There is no way to distinguish the two on Windows with this approach.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/shared/openInApps.ts
Line: 460-463
Comment:
**Win32 Canary detection is identical to stable Android Studio**
The `checkCommands` for `android-studio-canary` on Win32 (`studio64`, `studio`) are identical to the stable `android-studio` entry. Because `hideIfUnavailable: true` only hides the app when the commands are *not* found, any machine with stable Android Studio installed will show the Canary entry as available. Clicking it will then open stable instead of Canary, since both entries point to the same executable on PATH. There is no way to distinguish the two on Windows with this approach.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Fixed in 60012bc — removed studio64/studio from checkCommands and openCommands for Win32. The entry now uses only studio-preview, so it stays hidden unless a Canary-specific launcher is on PATH.
| linux: { | ||
| openCommands: ['studio-preview {{path}}', 'studio {{path}}'], | ||
| checkCommands: ['studio-preview', 'studio'], | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Linux
studio fallback causes false-positive detection of Canary
checkCommands: ['studio-preview', 'studio'] means that on a machine where only stable Android Studio (studio) is on PATH — with no studio-preview — Canary is still reported as available. When the user clicks it, studio-preview {{path}} fails silently, then studio {{path}} runs, opening stable Android Studio instead of Canary. Consider removing 'studio' from checkCommands (keeping only 'studio-preview') so the entry is hidden unless the Canary-specific binary is actually present.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/shared/openInApps.ts
Line: 464-468
Comment:
**Linux `studio` fallback causes false-positive detection of Canary**
`checkCommands: ['studio-preview', 'studio']` means that on a machine where only stable Android Studio (`studio`) is on PATH — with no `studio-preview` — Canary is still reported as available. When the user clicks it, `studio-preview {{path}}` fails silently, then `studio {{path}}` runs, opening stable Android Studio instead of Canary. Consider removing `'studio'` from `checkCommands` (keeping only `'studio-preview'`) so the entry is hidden unless the Canary-specific binary is actually present.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Fixed in 60012bc — removed the studio fallback from both checkCommands and openCommands for Linux. Only studio-preview remains, so stable-only machines won't show the Canary entry.
| export const checkMacMdfindQuery = (query: string): Promise<boolean> => | ||
| new Promise((resolve) => { | ||
| execFile('mdfind', [query], { env: buildExternalToolEnv() }, (error, stdout) => { | ||
| resolve(!error && stdout.trim().length > 0); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Missing timeout on
mdfind invocation
checkMacMdfindQuery passes no timeout option to execFile, so a slow or unresponsive Spotlight daemon could hang indefinitely. Every other execFile/exec call in this file (e.g., execFileCommand) defaults to 30 s. Consider adding { timeout: 30_000, env: buildExternalToolEnv() } for consistency.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/main/core/app/utils.ts
Line: 188-193
Comment:
**Missing timeout on `mdfind` invocation**
`checkMacMdfindQuery` passes no `timeout` option to `execFile`, so a slow or unresponsive Spotlight daemon could hang indefinitely. Every other `execFile`/`exec` call in this file (e.g., `execFileCommand`) defaults to 30 s. Consider adding `{ timeout: 30_000, env: buildExternalToolEnv() }` for consistency.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Fixed in 60012bc — added { timeout: 30_000, env: buildExternalToolEnv() } to the execFile call in checkMacMdfindQuery, matching execFileCommand's 30 s default.
- Remove studio64/studio fallback on Win32 — identical to stable AS, would falsely report Canary as installed and open the wrong app on click - Remove studio fallback on Linux for the same reason; keep studio-preview only - Add 30 s timeout to checkMacMdfindQuery for parity with other utils helpers Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Hi @sergeym-monday, |
Summary
Contents/bin/studio.svg)open -a), Windows (studio64/studio), and Linux (studio-preview/studio)mdfindQuerytoPlatformConfigand acheckMacMdfindQueryhelper inutils.tsWhy a new detection field?
Stable Android Studio and Canary share the same macOS bundle ID (
com.google.android.studio), and Canary's display name is versioned per release (e.g. Android Studio Otter 3 Feature Drop 2025.2.3 Canary 3), sobundleIdsandappNames(exact match) can't distinguish them. The newmdfindQueryfield accepts a free-form Spotlight query — for Canary this combines bundle ID +kMDItemDisplayName == "*Canary*"cd— which reliably detects any Canary build regardless of codename or version suffix. Other JetBrains EAP builds could reuse it later.Test plan
hideIfUnavailable: true) — couldn't test without uninstallingpnpm run format,pnpm run lint,pnpm run typecheck,pnpm run buildall pass