Add optional detection.packageFamilyName to the extension schema - #170
Open
Adam Duda (AdamDuda1) wants to merge 2 commits into
Open
Add optional detection.packageFamilyName to the extension schema#170Adam Duda (AdamDuda1) wants to merge 2 commits into
detection.packageFamilyName to the extension schema#170Adam Duda (AdamDuda1) wants to merge 2 commits into
Conversation
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.
Problem
Extensions distributed through the Microsoft Store can never show as Installed in the Command Palette gallery, even after the user installs them from the gallery itself.
There are two code paths in CmdPal that set
IsInstalled, and a Store-only extensions reaches none of them:ExtensionGalleryViewModelenumerates installed extensions and matches onPackageFamilyName, but the block never gets executed asPackageFamilyNameis not an allowed field forextension.json:(source: powertoys gh src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Gallery/ExtensionGalleryViewModel.cs:391)
IsInstalledflows fromApplyWinGetPackageInfo, which requires awingetinstall source.At the time of writing, over half of the 82 extensions in the gallery can never display as installed for the user.
Why this is a schema-only fix
The runtime already supports the field, but schema doesn't allow it:
Microsoft.CmdPal.Common/ExtensionGallery/Models/GalleryDetection.csdefinesPackageFamilyName.ExtensionGalleryItemViewModelexposes it viapublic string? PackageFamilyName => _entry.Detection?.PackageFamilyName;doc/extension-gallery.mddocumentsdetection.packageFamilyNameas a supported optional entry field, and notes it "lets the gallery recognise an already-installed packaged extension before WinGet metadata resolves."Because
extension.schema.jsonsetsadditionalProperties: falseand has nodetectionproperty, the CI rejects the field today.Changes
.github/schemas/extension.schema.json- added an optionaldetectionobject with a single requiredpackageFamilyNamestring.extensions/adamduda/tex-snippets/extension.json- added the block to my extension to demonstrate.