Skip to content

Also autoload on SSMS 22's own UI context - #7

Merged
mourier merged 1 commit into
mainfrom
fix/ssms22-autoload-context
Sep 21, 2026
Merged

mourier merged 1 commit into
mainfrom
fix/ssms22-autoload-context

Conversation

@mourier

@mourier mourier commented Sep 21, 2026

Copy link
Copy Markdown
Owner

On SSMS 22, launching as ssms -S <server> gives you no SQL Pilot at all — no tool window, Ctrl+D does nothing, nothing in the activity log. A plain start works fine, as do SSMS 18 and 20.

Cause

The package autoloads on UIContextGuids80.NoSolution. The VS 2017 shell in SSMS 18/20 raises it at startup, and so does a plain SSMS 22 start, but SSMS 22's -S auto-connect path never does. With SqlPilotCommandSet.vsct compiled by neither csproj, the Ctrl+D hotkey registered during package init is the only way into the extension, so a package that never autoloads is unreachable.

Fix

Register a second autoload trigger on UICONTEXT_SSMS ({B7B07F42-…}), the context SSMS.Application.pkgdef declares for the shell itself. A package loads once regardless of how many of its contexts fire, and SSMS 18/20 simply never raise this one.

Established by installing a per-user probe .vsix whose only content is that one extra AutoLoadPackages entry for the already-registered package: the package loads with it, and does not load with a made-up control context. Then confirmed with the scope feature branch deployed: -S launch → package loads → Object Explorer connects → full index and scope behaviour.

The shipped SqlPilot.Package.pkgdef is hand-maintained (the VSSDK pkgdef target doesn't run in these SDK-style projects), so the entry is added there directly; the [ProvideAutoLoad] attribute mirrors it.

Notes added

Two SSMS 22 command-line traps that hid this for a long time, now in SSMS_INTEGRATION_NOTES.md: -E no longer exists and an unknown switch shows a usage-error dialog titled exactly like the IDE, and -log takes a filename. Plus the probe technique, and that Process.Modules is not a valid "did it load" check.

The package autoloads on UIContextGuids80.NoSolution. SSMS 18/20 raise it at
startup and so does a plain SSMS 22 start, but an "ssms -S <server>" launch of
SSMS 22 never does: that auto-connect path skips the solution contexts. With no
command table compiled in, the Ctrl+D hotkey registered during package init is
the only way into the extension, so on that path it never appeared and nothing
logged an error.

Register a second trigger on UICONTEXT_SSMS, the context SSMS.Application.pkgdef
declares for the shell itself. Established by installing a per-user probe .vsix
that adds only that autoload entry for the already-registered package: the
package loads with it and not with a made-up control context.

The shipped pkgdef is hand-maintained, so it carries the entry directly; the
attribute mirrors it. Notes cover the technique plus the two SSMS 22 command
line traps that hid this: -E no longer exists (an unknown switch shows an error
dialog titled like the IDE), and -log takes a filename.
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 1148057c-5b7d-427d-826f-08d502712bd4

📥 Commits

Reviewing files that changed from the base of the PR and between 348c0be and a227c0a.

📒 Files selected for processing (4)
  • docs/ARCHITECTURE.md
  • docs/SSMS_INTEGRATION_NOTES.md
  • src/SqlPilot.Package/SqlPilot.Package.pkgdef
  • src/SqlPilot.Package/SqlPilotPackage.cs

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.

@mourier
mourier merged commit b63faa1 into main Sep 21, 2026
2 checks passed
@mourier
mourier deleted the fix/ssms22-autoload-context branch September 21, 2026 15:20
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