-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add nested commands to the Command Palette #3994
Comments
I would +1 to this. Recently working with the terminal profiles.json I was having fun with calling directly to the native windows SSH "ssh.exe user@addr" as its own profile. The ability to make a manuitem to call to a separate config as its own menu entry would be tremendous. Even supporting a nested entry of ssh x@x calls with a singular master config entry would be great. |
## Summary of the Pull Request This PR adds support for both _nested_ and _iterable_ commands in the Command palette. ![nested-commands-000](https://user-images.githubusercontent.com/18356694/87072916-2d991c00-c1e2-11ea-8917-a70e8b8b9803.gif) * **Nested commands**: These are commands that include additional sub-commands. When the user selects on of these, the palette will update to only show the nested commands. * **Iterable commands**: These are commands what allow the user to define only a single command, which is repeated once for every profile. (in the future, also repeated for color schemes, themes, etc.) The above gif uses the following json: ```json { "name": "Split Pane...", "commands": [ { "iterateOn": "profiles", "name": "Split with ${profile.name}...", "commands": [ { "command": { "action": "splitPane", "profile": "${profile.name}", "split": "automatic" } }, { "command": { "action": "splitPane", "profile": "${profile.name}", "split": "vertical" } }, { "command": { "action": "splitPane", "profile": "${profile.name}", "split": "horizontal" } } ] } ] }, ``` ## References ## PR Checklist * [x] Closes #3994 * [x] I work here * [x] Tests added/passed * [ ] Requires documentation to be updated - Sure does, but we'll finish polishing this first. ## Detailed Description of the Pull Request / Additional comments We've now gotta keep the original json for a command around, so that once we know what all the profiles will be, we can expand the commands that need it. We've also got to parse commands recursively, because they might have any number of child commands. These together made the command parsing a _lot_ more complicated, but it feels good so far. ## Validation Steps Performed * wrote a bunch of tests * Played with it a bunch
@zadjii-msft How do we add those nested commands? Is there a Or is it not supposed to be user customizable? |
@giggio If you're using a build that includes #6856, you can do something like the following: {
"name": "Split Pane...",
"commands": [
{
"iterateOn": "profiles",
"name": "Split with ${profile.name}...",
"commands": [
{ "command": { "action": "splitPane", "profile": "${profile.name}", "split": "auto" } },
{ "command": { "action": "splitPane", "profile": "${profile.name}", "split": "vertical" } },
{ "command": { "action": "splitPane", "profile": "${profile.name}", "split": "horizontal" } }
]
}
]
}, Just throw that into your |
Perfect, it works! I was not sure where to put it. There should be an issue to update the schema. |
Not the docs, the schema: https://github.com/microsoft/terminal/blob/master/doc/cascadia/profiles.schema.json |
Sorry, in my head, the schema is part of the docs. I get how that's confusing 😛 |
🎉This issue was addressed in #6856, which has now been successfully released as Handy links: |
The initial design of the command palette only covers singular commands, but includes a follow-up to support nesting commands. This way, all the commands don't appear in the menu straight away. Instead, the user must first select the parent command, to be given the sub-list.
We should support this.
The text was updated successfully, but these errors were encountered: