Skip to content

Commit

Permalink
feat: add highlight for net sync syntax (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan authored Dec 23, 2023
1 parent 8abe551 commit 1faad1b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@
{
"language": "cactbot-timeline",
"scopeName": "source.cactbot.timeline",
"path": "./syntaxes/timeline.tmLanguage.json"
"path": "./syntaxes/timeline.tmLanguage.json",
"embeddedLanguages": {
"source.js": "javascript",
"meta.embedded.block.javascript": "javascript"
}
}
],
"snippets": [
Expand Down
17 changes: 17 additions & 0 deletions syntaxes/timeline.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,16 @@ repository:
# 0.0 "--Reset--" sync / 21:........:40000010:/ window 10000 jump 0 duration 5
# ^ ^ ^ ^ ^ ^
# #time #strings #sync / regex #window #jump #duration
# Cactbot introduce a new syntax for timeline file in
# https://github.com/quisquous/cactbot/issues/3547
# 0.0 "--Reset--" Action { id: "123", name: "Prime Eden" } window 10000 jump 0 duration 5
# ^ ^ ^ ^ ^ ^
# #time #strings #netsync / net regex #window #jump #duration
- include: '#number'
- include: '#strings'
- include: '#comma'
- include: '#regex'
- include: '#netsync'

regex:
name: constant.regexp.timeline
Expand All @@ -71,6 +77,17 @@ repository:
- name: constant.character.escape.regexp.timeline
match: '\\.'

netsync:
name: definition.netsync.timeline
begin: '\b(\w+)\s*(?={)'
end: '(?<=})'
beginCaptures:
'1':
name: entity.name.function.timeline
contentName: meta.embedded.block.javascript
patterns:
- include: 'source.js'

number:
patterns:
- match: >
Expand Down

0 comments on commit 1faad1b

Please sign in to comment.