Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Command Palette provides a full extension model, allowing developers to create their own experiences for the palette.
The fastest way to get started writing extensions is from the Command Palette itself. Just run the "Create a new extension" command, fill out the fields to populate the template project, and you should be ready to start.
For more detailed instructions, you can follow these pages:
- Creating an extension
- Adding commands
- Update a list of commands
- Add top-level commands to your extension
- Command results
- Display markdown content
- Get user input with forms
Extension details
Command Palette defines a WinRT API (Microsoft.CommandPalette.Extensions), which is how extensions can communicate with Command Palette.
Command Palette will use the Package Catalog to find apps that list themselves as an windows.appExtension
for com.microsoft.commandpalette
.
Registering your extension
Extensions can register themselves with the Command Palette using their .appxmanifest
. As an example:
<Extensions>
<com:Extension Category="windows.comServer">
<com:ComServer>
<com:ExeServer Executable="ExtensionName.exe" Arguments="-RegisterProcessAsComServer" DisplayName="Sample Extension">
<com:Class Id="<Extension CLSID Here>" DisplayName="Sample Extension" />
</com:ExeServer>
</com:ComServer>
</com:Extension>
<uap3:Extension Category="windows.appExtension">
<uap3:AppExtension Name="com.microsoft.commandpalette"
Id="YourApplicationUniqueId"
PublicFolder="Public"
DisplayName="Sample Extension"
Description="Sample Extension for Command Palette">
<uap3:Properties>
<CmdPalProvider>
<Activation>
<CreateInstance ClassId="<Extension CLSID Here>" />
</Activation>
<SupportedInterfaces>
<Commands />
</SupportedInterfaces>
</CmdPalProvider>
</uap3:Properties>
</uap3:AppExtension>
</uap3:Extension>
</Extensions>
In this manifest, we're using an out-of-process COM server to act as the communication layer between your app and Command Palette. Don't worry about this! The template project will take care of creating a COM server for you, starting it, and marshalling your objects to Command Palette.
Important notes
Some notable elements about the manifest example:
- The application must specify a
Extensions.uap3Extension.AppExtension
with the Name set tocom.microsoft.commandpalette
. This is the unique identifier which Command Palette uses to find it's extensions. - The application must specify a
Extensions.comExtension.ComServer
to host their COM class. This allows for the OS to register that GUID as a COM class we can instantiate.- Make sure that this CLSID is unique, and matches the one in your application. If you change one, you need to change all three.
- In the
Properties
of yourAppExtension
, you must specify aCmdPalProvider
element. This is where you specify the CLSID of the COM class that Command Palette will instantiate to interact with your extension.- Currently, only
Commands
is supported.
- Currently, only
Related content
Windows developer