react-command-palette icon indicating copy to clipboard operation
react-command-palette copied to clipboard

Allow the command palette to accept parameters for commands.

Open dogfootruler-kr opened this issue 2 years ago • 4 comments

Describe the solution you'd like I would like to be able to pass parameters to a command after pressing enter. (e,g: "Go to product #" -> press enter -> enter id -> execute command with the param)

Additional context VSCode command palette lets you enter parameters to command after selecting it, and I would love to have something similar in this library.

Thank you very much for your hard work!

dogfootruler-kr avatar Oct 28 '21 02:10 dogfootruler-kr

I like the idea. It may take a while before I get to it, but PRs are very welcome.

asabaylus avatar Oct 28 '21 04:10 asabaylus

@dogfootruler-kr can you list the VScode command palette commands that let a user enter parameters to it after selection, looking for some inspiration

debaghtk avatar Nov 16 '21 14:11 debaghtk

Hey @wallydrag ,

you can check Go to line or Go to file for example.

I had no time to start anything yet so feel free to propose a PR!

dogfootruler-kr avatar Nov 17 '21 05:11 dogfootruler-kr

Hi I hope it's ok to continue conversation on this old thread. I was also looking at commands and how VSCode does this.

you can check Go to line or Go to file for example.

I think it's important to note that the vscode palette works in a particular way. If you select "Go to line..." note that it really just puts a : into the palette for you. So you can also pull up the palette and just type a : to switch to "Go to line" mode. And if you backspace that character the palette reverts to the default of "Go to file".

Similar with the command mode (just a > in the box), the symbol find mode (just @ in the box). In vscode the current mode is decided by the prefix of the current input (some are characters, others are strings like task )

This mode could be implemented by having the palette change out all of the options based on the first character. If the first character is : then just provide one option that informs about the current mode:

image

I think this differs a lot from the parameter modes I've seen elsewhere, where you essentially get given a new empty palette after 'activating' a command, and the command can continue prompting for additional parameters after the submission of the previous parameter.

danopia avatar Mar 30 '23 15:03 danopia