Include profile names for commands in the Command Palette that have a profile index #9747

Open
opened 2026-01-31 02:02:50 +00:00 by claunia · 6 comments
Owner

Originally created by @douglaswth on GitHub (Jul 22, 2020).

Description of the new feature/enhancement

Trying out the new Command Palette in Windows Terminal Preview, I noticed that it only shows the zero-based index numbers for profiles (even more than you have if you have less than 9); however, I think it might be useful to see the names of the profiles that those commands map to and even be able to search for them by profile name.
image

Perhaps it would also be helpful to not show profile indexes beyond the number that you actually have and, also, have the ability to perform actions with profiles outside the first 9 via the Command Palette if that isn't available already.

Originally created by @douglaswth on GitHub (Jul 22, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> Trying out the new Command Palette in Windows Terminal Preview, I noticed that it only shows the zero-based index numbers for profiles (even more than you have if you have less than 9); however, I think it might be useful to see the names of the profiles that those commands map to and even be able to search for them by profile name. ![image](https://user-images.githubusercontent.com/77890/88215269-3fca7f80-cc10-11ea-887d-d9e5fefc9f6c.png) Perhaps it would also be helpful to not show profile indexes beyond the number that you actually have and, also, have the ability to perform actions with profiles outside the first 9 via the Command Palette if that isn't available already.
Author
Owner

@zadjii-msft commented on GitHub (Jul 22, 2020):

So this will be more correctly resolved by #6856. Right now, we've only got commands for "open a tab with the Nth profile" in the actions in defaults.json. Once #6856 merges, we'll add actions for "open a tab with the profile with name {name}", which will be more like what you're looking for.

Stay tuned!

@zadjii-msft commented on GitHub (Jul 22, 2020): So this will be more correctly resolved by #6856. Right now, we've only got commands for "open a tab with the Nth profile" in the `actions` in `defaults.json`. Once #6856 merges, we'll add actions for "open a tab with the profile with name {name}", which will be more like what you're looking for. Stay tuned!
Author
Owner

@DHowett commented on GitHub (Jul 27, 2020):

We will, however, need to do something about these indexed ones and how they show up in search results. I'm not in love with commands bound to spatial ordering outside of the keybindings, but... we are trying to make all commands show up in the palette and we need a reasonable way to display them.

I'm going to tentatively mark this one up for 2.0, but we need to figure out what it means for commands to have sidecar data.

Split pane with profile has a sidecar Profile, new tab with index has a sidecar Profile, but switch to tab has a sidecar Tab (!)... and we may want to display them in a similar way.

Command label: Split pane, profile index: 0
Fine print:    [ICO] PowerShell
Command label: Switch to tab, index: 9
Fine print:    [ICO] Command Prompt, +3 more panes
@DHowett commented on GitHub (Jul 27, 2020): We _will_, however, need to do something about these indexed ones and how they show up in search results. I'm not in love with commands bound to spatial ordering outside of the keybindings, but... we _are_ trying to make all commands show up in the palette and we need a reasonable way to display them. I'm going to tentatively mark this one up for 2.0, but we need to figure out what it means for commands to have sidecar data. Split pane with profile has a sidecar Profile, new tab with index has a sidecar Profile, but _switch to tab_ has a sidecar Tab (!)... and we may want to display them in a similar way. ``` Command label: Split pane, profile index: 0 Fine print: [ICO] PowerShell ``` ``` Command label: Switch to tab, index: 9 Fine print: [ICO] Command Prompt, +3 more panes ```
Author
Owner

@phil-blain commented on GitHub (Feb 15, 2022):

This would be a really nice addition !

In the meantime, I followed the example at https://docs.microsoft.com/en-us/windows/terminal/command-palette#iterable-commands and it works, though it does not put all profiles (shown by their names) into the list of available commands in the command palette. I have to:

  1. Open the command palette and type the name of my iterable command
  2. Press Enter
  3. The iterable command opens and I can type the profile name
  4. Press Enter to open a new tab with this profile.

Is there any way to make all commands in the iterable list directly show up in the command palette (without having to "open" the iterable command first ?)

@phil-blain commented on GitHub (Feb 15, 2022): This would be a really nice addition ! In the meantime, I followed the example at https://docs.microsoft.com/en-us/windows/terminal/command-palette#iterable-commands and it works, though it does not put all profiles (shown by their names) into the list of available commands in the command palette. I have to: 1. Open the command palette and type the name of my iterable command 2. Press Enter 3. The iterable command opens and I can type the profile name 4. Press Enter to open a new tab with this profile. Is there any way to make all commands in the iterable list directly show up in the command palette (without having to "open" the iterable command first ?)
Author
Owner

@zadjii-msft commented on GitHub (Feb 15, 2022):

You might want to try:

{
	"actions": [
        ...,
	    {
	        "iterateOn": "profiles",
	        "icon": "${profile.icon}",
	        "name": "${profile.name}",
	        "command": { "action": "newTab", "profile": "${profile.name}" }
	    }
	]
}

That should create an action that'll expand directly in the root of the command palette, rather than nested inside another action.

@zadjii-msft commented on GitHub (Feb 15, 2022): You might want to try: ```jsonc { "actions": [ ..., { "iterateOn": "profiles", "icon": "${profile.icon}", "name": "${profile.name}", "command": { "action": "newTab", "profile": "${profile.name}" } } ] } ``` That should create an action that'll expand directly in the root of the command palette, rather than nested inside another action.
Author
Owner

@phil-blain commented on GitHub (Feb 15, 2022):

@zadjii-msft you definitely made my day !! :D This indeed works great.

On to my next task then, creating a script that creates a JSON fragment to create a profile for every host that is listed in my ~/.ssh/config !

By the way I did not think of trying the syntax you showed. Would you accept a contribution to the docs to make that clearer ?

@phil-blain commented on GitHub (Feb 15, 2022): @zadjii-msft you _definitely_ made my day !! :D This indeed works great. On to my next task then, creating a script that creates a [JSON fragment](https://docs.microsoft.com/en-us/windows/terminal/json-fragment-extensions#applications-installed-from-the-web) to create a profile for every host that is listed in my `~/.ssh/config` ! By the way I did not think of trying the syntax you showed. Would you accept a contribution to the docs to make that clearer ?
Author
Owner

@zadjii-msft commented on GitHub (Feb 15, 2022):

Would you accept a contribution to the docs to make that clearer ?

ALWAYS. I'd probably also accept that script that autogenerates a fragment for your ssh configs as a Tips & Tricks doc too 😉

@zadjii-msft commented on GitHub (Feb 15, 2022): > Would you accept a contribution to the docs to make that clearer ? ALWAYS. I'd probably also accept that script that autogenerates a fragment for your ssh configs as a Tips & Tricks doc too 😉
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9747