Skip to content

Commit ad8672a

Browse files
committed
Merge branch 'main' into 4075
2 parents ee26c11 + 4547ed3 commit ad8672a

7 files changed

Lines changed: 208 additions & 24 deletions
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"scope": "meta.setting-name.just - string - comment",
3+
"completions": [
4+
{
5+
"trigger": "allow-duplicate-recipes",
6+
"details": "Later recipes override earlier",
7+
"kind": ["keyword", "k", "setting"]
8+
},
9+
{
10+
"trigger": "dotenv-load",
11+
"details": "Load .env file, if it exists",
12+
"kind": ["keyword", "k", "setting"]
13+
},
14+
{
15+
"trigger": "export",
16+
"details": "Export all variables",
17+
"kind": ["keyword", "k", "setting"]
18+
},
19+
{
20+
"trigger": "fallback",
21+
"details": "Search up directory tree",
22+
"kind": ["keyword", "k", "setting"]
23+
},
24+
{
25+
"trigger": "ignore-comments",
26+
"details": "Ignore # lines in recipes",
27+
"kind": ["keyword", "k", "setting"]
28+
},
29+
{
30+
"trigger": "positional-arguments",
31+
"details": "Pass positional arguments",
32+
"kind": ["keyword", "k", "setting"]
33+
},
34+
{
35+
"trigger": "shell",
36+
"details": "Command for recipes/backticks",
37+
"kind": ["keyword", "k", "setting"]
38+
},
39+
{
40+
"trigger": "tempdir",
41+
"details": "Path to create temp directories",
42+
"kind": ["keyword", "k", "setting"]
43+
},
44+
{
45+
"trigger": "windows-shell",
46+
"details": "Command for recipes/backticks",
47+
"kind": ["keyword", "k", "setting"]
48+
},
49+
]
50+
}

Snippets/bash.sublime-snippet

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ ${1:recipe-name} *\$ARGS:
66
echo 'Hello, world!' \$ARGS
77
]]></content>
88
<tabTrigger>justbash</tabTrigger>
9-
<scope>source.just</scope>
9+
<scope>source.just - meta.setting-name.just</scope>
10+
<description>A basic bash recipe</description>
1011
</snippet>

Snippets/if.sublime-snippet

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<snippet>
2+
<content><![CDATA[
3+
if ${1:a} == ${2:b} {
4+
${3}
5+
} else {
6+
${4}
7+
}
8+
]]></content>
9+
<tabTrigger>if</tabTrigger>
10+
<scope>source.just - meta.setting-name.just</scope>
11+
<description>Simple if-else block</description>
12+
</snippet>

Syntax/Comments.tmPreferences

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
<key>value</key>
1414
<string># </string>
1515
</dict>
16-
<dict>
17-
<key>name</key>
18-
<string>TM_COMMENT_DISABLE_INDENT</string>
19-
<key>value</key>
20-
<string>yes</string>
21-
</dict>
2216
</array>
2317
</dict>
2418
</dict>

Syntax/Just.sublime-syntax

Lines changed: 115 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,94 @@ file_extensions:
1919
variables:
2020
valid_name: '[a-zA-Z_][a-zA-Z0-9_-]*'
2121
built_in_functions: |-
22-
(?x: absolute_path | arch | capitalize | clean | env_var_or_default | env_var
23-
| error | extension | file_name | file_stem | invocation_directory_native
24-
| invocation_directory | join | just_executable | justfile_directory | justfile
25-
| kebabcase | lowercamelcase | lowercase | os_family | os | parent_directory
26-
| path_exists | quote | replace_regex | replace | sha256_file | sha256
27-
| shoutykebabcase | shoutysnakecase | snakecase | titlecase
28-
| trim_end_matches | trim_end_match | trim_end | trim_start_matches
29-
| trim_start_match | trim_start | trim | uppercase | uppercamelcase
30-
| uuid | without_extension )
22+
(?x:
23+
absolute_path
24+
| append
25+
| arch
26+
| blake3
27+
| blake3_file
28+
| cache_dir
29+
| cache_directory
30+
| canonicalize
31+
| capitalize
32+
| choose
33+
| clean
34+
| config_dir
35+
| config_directory
36+
| config_local_dir
37+
| config_local_directory
38+
| data_dir
39+
| data_directory
40+
| data_local_dir
41+
| data_local_directory
42+
| datetime
43+
| datetime_utc
44+
| encode_uri_component
45+
| env
46+
| env_var
47+
| env_var_or_default
48+
| error
49+
| executable_dir
50+
| executable_directory
51+
| extension
52+
| file_name
53+
| file_stem
54+
| home_dir
55+
| home_directory
56+
| invocation_dir
57+
| invocation_dir_native
58+
| invocation_directory
59+
| invocation_directory_native
60+
| is_dependency
61+
| join
62+
| just_executable
63+
| just_pid
64+
| justfile
65+
| justfile_dir
66+
| justfile_directory
67+
| kebabcase
68+
| lowercamelcase
69+
| lowercase
70+
| module_dir
71+
| module_directory
72+
| module_file
73+
| num_cpus
74+
| os
75+
| os_family
76+
| parent_dir
77+
| parent_directory
78+
| path_exists
79+
| prepend
80+
| quote
81+
| read
82+
| replace
83+
| replace_regex
84+
| require
85+
| semver_matches
86+
| sha256
87+
| sha256_file
88+
| shell
89+
| shoutykebabcase
90+
| shoutysnakecase
91+
| snakecase
92+
| source_dir
93+
| source_directory
94+
| source_file
95+
| style
96+
| titlecase
97+
| trim
98+
| trim_end
99+
| trim_end_match
100+
| trim_end_matches
101+
| trim_start
102+
| trim_start_match
103+
| trim_start_matches
104+
| uppercamelcase
105+
| uppercase
106+
| uuid
107+
| which
108+
| without_extension
109+
)
31110
boolean_settings: |-
32111
(?x: allow-duplicate-recipes | dotenv-load | export | fallback | ignore-comments
33112
| positional-arguments | windows-powershell )
@@ -49,7 +128,7 @@ contexts:
49128
- include: aliases
50129
- include: comments
51130
- include: assignment
52-
- include: recipe-attribute
131+
- include: recipe-attributes
53132
- include: recipe-definition
54133
- include: recipe-generic-line
55134

@@ -301,9 +380,32 @@ contexts:
301380
###[ RECIPE DEFINITION ]#######################################################
302381
# Recipe definition lines, including attributes, arguments and dependencies
303382

304-
recipe-attribute:
305-
- match: ^\[\s*({{recipe_attributes}})\s*\]\s*$ # Only one attribute allowed per line
383+
recipe-attributes:
384+
- match: ^\[
306385
scope: meta.annotation.just variable.annotation.just
386+
push:
387+
- recipe-attributes-body
388+
- expect-recipe-attribute-name
389+
- include: eol-pop
390+
391+
recipe-attributes-body:
392+
- meta_scope: meta.sequence.list.just meta.annotation.just
393+
- match: \]
394+
scope: variable.annotation.just
395+
pop: 1
396+
- match: ','
397+
scope: punctuation.separator.parameters.just
398+
push: expect-recipe-attribute-name
399+
- include: eol-pop
400+
401+
expect-recipe-attribute-name:
402+
- match: ({{recipe_attributes}})
403+
scope: variable.annotation.just
404+
pop: 1
405+
- match: \]
406+
scope: invalid.illegal.just
407+
pop: 2
408+
- include: else-pop
307409

308410
recipe-definition:
309411
- match: (?=^@?{{valid_name}}(?![^:]*:=)) # Matches '^recipeName' but not '^varName :='
@@ -508,6 +610,7 @@ contexts:
508610
push: settings-name
509611

510612
settings-name:
613+
- meta_scope: meta.setting-name.just
511614
- include: settings-boolean-name
512615
- include: settings-shell-name
513616
- include: settings-string-name

Syntax/tests/syntax_test_just.recipe_declaration.just

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,40 @@ attr-test:
205205
linux-attr:
206206

207207
[ macos ]
208-
#^^^^^^^^^^ meta.annotation.just variable.annotation.just
208+
#^^^^^^^^^^ meta.sequence.list.just meta.annotation.just
209209
macos-attr:
210210

211211
[unix ]
212-
#^^^^^^^^ meta.annotation.just variable.annotation.just
212+
#^^^^^^^^ meta.sequence.list.just meta.annotation.just
213213
unix-attr:
214214

215215
[ windows]
216-
#^^^^^^^^^^ meta.annotation.just variable.annotation.just
216+
#^^^^^^^^^ meta.sequence.list.just meta.annotation.just
217217
windows-attr:
218218

219+
[ windows, macos, linux]
220+
#^^^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.just meta.annotation.just
221+
# ^^^^^^^ variable.annotation.just
222+
# ^ punctuation.separator.parameters.just
223+
# ^^^^^ variable.annotation.just
224+
# ^ punctuation.separator.parameters.just
225+
# ^^^^^ variable.annotation.just
226+
attr-multi-valid:
227+
228+
[windows linux]
229+
#^^^^^^^^^^^^^^ meta.sequence.list.just meta.annotation.just
230+
#^^^^^^^ variable.annotation.just
231+
# ^^^^^ - variable.annotation.just
232+
attr-multi-invalid-1:
233+
234+
[macos, ]
235+
# ^ invalid.illegal.just
236+
attr-multi-invalid-2:
237+
238+
[nonexistant-attribute]
239+
#<- meta.sequence.list.just meta.annotation.just meta.annotation.just variable.annotation.just
240+
#^^^^^^^^^^^^^^^^^^^^^ meta.sequence.list.just meta.annotation.just - variable.annotation.just
241+
attr-invalid:
219242

220243
test-image $PRODUCT $VERSION +IMAGES:
221244
# ^ meta.function.parameters.just keyword.operator.variadic.just

Syntax/tests/syntax_test_just.recipe_embeddings.just

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ python3 *ARGS:
66
print("hello {{ ARGS }} world")
77
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.python.embedded.just
88
# ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.python
9-
# ^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.python string.quoted.double.python
10-
# ^^^^^^^^^^ meta.interpolation.just
9+
# ^^^^^^^ meta.string.python string.quoted.double.python - meta.interpolation
10+
# ^^^^^^^^^^ meta.string.python meta.interpolation.just - string
11+
# ^^^^^^^ meta.string.python string.quoted.double.python - meta.interpolation
1112

1213
shell *$ARGS:
1314
#!/bin/sh

0 commit comments

Comments
 (0)