Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the command palette to accept parameters for commands. #909

Open
dogfootruler-kr opened this issue Oct 28, 2021 · 4 comments
Open

Comments

@dogfootruler-kr
Copy link

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!

@asabaylus
Copy link
Owner

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

@debaghtk
Copy link

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

@dogfootruler-kr
Copy link
Author

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!

@danopia
Copy link

danopia commented Mar 30, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants