Register .sqlplan file association for double-click-to-open (Windows, Linux, macOS)#375
Merged
Merged
Conversation
…+ 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>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
.sqlplandocument-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)HKCU\Software\ClassesProgId +opencommand + icon, re-registered each launch so the path tracks Velopack's versioned install dir. Adds itself toOpenWithProgidsand only claims the.sqlplandefault when it's unowned — never overwrites an existing default (e.g. SSMS). Removed on Velopack uninstall..desktopentry + MIME glob under~/.local/share, refreshing the desktop/MIME databases only when something was written. (Implemented; not runtime-tested — no Linux box here.)CFBundleDocumentTypesfrom Info.plist;Appnow subscribes toIActivatableLifetime.Activated(ActivationKind.File) and routes the opened paths through a newMainWindow.OpenFiles.FileActivatedEventArgsis 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 toOpenWithProgids, left the pre-existing.sqlplandefault untouched, and that the uninstall cleanup restores prior state. Build is clean (no new warnings).🤖 Generated with Claude Code