|
2 | 2 | filetype: 'justfile' |
3 | 3 |
|
4 | 4 | detect: |
5 | | - filename: "(^\\.?[Jj]ustfile|\\.just)$" |
| 5 | + filename: "(\\.?[Jj]ustfile|\\.just)$" |
6 | 6 | header: "^#!.*/(env +)?[bg]?just --justfile" |
7 | 7 |
|
8 | 8 | rules: |
9 | | - - preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>" |
10 | | - - statement: "^(export|include|override)\\>" |
11 | | - - symbol.operator: "^[^:= ]+:" |
12 | | - - symbol.operator: "([=,%]|\\+=|\\?=|:=|&&|\\|\\|)" |
13 | | - - statement: "\\$\\((abspath|addprefix|addsuffix|and|basename|call|dir)[[:space:]]" |
14 | | - - statement: "\\$\\((error|eval|filter|filter-out|findstring|firstword)[[:space:]]" |
15 | | - - statement: "\\$\\((flavor|foreach|if|info|join|lastword|notdir|or)[[:space:]]" |
16 | | - - statement: "\\$\\((origin|patsubst|realpath|shell|sort|strip|suffix)[[:space:]]" |
17 | | - - statement: "\\$\\((value|warning|wildcard|word|wordlist|words)[[:space:]]" |
18 | | - # default functions - probably shouldn't be overwritten by assignment |
19 | | - - statement: "\\b(arch|os|os_family|env_var|invocation_directory|justfile|justfile_directory|just_executable|lowercase|quote|replace|trim|trim_end|trim_end|trim_end_match|trim_end_matches|trim_start|trim_start_match|trim_start_matches|uppercase)\\b" |
20 | | - - identifier: "^.+:" |
21 | | - - identifier: "[()$]" |
| 9 | + - identifier: "^[a-zA-Z_][a-zA-Z0-9_-]*" |
| 10 | + - symbol.brackets: "[\\{\\}]" |
| 11 | + |
| 12 | + # Alias |
| 13 | + - identifier: "^alias\\s+[a-zA-Z_][a-zA-Z0-9_-]*\\s*:=\\s*[a-zA-Z_][a-zA-Z0-9_-]*$" |
| 14 | + - statement: "^(alias|export)\\b" |
| 15 | + |
| 16 | + # Functions |
| 17 | + - statement: "\\b(arch|os|os_family|invocation_directory|justfile|justfile_directory|just_executable|uuid)\\b" |
| 18 | + # Env |
| 19 | + - statement: "\\b(env|env_var|env_var_or_default)\\b" |
| 20 | + # String manipulation |
| 21 | + - statement: "\\b(quote|replace|replace_regex|trim_end_matches|trim_end_match|trim_end|trim_start_matches|trim_start_match|trim_start|trim|capitalize|uppercamelcase|lowercamelcase|lowercase|shoutykebabcase|shoutysnakecase|snakecase|titlecase|uppercase|kebabcase)\\b" |
| 22 | + # Path manipulation |
| 23 | + - statement: "\\b(absolute_path|extension|file_name|file_stem|parent_directory|without_extension|clean|join|path_exists)\\b" |
| 24 | + # Other misc functions |
| 25 | + - statement: "\\b(error|sha256|sha256_file|semver_matches)\\b" |
| 26 | + |
| 27 | + - statement: "\\b(if|else)\\b" |
| 28 | + - statement: "\\{\\{|\\}\\}" |
| 29 | + |
| 30 | + # Infix operators only highlighted when surrounded by whitespace |
| 31 | + # to reduce false positives |
| 32 | + - symbol.operator: "\\s[/+]|==|!=\\s" |
| 33 | + |
| 34 | + # Recipe |
| 35 | + - identifier: "^\\S.*?:(\\s|$)" |
| 36 | + - symbol.operator: "^\\s*[@-]*" |
| 37 | + # Reset to default after recipe identifier |
| 38 | + - default: "\\s.*:( |$)" |
| 39 | + |
| 40 | + # Variadic parameters |
| 41 | + - special: "\\s+[*+]\\$?[a-zA-Z_][a-zA-Z0-9_-]*" |
| 42 | + |
| 43 | + # Environment variables |
| 44 | + - special: "\\$[A-Za-z0-9_]+" |
| 45 | + |
| 46 | + - symbol.operator: ":=?" |
| 47 | + |
| 48 | + # Attribute |
| 49 | + - symbol.brackets: |
| 50 | + start: "^\\[" |
| 51 | + end: "\\]" |
| 52 | + rules: |
| 53 | + - symbol.tag: "\\b(no-cd|no-exit-message|linux|macos|unix|windows|private)\\b" |
| 54 | + - statement: "," |
| 55 | + |
| 56 | + # Built-in settings |
| 57 | + - statement: |
| 58 | + start: "^set\\b" |
| 59 | + end: "$" |
| 60 | + rules: |
| 61 | + - default: ".*" |
| 62 | + - identifier: "\\b(allow-duplicate-recipes|dotenv-filename|dotenv-load|dotenv-path|export|fallback|ignore-comments|positional-arguments|shell|tempdir|windows-powershell|windows-shell)\\b" |
| 63 | + - statement: ":=" |
| 64 | + - bracket: "\\[|\\]" |
| 65 | + - statement: "," |
| 66 | + - constant.bool: "\\b(true|false)\\b" |
| 67 | + # these are not perfect but they work for the simple cases |
| 68 | + - constant.string: "\"\"\".*\"\"\"" |
| 69 | + - constant.string: "'''.*'''" |
| 70 | + - constant.string: "\".*?\"" |
| 71 | + - constant.string: "'.*?'" |
| 72 | + |
| 73 | + - constant.string: |
| 74 | + start: "\"\"\"" |
| 75 | + end: "\"\"\"" |
| 76 | + rules: [] |
| 77 | + |
| 78 | + - constant.string: |
| 79 | + start: "'''" |
| 80 | + end: "'''" |
| 81 | + rules: [] |
| 82 | + |
22 | 83 | - constant.string: |
23 | 84 | start: "\"" |
24 | 85 | end: "\"" |
25 | 86 | skip: "\\\\." |
26 | 87 | rules: |
27 | 88 | - constant.specialChar: "\\\\." |
| 89 | + |
28 | 90 | - constant.string: |
29 | 91 | start: "'" |
30 | 92 | end: "'" |
31 | 93 | skip: "\\\\." |
32 | 94 | rules: |
33 | 95 | - constant.specialChar: "\\\\." |
34 | | - - identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))" |
35 | | - - identifier: "\\$[@^<*?%|+]|\\$\\([@^<*?%+-][DF]\\)" |
36 | | - - identifier: "\\$\\$|\\\\.?" |
| 96 | + |
| 97 | + # Command evaluation using backticks |
| 98 | + - constant.string: |
| 99 | + start: "`" |
| 100 | + end: "`" |
| 101 | + skip: "\\\\." |
| 102 | + rules: |
| 103 | + - symbol.operator: "\\|" |
| 104 | + |
37 | 105 | - comment: |
38 | 106 | start: "#" |
39 | 107 | end: "$" |
40 | | - rules: [] |
| 108 | + rules: |
| 109 | + - todo: "(TODO|FIXME):?" |
0 commit comments