From 1faad1b9b3900c0ff4f7a96624171008648db361 Mon Sep 17 00:00:00 2001 From: Maiko Sinkyaet Tan Date: Sat, 23 Dec 2023 07:26:45 +0000 Subject: [PATCH] feat: add highlight for net sync syntax (#406) --- package.json | 6 +++++- syntaxes/timeline.tmLanguage.yaml | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 233601f..dc84e73 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/syntaxes/timeline.tmLanguage.yaml b/syntaxes/timeline.tmLanguage.yaml index d7a2c84..bc51f28 100644 --- a/syntaxes/timeline.tmLanguage.yaml +++ b/syntaxes/timeline.tmLanguage.yaml @@ -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 @@ -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: >