Skip to content

fix(desktop): resolve JetBrains IDE edition-specific app names#1315

Closed
de1mat wants to merge 1 commit into
superset-sh:mainfrom
de1mat:fix/jetbrains-edition-names
Closed

fix(desktop): resolve JetBrains IDE edition-specific app names#1315
de1mat wants to merge 1 commit into
superset-sh:mainfrom
de1mat:fix/jetbrains-edition-names

Conversation

@de1mat
Copy link
Copy Markdown
Contributor

@de1mat de1mat commented Feb 8, 2026

Description

JetBrains IDEs with multiple editions (IntelliJ IDEA, PyCharm) have edition-specific macOS app names that vary by install method. The hardcoded single name never matches, causing "Open in" to fail.

This adds a candidate-based resolution: APP_NAMES supports arrays of names tried in order, falling back only on "app not found" errors. Other errors (bad path, permissions) are thrown immediately.

Related Issues

Fixes #1314

Type of Change

  • Bug fix

Testing

  • Updated unit tests for getAppCommand and new getAppCandidates function (103 tests pass)
  • Typecheck passes
  • Manually verified: "Open in IntelliJ IDEA" successfully opens IntelliJ IDEA Ultimate on macOS

Summary by CodeRabbit

  • New Features

    • Added support for multiple application editions when opening files in external IDEs (e.g., different IntelliJ IDEA and PyCharm versions).
  • Bug Fixes

    • Improved error handling and fallback behavior when opening files in external applications; system default launcher is used if preferred app is unavailable.

JetBrains IDEs with multiple editions (IntelliJ IDEA, PyCharm) have
edition-specific macOS app names that vary by install method. The
hardcoded single name never matches, causing "Open in" to fail.

- APP_NAMES now supports arrays of candidate names tried in order
- Add getAppCandidates() returning all candidates for an app
- openPathInApp retries only on "app not found", re-throws other errors
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 8, 2026

📝 Walkthrough

Walkthrough

This pull request refactors the external app launching mechanism to handle multiple edition variants of JetBrains IDEs. It introduces a new getAppCandidates function that generates candidate commands for all available app editions, iterates through them on invocation, and falls back to the system shell if no candidates match.

Changes

Cohort / File(s) Summary
App Candidates Helper
apps/desktop/src/lib/trpc/routers/external/helpers.ts
Expanded APP_NAMES type to accept string arrays; introduced getAppCandidates function returning multiple edition-variant commands; modified getAppCommand to select the first candidate; updated IntelliJ and PyCharm entries to arrays of edition names.
Helper Tests
apps/desktop/src/lib/trpc/routers/external/helpers.test.ts
Updated getAppCommand test expectations to validate edition-variant selection; added comprehensive test suite for getAppCandidates covering empty results, single candidates, and multi-edition scenarios.
External Router
apps/desktop/src/lib/trpc/routers/external/index.ts
Switched from single-command invocation to multi-candidate iteration; added logic to attempt each candidate and continue on "app not found" errors; rethrows other errors and falls back to system shell if no candidates exist.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Editions multiplied, no more despair,
IntelliJ and PyCharm now find their lair,
From Ultimate to CE, we try them all,
Candidate by candidate, answering the call,
JetBrains IDEs hop into view!

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing JetBrains IDE edition-specific app name resolution on macOS, which is the primary objective of the PR.
Description check ✅ Passed The description follows the template structure with clear sections for Description, Related Issues, Type of Change, and Testing. It explains the problem, solution, and verification steps comprehensively.
Linked Issues check ✅ Passed The PR fully addresses the requirements from issue #1314: supports multiple candidate app names for JetBrains IDEs, implements candidate-based fallback, and distinguishes between retriable (app not found) and fatal errors.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the JetBrains IDE edition-specific name resolution issue. No extraneous modifications to unrelated functionality were detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
apps/desktop/src/lib/trpc/routers/external/index.ts (2)

26-51: Candidate fallback logic looks correct overall.

The iteration through candidates with retry-on-"app not found" and immediate rethrow for other errors is clean and well-structured.

One concern: the "unable to find application" substring match on Line 42 is coupled to the exact wording of macOS's open command stderr. If Apple ever changes this message (or localizes it on non-English systems), the retry logic would break silently — every error would rethrow on the first candidate instead of trying alternatives.

Consider also matching on the exit code or a broader pattern (e.g., checking for the app name in the error message) to make this more resilient. At minimum, a comment noting this assumption would help future maintainers.


80-96: openInApp mutation: DB write error is unhandled.

The synchronous localDb.insert(...).run() on Lines 88–95 is not wrapped in a try/catch. If the DB write fails (e.g., disk full, schema mismatch), the error propagates as an untyped exception rather than a meaningful TRPCError. This contrasts with the openUrl procedure which wraps its logic in try/catch.

For consistency and better error reporting, consider wrapping the DB call similarly.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@de1mat
Copy link
Copy Markdown
Contributor Author

de1mat commented Feb 8, 2026

Superseded by #1317 which uses bundle IDs instead of app name candidates - a more robust approach.

@de1mat de1mat closed this Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] "Open in" fails for JetBrains IDEs with edition-specific names (IntelliJ, PyCharm)

1 participant