-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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 profiles.json schema to doc folder #2704
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think any of these comments rise above the level of "nit"
doc/cascadia/profiles.schema.json
Outdated
"definitions": { | ||
"Color": { | ||
"default": "#", | ||
"pattern": "^#[A-Fa-f0-9]{6}$", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can actually be a #rgb
color now as well
doc/cascadia/profiles.schema.json
Outdated
"pattern": "^#[A-Fa-f0-9]{6}$", | ||
"type": "string" | ||
}, | ||
"ProfileKey": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ProfileKey": { | |
"ProfileGuid": { |
maybe?
"type": "string" | ||
}, | ||
"ProfileKey": { | ||
"default": "{}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not totally sure this is true, but I'm not sure what a better way to put this would be
doc/cascadia/profiles.schema.json
Outdated
"keys": { | ||
"description": "Defines the key combinations used to call the command.", | ||
"items": { | ||
"pattern": "^(ctrl\\+|alt\\+|shift\\+){0,3}([0-9a-zA-Z]|backspace|tab|enter|esc|space|pgup|pgdn|end|home|left|up|right|down|insert|delete|numpad_([0-9]|multiply|plus|minus|period|divide)|f[1-9]|f1[0-9]|f2[0-4]|plus|,|-|\\.)$", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
holy regular expression batman
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am extremely alarmed about this pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, this pattern is hyper-specific (backspace, tab, enter, etc.), but it misses out on all the extended keys like {}[]_+-=|\\
also, this pattern allows ctrl+ctrl+ctrl+c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I can help with this one @cinnamon_msft - Question - should we force the use of at least one modifier through regex? Else we're letting people redefine things like Enter, for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
people actually want enter, now that a failed keybinding dispatch can pass through. As a binding for copy
, it'll copy if there's a selection or send a CR if there isn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want me to alter the logic, let me know. Regex101 is an excellent tool and will explain how the expression works, but it does take a certain twisted effort to comprehend, and for many people regex is a write-only exercise so if it's hurting everyone's brains, that's okay with me lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put out a Twitter challenge to improve it: https://twitter.com/oising/status/1172226517331525632 -- maybe we can make it even less readable / compact
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oising I'm glad to see another regex lover is around 😁. I've just been caught up with how to make CTRL+
, ALT+
, and SHIFT+
not repeat (as Dustin aluded to the CTRL+CTRL+CTRL+C
issue above).
At least we only need to solve this problem once, so as ugly as it gets, we'll never have to touch it again 🤞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's only really possible with lookbehind assertions (to prevent dupes), and it's also lucky we're using javascript since PCRE only supports fixed width assertions, though .NET added lookbehind assertions specifically. I don't know if it support backreferences though. Another thing to think about was possibly using subroutines (to possibly add some feel-good DRY), but man, I only had 20 minutes :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So yeah, just for information, a subroutine call lets you "call" a previous capture group from later in the expression, but in the later context. It's not supported in javascript it seems, but if it was, we could remove the second and third modifier capture group, and just refer to the first one by its index with (?2)
:
^(?<modifier>(ctrl|alt|shift)\+?((?2)(?<!\2)\+?)?((?2)(?<!\2|\4))?\+?)?(?<key>\w+?)?(?<=\w)$
doc/cascadia/profiles.schema.json
Outdated
"description": "Sets the background color of the profile. Overrides background set in color scheme if colorscheme is set. Uses hex color format: \"#rrggbb\". Default \"#000000\" (black)." | ||
}, | ||
"backgroundImage": { | ||
"description": "(Not in SettingsSchema.md)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo?
doc/cascadia/profiles.schema.json
Outdated
}, | ||
"colorScheme": { | ||
"default": "Campbell", | ||
"description": "Name of the terminal color scheme to use. Color schemes are defined under schemes.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "Name of the terminal color scheme to use. Color schemes are defined under schemes.", | |
"description": "Name of the terminal color scheme to use. Color schemes are defined under \"schemes\".", |
doc/cascadia/profiles.schema.json
Outdated
"type": "string" | ||
}, | ||
"connectionType": { | ||
"$ref": "#/definitions/ProfileKey", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh maybe this should just be Guid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes we need a separate guid type
doc/cascadia/profiles.schema.json
Outdated
}, | ||
"connectionType": { | ||
"$ref": "#/definitions/ProfileKey", | ||
"default": "{d9fcfdfa-a479-412c-83b7-c5640e61cd62}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this not have a default, as I'm pretty sure the default is the null guid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ABSOLUTELY NOT
doc/cascadia/profiles.schema.json
Outdated
{ | ||
"$id": "https://github.com/microsoft/terminal/terminal.profile.schema.json", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Microsoft Terminal Profile Settings", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be "Microsoft's Windows Terminal Settings Profile Schema" or similar?
doc/cascadia/profiles.schema.json
Outdated
@@ -0,0 +1,449 @@ | |||
{ | |||
"$id": "https://github.com/microsoft/terminal/terminal.profile.schema.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what the $id
is supposed to represent, but this is not a valid URL
"title": "Microsoft Terminal Profile Settings", | ||
"definitions": { | ||
"Color": { | ||
"default": "#", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does #
mean as a default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When editing the profiles.json, it'll auto-fill the "#" for the color code
doc/cascadia/profiles.schema.json
Outdated
"properties": { | ||
"globals": { | ||
"additionalProperties": false, | ||
"description": "Properties affect the entire window, regardless of the profile settings.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"description": "Properties affect the entire window, regardless of the profile settings.", | |
"description": "Properties that affect the entire window, regardless of the profile settings.", |
doc/cascadia/profiles.schema.json
Outdated
"properties": { | ||
"alwaysShowTabs": { | ||
"default": true, | ||
"description": "When set to true, tabs are always displayed. When set to false and showTabsInTitlebar is set to false, tabs only appear after typing Ctrl + T.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after "opening a new tab" (since it can be rebound)
doc/cascadia/profiles.schema.json
Outdated
}, | ||
"defaultProfile": { | ||
"$ref": "#/definitions/ProfileKey", | ||
"description": "Sets the default profile. Opens by typing Ctrl + T or by clicking the '+' icon. The guid of the desired default profile is used as the value." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note about the new tab binding again
doc/cascadia/profiles.schema.json
Outdated
"type": "string" | ||
}, | ||
"scrollbarState": { | ||
"description": "Defines the visibility of the scrollbar. Possible values: \"visible\", \"hidden\"", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default
doc/cascadia/profiles.schema.json
Outdated
"type": "boolean" | ||
}, | ||
"startingDirectory": { | ||
"default": "%USERPROFILE%", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is actually not the default, we just .. faked it into being default. if they remove it, the default is "the current directory"
doc/cascadia/profiles.schema.json
Outdated
} | ||
}, | ||
"required": [ | ||
"acrylicOpacity", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only guid
, colorScheme
, commandline
and name
are required.
doc/cascadia/profiles.schema.json
Outdated
"$ref": "#/definitions/Color", | ||
"description": "Sets the color used as ANSI green." | ||
}, | ||
"name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move name up
notes from use: |
and key bindings fail to validate for |
For the key bindings, |
doc/cascadia/profiles.schema.json
Outdated
"profiles", | ||
"schemes" | ||
], | ||
"type": "object" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still have the problem where defaultProfile
can be inside globals or outside of it, keybindings
can be inside globals or outside, etc.
Anything that can exist in globals
can also exist outside of globals, so we need some sort of reusable object mapping that says so.
Co-Authored-By: Dustin L. Howett (MSFT) <[email protected]>
Co-Authored-By: Dustin L. Howett (MSFT) <[email protected]>
"default": false, | ||
"description": "When set to true, the window will have an acrylic background. When set to false, the window will have a plain, untextured background.", | ||
"type": "boolean" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "hidden" property is missing.
} | |
}, | |
"hidden": { | |
"default": false, | |
"description": "If set to true, the profile will not appear in the list of profiles. This can be used to hide default profiles and dynamicially generated profiles, while leaving them in your settings file.", | |
"type": "boolean" | |
} |
@bitcrazed i'm dismissing your review because you left one comment and it's since been fixed. |
Summary of the Pull Request
Updated the JSON schema referenced in #1003
Adding it to our repo so we can reference it in the profiles.json file
References
#1003
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed