Skip to content

Register .sqlplan file association for double-click-to-open (Windows, Linux, macOS)#375

Merged
erikdarlingdata merged 3 commits into
devfrom
feature/sqlplan-file-association
Jun 24, 2026
Merged

Register .sqlplan file association for double-click-to-open (Windows, Linux, macOS)#375
erikdarlingdata merged 3 commits into
devfrom
feature/sqlplan-file-association

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

The .sqlplan document-type registration shipped in v1.14.0 only put an icon on the files — nothing routed a double-click to the app. This adds the actual association so double-clicking a plan opens it in Performance Studio.

The open itself was already handled (argv + named-pipe in Program.Main/MainWindow); the missing piece was telling the OS to route the double-click to us.

FileAssociationService (best-effort, idempotent, never throws into startup)

  • Windows — verified on a real machine: HKCU\Software\Classes ProgId + open command + icon, re-registered each launch so the path tracks Velopack's versioned install dir. Adds itself to OpenWithProgids and only claims the .sqlplan default when it's unowned — never overwrites an existing default (e.g. SSMS). Removed on Velopack uninstall.
  • Linux — a freedesktop .desktop entry + MIME glob under ~/.local/share, refreshing the desktop/MIME databases only when something was written. (Implemented; not runtime-tested — no Linux box here.)
  • macOS — implemented. Launch Services reads CFBundleDocumentTypes from Info.plist; App now subscribes to IActivatableLifetime.Activated (ActivationKind.File) and routes the opened paths through a new MainWindow.OpenFiles. FileActivatedEventArgs is present in 11.3.17 (added in 11.1 — it's just undocumented, which is what misled an earlier API check via the XML doc file). Compiles against 11.3.17; needs a Mac smoke-test to confirm the event fires at runtime, since macOS activation has had historical bugs. If it doesn't fire on 11.3.17, the fallback is a minor, ScottPlot-safe 11.x bump.

Verification

Launched the built app on Windows and confirmed it created SQLPerformanceStudio.sqlplan"…PlanViewer.App.exe" "%1" + icon, added itself to OpenWithProgids, left the pre-existing .sqlplan default untouched, and that the uninstall cleanup restores prior state. Build is clean (no new warnings).

🤖 Generated with Claude Code

erikdarlingdata and others added 2 commits June 24, 2026 17:31
…+ Linux)

The .sqlplan document-type registration in 1.14.0 only put an icon on the files; nothing routed a double-click to the app. Add a best-effort FileAssociationService so the OS launches Performance Studio with the plan path, which the existing argv + named-pipe open path already handles.

Windows: HKCU ProgId + open command + icon, re-registered each launch so the path tracks Velopack's versioned dir; adds itself to OpenWithProgids and only claims the default when .sqlplan is unowned (never overwrites e.g. SSMS); removed on Velopack uninstall. Linux: freedesktop .desktop + MIME glob under ~/.local/share, databases refreshed only when written. macOS: no-op (Launch Services reads Info.plist); loading the opened plan additionally needs Avalonia's FileActivatedEventArgs, absent in 11.3.17.

Verified the Windows registry structure end-to-end on a real machine: ProgId + open command created, existing default preserved, cleanup restores state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rgs)

macOS delivers a double-clicked .sqlplan via IActivatableLifetime.Activated (ActivationKind.File), not argv. Subscribe in App and route the opened paths into a new public MainWindow.OpenFiles, which marshals to the UI thread and reuses the existing OpenFileByExtension path.

FileActivatedEventArgs has shipped in Avalonia since 11.1 and IS present in 11.3.17 (it just lacks XML doc comments, so it's absent from the doc file but present in the assembly). Compiles against 11.3.17; the event actually firing on macOS at runtime needs a Mac smoke-test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata changed the title Register .sqlplan file association for double-click-to-open (Windows + Linux) Register .sqlplan file association for double-click-to-open (Windows, Linux, macOS) Jun 24, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 0e4fa84 into dev Jun 24, 2026
2 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/sqlplan-file-association branch June 24, 2026 21:46
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.

1 participant