Skip to content

Commit a3c8066

Browse files
authored
Merge #185: Changes to color schemes from build 3158
Add syntax highlighting and completions for new color scheme preferences.
2 parents 2e706c3 + 9a82c67 commit a3c8066

File tree

5 files changed

+89
-2
lines changed

5 files changed

+89
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"scope": "meta.corner-style.sublime-color-scheme",
3+
"completions": [
4+
{ "trigger": "cut\toptions value", "contents": "cut" },
5+
{ "trigger": "round\toptions value", "contents": "round" },
6+
{ "trigger": "square\toptions value", "contents": "square" },
7+
]
8+
}

Package/Sublime Text Color Scheme/Completions/Globals Keys (in-string).sublime-completions

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
{ "trigger": "caret\tglobals key", "contents": "caret" },
1212
{ "trigger": "find_highlight\tglobals key", "contents": "find_highlight" },
1313
{ "trigger": "find_highlight_foreground\tglobals key", "contents": "find_highlight_foreground" },
14+
{ "trigger": "fold_marker\tglobals key", "contents": "fold_marker" },
1415
{ "trigger": "foreground\tglobals key", "contents": "foreground" },
1516
{ "trigger": "guide\tglobals key", "contents": "guide" },
1617
{ "trigger": "gutter\tglobals key", "contents": "gutter" },
@@ -28,6 +29,9 @@
2829
{ "trigger": "rulers\tglobals key", "contents": "rulers" },
2930
{ "trigger": "selection\tglobals key", "contents": "selection" },
3031
{ "trigger": "selection_border\tglobals key", "contents": "selection_border" },
32+
{ "trigger": "selection_corner_radius\tglobals key", "contents": "selection_corner_radius" },
33+
{ "trigger": "selection_corner_style\tglobals key", "contents": "selection_corner_style" },
34+
{ "trigger": "selection_border_width\tglobals key", "contents": "selection_border_width" },
3135
{ "trigger": "shadow\tglobals key", "contents": "shadow" },
3236
{ "trigger": "shadow_width\tglobals key", "contents": "shadow_width" },
3337
{ "trigger": "stack_guide\tglobals key", "contents": "stack_guide" },

Package/Sublime Text Color Scheme/Completions/Globals Keys.sublime-completions

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
{ "trigger": "caret\tglobals key", "contents": "\"caret\": \"$1\"," },
1212
{ "trigger": "find_highlight\tglobals key", "contents": "\"find_highlight\": \"$1\"," },
1313
{ "trigger": "find_highlight_foreground\tglobals key", "contents": "\"find_highlight_foreground\": \"$1\"," },
14+
{ "trigger": "fold_marker\tglobals key", "contents": "\"fold_marker\": \"$1\"," },
1415
{ "trigger": "foreground\tglobals key", "contents": "\"foreground\": \"$1\"," },
1516
{ "trigger": "guide\tglobals key", "contents": "\"guide\": \"$1\"," },
1617
{ "trigger": "gutter\tglobals key", "contents": "\"gutter\": \"$1\"," },
@@ -28,6 +29,9 @@
2829
{ "trigger": "rulers\tglobals key", "contents": "\"rulers\": \"$1\"," },
2930
{ "trigger": "selection\tglobals key", "contents": "\"selection\": \"$1\"," },
3031
{ "trigger": "selection_border\tglobals key", "contents": "\"selection_border\": \"$1\"," },
32+
{ "trigger": "selection_corner_radius\tglobals key", "contents": "\"selection_corner_radius\": \"${1:2}\"," },
33+
{ "trigger": "selection_corner_style\tglobals key", "contents": "\"selection_corner_style\": \"${1:round}\"," },
34+
{ "trigger": "selection_border_width\tglobals key", "contents": "\"selection_border_width\": \"${1:1}\"," },
3135
{ "trigger": "shadow\tglobals key", "contents": "\"shadow\": \"$1\"," },
3236
{ "trigger": "shadow_width\tglobals key", "contents": "\"shadow_width\": \"$1\"," },
3337
{ "trigger": "stack_guide\tglobals key", "contents": "\"stack_guide\": \"$1\"," },

Package/Sublime Text Color Scheme/Sublime Text Color Scheme.sublime-syntax

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
name: Sublime Text Color Scheme (JSON)
55
file_extensions:
66
- sublime-color-scheme
7+
- hidden-color-scheme
78
scope: source.json.sublime.color-scheme
89

910
contexts:
@@ -201,20 +202,27 @@ contexts:
201202
- include: expect-key-rest
202203

203204
globals-mapping-key:
204-
- match: (")(accent|shadow|invisibles|caret|line_highlight|foreground|background|selection|selection_border|inactive_selection|inactive_selection_foreground|highlight|find_highlight|find_highlight_foreground|stack_guide|active_guide|guide|misspelling|brackets_foreground|bracket_contents_foreground|tags_foreground|minimap_border|gutter|gutter_foreground|rulers)(")
205+
- match: (")(accent|shadow|invisibles|caret|line_highlight|foreground|background|selection|selection_border|inactive_selection|inactive_selection_foreground|highlight|find_highlight|find_highlight_foreground|stack_guide|active_guide|guide|misspelling|brackets_foreground|bracket_contents_foreground|tags_foreground|minimap_border|gutter|gutter_foreground|rulers|fold_marker)(")
205206
scope: meta.mapping.key.json meta.globals-key.sublime-color-scheme string.quoted.double.json
206207
captures:
207208
1: punctuation.definition.string.begin.json
208209
2: entity.name.globals.sublime-color-scheme
209210
3: punctuation.definition.string.end.json
210211
set: [expect-color-string-value, expect-colon]
211-
- match: (")(shadow_width|popup_css|phantom_css)(")
212+
- match: (")(popup_css|phantom_css)(")
212213
scope: meta.mapping.key.json meta.globals-key.sublime-color-scheme string.quoted.double.json
213214
captures:
214215
1: punctuation.definition.string.begin.json
215216
2: entity.name.globals.sublime-color-scheme
216217
3: punctuation.definition.string.end.json
217218
set: [expect-string-value, expect-colon]
219+
- match: (")(shadow_width|selection_corner_radius|selection_border_width)(")
220+
scope: meta.mapping.key.json meta.globals-key.sublime-color-scheme string.quoted.double.json
221+
captures:
222+
1: punctuation.definition.string.begin.json
223+
2: entity.name.globals.sublime-color-scheme
224+
3: punctuation.definition.string.end.json
225+
set: [expect-possible-number-in-string-value, expect-colon]
218226
- match: (")(implicit_selection_foreground)(")
219227
scope: meta.mapping.key.json meta.globals-key.sublime-color-scheme string.quoted.double.json
220228
captures:
@@ -229,6 +237,13 @@ contexts:
229237
2: entity.name.globals.sublime-color-scheme
230238
3: punctuation.definition.string.end.json
231239
set: [expect-underlinestyle-string-value, expect-colon]
240+
- match: (")(selection_corner_style)(")
241+
scope: meta.mapping.key.json meta.globals-key.sublime-color-scheme string.quoted.double.json
242+
captures:
243+
1: punctuation.definition.string.begin.json
244+
2: entity.name.globals.sublime-color-scheme
245+
3: punctuation.definition.string.end.json
246+
set: [expect-cornerstyle-string-value, expect-colon]
232247
- include: in-dictionary-globals-key
233248
- include: expect-mapping-rest
234249

@@ -432,3 +447,42 @@ contexts:
432447
- include: string-escape
433448
- match: \b(true|false)\b
434449
scope: support.constant.boolean-string.color-scheme
450+
451+
expect-cornerstyle-string-value:
452+
- match: (?=")
453+
set: [mapping-value-meta, cornerstyle-string-pop]
454+
- include: expect-string-rest
455+
456+
cornerstyle-string-pop:
457+
- match: \"
458+
scope: punctuation.definition.string.begin.json
459+
set:
460+
- meta_scope: meta.corner-style.sublime-color-scheme string.quoted.double.json
461+
- match: '"'
462+
scope: punctuation.definition.string.end.json
463+
pop: true
464+
- match: $\n?
465+
scope: invalid.illegal.unclosed-string.json
466+
pop: true
467+
- include: string-escape
468+
- match: \b(square|cut|round)\b
469+
scope: support.constant.corner-style.color-scheme
470+
471+
expect-possible-number-in-string-value:
472+
- match: (?=")
473+
set: [mapping-value-meta, possible-number-in-string-pop]
474+
- include: expect-string-rest
475+
476+
possible-number-in-string-pop:
477+
- match: \"
478+
scope: punctuation.definition.string.begin.json
479+
set:
480+
- meta_scope: string.quoted.double.json
481+
- match: '"'
482+
scope: punctuation.definition.string.end.json
483+
pop: true
484+
- match: $\n?
485+
scope: invalid.illegal.unclosed-string.json
486+
pop: true
487+
- include: string-escape
488+
- include: Sublime JSON.sublime-syntax#number

Package/Sublime Text Color Scheme/syntax_test_colorscheme.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,23 @@
8484
// ^ punctuation.separator.mapping.key-value.json
8585
// ^^^^^^ meta.mapping.value.json string.quoted.double.json
8686
// ^ punctuation.separator.mapping.pair.json
87+
"selection_border_width": "1",
88+
// ^^^^^^^^^^^^^^^^^^^^^^ entity.name.globals.sublime-color-scheme
89+
// ^^^ meta.mapping.value.json string.quoted.double.json
90+
// ^ constant.numeric.json
91+
"selection_border": "#ffffff40",
92+
// ^^^^^^^^^^^^^^^^ meta.globals-key string.quoted.double entity.name.globals
93+
// ^^^^^^^^^ constant.other.color.rgba-value
94+
"selection_corner_style": "round",
95+
// ^^^^^^^^^^^^^^^^^^^^^^ entity.name.globals.sublime-color-scheme
96+
// ^^^^^ support.constant.corner-style.color-scheme
97+
"selection_corner_radius": "4",
98+
// ^^^^^^^^^^^^^^^^^^^^^^^ entity.name.globals.sublime-color-scheme
99+
// ^^^ meta.mapping.value.json string.quoted.double.json
100+
// ^ constant.numeric.json
101+
"fold_marker": "#ffcc00",
102+
// ^^^^^^^^^^^ entity.name.globals.sublime-color-scheme
103+
// ^^^^^^^ constant.other.color.rgb-value.css
87104
},
88105
// ^ punctuation.section.mapping.end.json
89106
// ^ punctuation.separator.mapping.pair.json

0 commit comments

Comments
 (0)