-
Notifications
You must be signed in to change notification settings - Fork 1
/
AzureDevops.sublime-syntax
103 lines (90 loc) · 3.6 KB
/
AzureDevops.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
scope: source.yaml.pipeline.azure-devops
version: 2
extends: Packages/YamlPipelines/YamlPipeline.sublime-syntax
file_extensions:
- azure-pipelines.yml
contexts:
main:
- meta_prepend: true
- match: \s(inlineScript|script)\s*(:)(?=\s|$) # TODO: honor scriptType using branching
captures:
1: string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline
2: punctuation.separator.key-value.yaml
push: script-block-node
- match: \s(bash)\s*(:)(?=\s|$)
captures:
1: string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline
2: punctuation.separator.key-value.yaml
push: script-block-node
- match: \s(pwsh|powershell)\s*(:)(?=\s|$)
captures:
1: string.unquoted.plain.out.yaml keyword.control.flow.script.pipeline
2: punctuation.separator.key-value.yaml
push: script-block-node # TODO: embed powershell instead of Bash
- match: \s+(condition)\s*(:)(?=\s+(?!\$\{\{)) # TODO: be smarter in case | is used etc.
captures:
1: string.unquoted.plain.out.yaml keyword.control.flow.condition.pipeline
2: punctuation.separator.key-value.yaml
push:
- include: flow-scalar-plain-out-body
- include: inside-expression
string-interpolations:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops
- meta_prepend: true
- match: \$\(
scope: punctuation.definition.variable.begin.pipeline
push: inside-ado-variable-reference-string-interpolation
- match: \$\[
scope: punctuation.section.block.begin.pipeline
push: inside-ado-runtime-expression-string-interpolations
inside-ado-variable-reference-string-interpolation:
- clear_scopes: 1 # clear string scope
- meta_scope: meta.interpolation.pipeline
- meta_content_scope: variable.other.constant.pipeline
- include: inside-ado-variable-reference
inside-ado-runtime-expression-string-interpolations:
- clear_scopes: 1 # clear string scope
- meta_scope: meta.interpolation.pipeline meta.block.pipeline
- include: inside-ado-runtime-expression
interpolations:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops
- meta_prepend: true
- match: \$\(
scope: punctuation.definition.variable.begin.pipeline
push: inside-ado-variable-reference
- match: \$\[
scope: punctuation.section.block.begin.pipeline
push: inside-ado-runtime-expression
inside-ado-variable-reference:
- meta_scope: meta.interpolation.pipeline
- meta_content_scope: variable.other.constant.pipeline
- match: \)
scope: punctuation.definition.variable.end.pipeline
pop: 1
inside-ado-runtime-expression:
- meta_scope: meta.interpolation.pipeline meta.block.pipeline
- match: \]
scope: punctuation.section.block.end.pipeline
pop: 1
- include: inside-expression
inside-expression:
- meta_append: true
- include: interpolations
- include: context
- match: \b(?i:true|false)\b
scope: constant.language.boolean.pipeline
context:
- match: \b(?:parameters|variables|dependencies)\b
scope: constant.language.context.pipeline
push: possible-accessor
embedded-bash:
- meta_include_prototype: false
- meta_scope: source.shell.bash.embedded
- include: scope:source.shell.bash.azure-devops
embedded-bash-folded:
- meta_include_prototype: false
- meta_scope: source.shell.bash.embedded
- include: scope:source.shell.bash.folded-azure-devops