Skip to content

Commit

Permalink
Add support for "keyfiles" to sublime-build syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
keith-hall committed Jan 8, 2018
1 parent 5f4c6ec commit 21512af
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"completions": [
{ "trigger": "selector\tmain key", "contents": "selector" },
{ "trigger": "variants\tmain key", "contents": "variants" },
{ "trigger": "keyfiles\tmain key", "contents": "keyfiles" },
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"completions": [
{ "trigger": "selector\tmain key", "contents": "\"selector\": \"$1\",$0" },
{ "trigger": "variants\tmain key", "contents": "\"variants\": [\n\t$0\n]," },
{ "trigger": "keyfiles\tmain key", "contents": "\"keyfiles\": [\"$0\"]," },
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ contexts:
2: keyword.other.main.sublime-build
3: punctuation.definition.string.end.json
set: [expect-variants-sequence-value, expect-colon]
- match: (")(keyfiles)(")
scope: meta.mapping.key.json meta.main-key.sublime-build string.quoted.double.json
captures:
1: punctuation.definition.string.begin.json
2: keyword.other.main.sublime-build
3: punctuation.definition.string.end.json
set: [expect-keyfiles-sequence-value, expect-colon]
- include: target-key
- include: exec-args-key
- include: platform-key
Expand Down Expand Up @@ -375,6 +382,23 @@ contexts:
pop: true
- include: string-escape

expect-keyfiles-sequence-value:
- match: (?=\[)
set: [mapping-value-meta, keyfiles-sequence-pop]
- include: expect-sequence-rest

keyfiles-sequence-pop:
- match: \[
scope: punctuation.section.sequence.begin.json
set:
- meta_scope: meta.sequence.json meta.keyfiles.collection.sublime-build
- include: comments
- match: \]
scope: punctuation.section.sequence.end.json
pop: true
- match: (?=\S)
push: [in-sequence-expect-comma, Sublime JSON.sublime-syntax#expect-string]

comments:
- include: Sublime JSON.sublime-syntax#comments

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
// ^^^^^^ string.unquoted.scope-segment.scope-selector
// ^ punctuation.separator.scope-segments.scope-selector
// ^^^^^^ string.unquoted.scope-segment.scope-selector
"keyfiles": ["Make"],
// ^^^^^^^^^^ meta.mapping.key.json meta.main-key.sublime-build string.quoted.double.json
// ^^^^^^^^ keyword.other.main.sublime-build
// ^ punctuation.separator.mapping.key-value.json
// ^^^^^^^^ meta.keyfiles.collection.sublime-build
// ^ punctuation.section.sequence.begin.json
// ^^^^^^ string.quoted.double.json
// ^ punctuation.section.sequence.end.json
// ^ meta.mapping.json meta.expect-comma.sublime punctuation.separator.mapping.pair.json - meta.keyfiles

"other_key": "value",
// ^^^^^^^^^^^ meta.mapping.key.json meta.main-key.sublime-build string.quoted.double.json
Expand Down

0 comments on commit 21512af

Please sign in to comment.