Show a validation warning when someone sets a setColorScheme action with an invalid scheme #10068

Closed
opened 2026-01-31 02:11:38 +00:00 by claunia · 3 comments
Owner

Originally created by @zadjii-msft on GitHub (Aug 7, 2020).

Follow up from #6993.

Basically the title.

We'll have to scan the tree of actions manually for all the "set color scheme" actions, and ensure each of them has a valid scheme. We can't do this during the parsing of the arg itself, we'll have to do this manually in the Validate phase

Originally created by @zadjii-msft on GitHub (Aug 7, 2020). Follow up from #6993. Basically the title. We'll have to scan the tree of actions manually for all the "set color scheme" actions, and ensure each of them has a valid scheme. We can't do this during the parsing of the arg itself, we'll have to do this manually in the Validate phase
Author
Owner

@mpela81 commented on GitHub (Oct 30, 2020):

Some random thoughts while checking this:

  • iterate over all commands in the settings, if at least one "set color scheme" action refers to an unknown scheme, raise the warning
  • check for nested commands as well
  • noticed that the global commands list includes this non-expanded command from default json:
{
    // Select color scheme...
    "name": { "key": "SetColorSchemeParentCommandName" },
    "commands": [
        {
            "iterateOn": "schemes",
            "name": "${scheme.name}",
            "command": { "action": "setColorScheme", "colorScheme": "${scheme.name}" }
        }
    ]
}

What could be a good way to skip validating these? 🤔

@mpela81 commented on GitHub (Oct 30, 2020): Some random thoughts while checking this: - iterate over all commands in the settings, if at least one "set color scheme" action refers to an unknown scheme, raise the warning - check for nested commands as well - noticed that the global commands list includes this non-expanded command from default json: ``` { // Select color scheme... "name": { "key": "SetColorSchemeParentCommandName" }, "commands": [ { "iterateOn": "schemes", "name": "${scheme.name}", "command": { "action": "setColorScheme", "colorScheme": "${scheme.name}" } } ] } ``` What could be a good way to skip validating these? 🤔
Author
Owner

@zadjii-msft commented on GitHub (Oct 30, 2020):

You could probably ignore any commands with "iterateOn": "schemes", at least for now. That's going to create one action for each color scheme, so you could reasonably assume that the provided colorScheme (which will be expanded out once we know what the set of schemes is) will be valid.

@zadjii-msft commented on GitHub (Oct 30, 2020): You could probably ignore any commands with `"iterateOn": "schemes"`, at least for now. That's going to create one action for each color scheme, so you could reasonably assume that the provided colorScheme (which will be expanded out once we know what the set of schemes is) will be valid.
Author
Owner

@ghost commented on GitHub (Jan 28, 2021):

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

Handy links:

@ghost commented on GitHub (Jan 28, 2021): :tada:This issue was addressed in #8147, which has now been successfully released as `Windows Terminal Preview v1.6.10272.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.6.10272.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10068