Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add hints via JSON schemas for themes/*.yml and config/filetypes.yml #130

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"yaml.schemas": {
"./schemas/filetypes.json": "config/filetypes.yml",
"./schemas/theme.json": "themes/*.yml",
}
}
59 changes: 59 additions & 0 deletions schemas/filetypes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"file_type_association": {
"title": "file type association",
"description": "A file type association",
"anyOf": [
{
"type": ["object"],
"properties": {
"text": {
"$ref": "#/definitions/file_type_association"
},
"markup": {
"$ref": "#/definitions/file_type_association"
},
"programming": {
"$ref": "#/definitions/file_type_association"
},
"unimportant": {
"$ref": "#/definitions/file_type_association"
}
},
"patternProperties": {
".": {
"$ref": "#/definitions/file_type_association"
}
},
"additionalProperties": false
},
{
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1,
"examples": [
"README.md",
"CONTRIBUTING.md",
"CHANGELOG.md",
"CODE_OF_CONDUCT.md",
"LICENSE",
".EXTENSION"
]
}
}
]
}
},
"title": "file type settings",
"description": "File type settings",
"type": "object",
"patternProperties": {
".": {
"$ref": "#/definitions/file_type_association"
}
}
}
204 changes: 204 additions & 0 deletions schemas/theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"color": {
"type": "string",
"minLength": 3,
"maxLength": 6,
"pattern": "^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$",
"examples": [
"000000",
"FFFFFF",
"FF0000",
"00FF00",
"0000FF",
"FFFF00",
"FF00FF"
]
},
"color_reference": {
"type": "string",
"minLength": 1,
"not": {
"pattern": "^\\s+$"
},
"examples": [
"background",
"white",
"gray",
"white",
"red",
"orange",
"yellow",
"green",
"cyan",
"blue",
"purple",
"light_gray",
"light_red",
"light_orange",
"light_yellow",
"light_green",
"light_cyan",
"light_blue",
"light_purple"
]
},
"file_type_association": {
"title": "file type association",
"description": "A file type association",
"type": ["object", "null"],
"properties": {
"background": {
"title": "background",
"description": "A reference to a background color defined in 'colors' property",
"$ref": "#/definitions/color_reference"
},
"foreground": {
"title": "foreground",
"description": "A reference to a foreground color defined in 'colors' property",
"$ref": "#/definitions/color_reference"
},
"font-style": {
"title": "font style",
"description": "A font style",
"type": "string",
"enum": ["bold", "italic", "underline"]
},
"text": {
"$ref": "#/definitions/file_type_association"
},
"markup": {
"$ref": "#/definitions/file_type_association"
},
"programming": {
"$ref": "#/definitions/file_type_association"
},
"unimportant": {
"$ref": "#/definitions/file_type_association"
}
},
"patternProperties": {
".": {
"$ref": "#/definitions/file_type_association"
}
},
"additionalProperties": false
}
},
"title": "theme",
"description": "A theme",
"type": "object",
"properties": {
"colors": {
"title": "colors",
"description": "Color identifiers",
"type": "object",
"properties": {
"background": {
"title": "background",
"description": "A background color",
"$ref": "#/definitions/color"
},
"gray": {
"title": "gray",
"description": "A gray color",
"$ref": "#/definitions/color"
},
"white": {
"title": "white",
"description": "A white color",
"$ref": "#/definitions/color"
},
"red": {
"title": "red",
"description": "A red color",
"$ref": "#/definitions/color"
},
"orange": {
"title": "orange",
"description": "A orange color",
"$ref": "#/definitions/color"
},
"yellow": {
"title": "yellow",
"description": "A yellow color",
"$ref": "#/definitions/color"
},
"green": {
"title": "green",
"description": "A green color",
"$ref": "#/definitions/color"
},
"cyan": {
"title": "cyan",
"description": "A cyan color",
"$ref": "#/definitions/color"
},
"blue": {
"title": "blue",
"description": "A blue color",
"$ref": "#/definitions/color"
},
"purple": {
"title": "purple",
"description": "A purple color",
"$ref": "#/definitions/color"
},
"light_gray": {
"title": "light gray",
"description": "A light gray color",
"$ref": "#/definitions/color"
},
"light_red": {
"title": "light red",
"description": "A light red color",
"$ref": "#/definitions/color"
},
"light_orange": {
"title": "light orange",
"description": "A light orange color",
"$ref": "#/definitions/color"
},
"light_yellow": {
"title": "light yellow",
"description": "A light yellow color",
"$ref": "#/definitions/color"
},
"light_green": {
"title": "light green",
"description": "A light green color",
"$ref": "#/definitions/color"
},
"light_cyan": {
"title": "light cyan",
"description": "A light cyan color",
"$ref": "#/definitions/color"
},
"light_blue": {
"title": "light blue",
"description": "A light blue color",
"$ref": "#/definitions/color"
},
"light_purple": {
"title": "light purple",
"description": "A light purple color",
"$ref": "#/definitions/color"
}
},
"patternProperties": {
".": {
"title": "color",
"description": "A color",
"$ref": "#/definitions/color"
}
}
}
},
"patternProperties": {
".": {
"$ref": "#/definitions/file_type_association"
}
},
"additionalProperties": false
}