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

Add nested commands to the Command Palette #3994

Closed
zadjii-msft opened this issue Dec 17, 2019 · 8 comments · Fixed by #6856
Closed

Add nested commands to the Command Palette #3994

zadjii-msft opened this issue Dec 17, 2019 · 8 comments · Fixed by #6856
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Milestone

Comments

@zadjii-msft
Copy link
Member

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.

@zadjii-msft zadjii-msft added Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. labels Dec 17, 2019
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Dec 17, 2019
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Dec 17, 2019
@zadjii-msft zadjii-msft added the Area-Settings Issues related to settings and customizability, for console or terminal label Dec 17, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Dec 17, 2019
@zadjii-msft zadjii-msft changed the title Add nested commads to the Command Palette Add nested commands to the Command Palette Dec 17, 2019
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Dec 19, 2019
@cryptworks
Copy link

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.

@ghost ghost added the In-PR This issue has a related PR label Jul 9, 2020
@ghost ghost closed this as completed in #6856 Aug 13, 2020
@ghost ghost removed the In-PR This issue has a related PR label Aug 13, 2020
ghost pushed a commit that referenced this issue Aug 13, 2020
## 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
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Aug 13, 2020
@giggio
Copy link

giggio commented Aug 17, 2020

@zadjii-msft How do we add those nested commands? Is there a commands.json or something like that? I couldn't find it. Or is it on the settings file? If it is, I couldn't find it on schema.

Or is it not supposed to be user customizable?

@zadjii-msft
Copy link
Member Author

@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 keybindings, and that should work.

@giggio
Copy link

giggio commented Aug 17, 2020

Perfect, it works! I was not sure where to put it. There should be an issue to update the schema.

@zadjii-msft
Copy link
Member Author

@giggio I'm purposely not updating the docs until we feel it's ready for general adoption 😉

The docs will probably be updated as a part of #7174

@giggio
Copy link

giggio commented Aug 17, 2020

@zadjii-msft
Copy link
Member Author

Sorry, in my head, the schema is part of the docs. I get how that's confusing 😛

@ghost
Copy link

ghost commented Aug 26, 2020

🎉This issue was addressed in #6856, which has now been successfully released as Windows Terminal Preview v1.3.2382.0.:tada:

Handy links:

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants