Skip to content

Commit 678f0cb

Browse files
add feature: vs code intellisense to devicon.json (#1487)
* Add VS Code Intellisense to `devicon.json` VS Code Intellisense provides these features: - A snippet to create a new input object by typing `new` - Validates - `name` structure - `color` structure - `version.svg[]`, `version.font[]`, `aliases.?base` and `aliases.?alias` completion - Provides some description for the properties based on the documentation * Fix name pattern and add `dot-net` exception * Update .vscode/devicon-schema.json Co-authored-by: Jørgen Kalsnes Hagen <[email protected]> * Update .vscode/devicon.code-snippets Great! Co-authored-by: Jørgen Kalsnes Hagen <[email protected]> * Update .vscode/devicon-schema.json Agreed! It's more detailed now! Co-authored-by: Jørgen Kalsnes Hagen <[email protected]> * Update .vscode/devicon-schema.json Great! Co-authored-by: Jørgen Kalsnes Hagen <[email protected]> Co-authored-by: Jørgen Kalsnes Hagen <[email protected]>
1 parent 77ff589 commit 678f0cb

File tree

4 files changed

+524
-0
lines changed

4 files changed

+524
-0
lines changed

.vscode/devicon-schema.json

+223
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema",
3+
"definitions": {
4+
"IconVersions": {
5+
"type": "string",
6+
"enum": [
7+
"original",
8+
"plain",
9+
"line",
10+
"original-wordmark",
11+
"plain-wordmark",
12+
"line-wordmark"
13+
]
14+
},
15+
"IconVersionsArray": {
16+
"type": "array",
17+
"items": {
18+
"$ref": "#/definitions/IconVersions"
19+
}
20+
}
21+
},
22+
"type": "array",
23+
"items": {
24+
"type": "object",
25+
"additionalProperties": false,
26+
"properties": {
27+
"name": {
28+
"type": "string",
29+
"title": "The official name of the technology.",
30+
"description": "Pattern: Only lower-case letters and digits.",
31+
"pattern": "^(dot-net|[0-9a-z]+)$"
32+
},
33+
"altnames": {
34+
"type": "array",
35+
"title": "List of alternative names for this technology.",
36+
"description": "Used for the searchbar on the Devicon website. https://devicon.dev",
37+
"uniqueItems": true,
38+
"items": {
39+
"type": "string"
40+
}
41+
},
42+
"tags": {
43+
"type": "array",
44+
"title": "List of tags relating to the technology for categorization/search purpose.",
45+
"$ref": "./tags-enum.json/#/definitions/Tags"
46+
},
47+
"versions": {
48+
"title": "Keeps track of the different versions that you have.",
49+
"type": "object",
50+
"additionalProperties": false,
51+
"properties": {
52+
"svg": {
53+
"title": "List all the SVGs that you have.",
54+
"contains": {
55+
"$ref": "#/definitions/IconVersions"
56+
},
57+
"minItems": 1,
58+
"uniqueItems": true,
59+
"$ref": "#/definitions/IconVersionsArray"
60+
},
61+
"font": {
62+
"title": "List only the SVGs that can be converted to fonts. Usually refers to \"plain\" and \"line\" versions but \"original\" can be accepted.",
63+
"description": "DO NOT list aliases here! In this case use \"aliases\" property!",
64+
"contains": {
65+
"$ref": "#/definitions/IconVersions"
66+
},
67+
"minItems": 1,
68+
"uniqueItems": true,
69+
"$ref": "#/definitions/IconVersionsArray"
70+
}
71+
}
72+
},
73+
"color": {
74+
"title": "The official/main hexadecimal color of the logo. [Case insensitive]",
75+
"description": "Pattern example: #FFFFFF",
76+
"type": "string",
77+
"pattern": "^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
78+
},
79+
"aliases": {
80+
"title": "Keeps track of the aliases for the font versions ONLY.",
81+
"description": "Can be empty, or contain objects, each with an alias and a base version. More info here: https://github.com/devicons/devicon/wiki/Updating-%60devicon.json%60#aliases-and-aliasobj",
82+
"type": "array",
83+
"items": {
84+
"title": "AliasObj, an object containing an alias and a base version",
85+
"type": "object",
86+
"additionalProperties": false,
87+
"properties": {
88+
"base": {
89+
"title": "The SVG file you are using as source for the alias.",
90+
"$ref": "#/definitions/IconVersions"
91+
},
92+
"alias": {
93+
"title": "The new name (alias) that you want to generate.",
94+
"$ref": "#/definitions/IconVersions"
95+
}
96+
},
97+
"required": [
98+
"base",
99+
"alias"
100+
],
101+
"allOf": [
102+
{
103+
"if": {
104+
"properties": {
105+
"base": {
106+
"const": "original"
107+
}
108+
}
109+
},
110+
"then": {
111+
"not": {
112+
"properties": {
113+
"alias": {
114+
"const": "original"
115+
}
116+
}
117+
}
118+
}
119+
},
120+
{
121+
"if": {
122+
"properties": {
123+
"base": {
124+
"const": "plain"
125+
}
126+
}
127+
},
128+
"then": {
129+
"not": {
130+
"properties": {
131+
"alias": {
132+
"const": "plain"
133+
}
134+
}
135+
}
136+
}
137+
},
138+
{
139+
"if": {
140+
"properties": {
141+
"base": {
142+
"const": "line"
143+
}
144+
}
145+
},
146+
"then": {
147+
"not": {
148+
"properties": {
149+
"alias": {
150+
"const": "line"
151+
}
152+
}
153+
}
154+
}
155+
},
156+
{
157+
"if": {
158+
"properties": {
159+
"base": {
160+
"const": "original-wordmark"
161+
}
162+
}
163+
},
164+
"then": {
165+
"not": {
166+
"properties": {
167+
"alias": {
168+
"const": "original-wordmark"
169+
}
170+
}
171+
}
172+
}
173+
},
174+
{
175+
"if": {
176+
"properties": {
177+
"base": {
178+
"const": "plain-wordmark"
179+
}
180+
}
181+
},
182+
"then": {
183+
"not": {
184+
"properties": {
185+
"alias": {
186+
"const": "plain-wordmark"
187+
}
188+
}
189+
}
190+
}
191+
},
192+
{
193+
"if": {
194+
"properties": {
195+
"base": {
196+
"const": "line-wordmark"
197+
}
198+
}
199+
},
200+
"then": {
201+
"not": {
202+
"properties": {
203+
"alias": {
204+
"const": "line-wordmark"
205+
}
206+
}
207+
}
208+
}
209+
}
210+
]
211+
}
212+
}
213+
},
214+
"required": [
215+
"name",
216+
"altnames",
217+
"tags",
218+
"versions",
219+
"color",
220+
"aliases"
221+
]
222+
}
223+
}

.vscode/devicon.code-snippets

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"new entry": {
3+
"scope": "json",
4+
"prefix": "new",
5+
"description": "Inserts the new entry template object. Use it ONLY in \"devicon.json\"!",
6+
"body": [
7+
"{",
8+
" \"name\": \"\",",
9+
" \"altnames\": [],",
10+
" \"tags\": [],",
11+
" \"versions\": {",
12+
" \"svg\": [",
13+
" \"\"",
14+
" ],",
15+
" \"font\": [",
16+
" \"\"",
17+
" ]",
18+
" },",
19+
" \"color\": \"\",",
20+
" \"aliases\": []",
21+
"},"
22+
]
23+
}
24+
}

.vscode/settings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"json.schemas": [
3+
{
4+
"fileMatch": [
5+
"devicon.json"
6+
],
7+
"url": "/.vscode/devicon-schema.json"
8+
}
9+
]
10+
}

0 commit comments

Comments
 (0)