From 58fd747a8736f19e645d86528038ec1e423ec222 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Wed, 9 Jun 2021 19:20:04 -0700 Subject: [PATCH] Add Sublime Text syntax file (#864) --- README.adoc | 4 +++ extras/just.sublime-syntax | 60 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 extras/just.sublime-syntax diff --git a/README.adoc b/README.adoc index 7b18a12..1817731 100644 --- a/README.adoc +++ b/README.adoc @@ -210,6 +210,10 @@ code --install-extension skellock.just Kakoune supports `justfile` syntax highlighting out of the box, thanks to TeddyDD. +=== Sublime Text + +A syntax file for Sublime Text written by TonioGela is available in link:extras/just.sublime-syntax[extras/just.sublime-syntax]. + === Other Editors Feel free to send me the commands necessary to get syntax highlighting working in your editor of choice so that I may include them here. diff --git a/extras/just.sublime-syntax b/extras/just.sublime-syntax new file mode 100644 index 0000000..8487439 --- /dev/null +++ b/extras/just.sublime-syntax @@ -0,0 +1,60 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/syntax.html +name: Just +scope: source.just +contexts: + main: + - include: interpolate + - include: comments + - include: scripts + - include: strings + - include: assignments + - include: recipeDefinition + - include: keywords + assignments: + - match: '^(export[\s]?)?([a-zA-Z_][a-zA-Z0-9_-]*)=' + captures: + 1: storage.type.just + 2: variable.name.just + comments: + - match: '^#[^!].*' + scope: comment.line.just + interpolate: + - match: '\{\{' + push: + - meta_scope: string.interpolated.just + - match: '\}\}' + pop: true + keywords: + - match: \b(arch|os|os_family|env_var|env_var_or_default)\b + scope: keyword.control.just + recipeDefinition: + - match: '^(@)?([a-zA-Z_][a-zA-Z0-9_-]*)([a-zA-Z0-9=\s_-`''"]*):([\sa-zA-Z0-9_-]*).*$' + captures: + 1: entity.name.function.just + 2: entity.name.function.just + 4: support.type.property-name.just + scripts: + - match: \s#\! + comment: The #! lines within a recipe. + push: + - meta_scope: support.type.property-name.just + - match: $ + pop: true + strings: + - match: '`' + push: + - meta_scope: string.quoted.triple.just + - match: '`' + pop: true + - match: '"' + push: + - meta_scope: string.quoted.double.just + - match: '"' + pop: true + - match: "'" + push: + - meta_scope: string.quoted.single.just + - match: "'" + pop: true