Skip to content

CmdPal: Add support for commands with parameters #40948

@zadjii

Description

@zadjii

Description of the new feature / enhancement

Commands should be able to specify that they require additional parameters before they can be run.

Prototypes:

A text box for string input
Image

A button that opens a custom picker from the extension
Image

Scenario when this would be used?

This would be an infinitely better "lightweight" parameter passing, rather than force a whole adaptive card for like, one field.

Supporting information

draft spec:

enum ParameterType
{
    Text,
    Enum,
    Custom
};

// interface IArgumentEnumValue requires INotifyPropChanged
// {
//     String Name { get; };
//     IIconInfo Icon { get; };
// }

interface ICommandArgument requires INotifyPropChanged
{
    ParameterType Type { get; };
    String Name { get; };
    Boolean Required{ get; };

    Object Value { get; set; };
    String DisplayName { get; };
    IIconInfo Icon { get; };

    void ShowPicker(UInt64 hostHwnd);
    // todo
    // IArgumentEnumValue[] GetValues();
};

interface IInvokableCommandWithParameters requires ICommand {
    ICommandArgument[] Parameters { get; };
    ICommandResult InvokeWithArgs(Object sender, ICommandArgument[] args);
};

There are however a LOT of considerations here.

  • Should an extension be able to specify where in the Title the parameter lives? So that we show the args inline with the list item, rather than the search bar?
  • Should a page be able to accept parameters, and then be able to use that to filter it's list of commands itself?
  • What do we do about CommandContextItem's? By all accounts, they support ICommands too.
    • And we can't just make this a property on IListItem, because we actually want top-level commands to support these too

Metadata

Metadata

Assignees

Labels

Issue-FeatureA planned feature addition to a productNeeds-SpecSomething needs additional alignment/thought on how we'll implement functionalllyProduct-Command PaletteRefers to the Command Palette utility

Projects

Status

In PR

Relationships

None yet

Development

No branches or pull requests

Issue actions