-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathTerraform Plan.sublime-syntax
More file actions
179 lines (154 loc) · 4.41 KB
/
Terraform Plan.sublime-syntax
File metadata and controls
179 lines (154 loc) · 4.41 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
# https://github.com/hashicorp/terraform/blob/337bf8e11b75dff87509455cabee60b023dd586e/internal/command/jsonformat/plan.go#L201
name: Terraform Plan
scope: source.diff.terraform
version: 2
file_extensions:
- tfplan
- tf.plan
contexts:
prototype:
- include: comments
main:
- include: comments
- include: diffs
- include: summary
comments:
- match: '#'
scope: punctuation.definition.comment.terraform
push:
- meta_scope: comment.line.number-sign.terraform
- include: pop-eol
annotations:
- meta_include_prototype: false
- match: ->
scope: keyword.operator.assignment.terraform
- match: \(known after apply\)
scope: comment.block.terraform
- match: \bnull\b
scope: constant.language.null.terraform
diffs:
- match: ^\+/-
scope: punctuation.definition.changed.diff
push: line-created-then-destroyed
- match: ^-/\+
scope: punctuation.definition.changed.diff
push: line-destroyed-then-created
- match: ^!
scope: punctuation.definition.changed.diff
push: line-changed
- match: ^\+
scope: punctuation.definition.inserted.diff
push: line-inserted
- match: ^-
scope: punctuation.definition.deleted.diff
push: line-deleted
- match: \[$\n?
push: bracket-body
- match: \{$\n?
push: brace-body
line-deleted:
- meta_scope: markup.deleted.diff
- include: line-deleted.hanging-eol-brackets
- include: pop-eol
- include: annotations
line-inserted:
- meta_scope: markup.inserted.diff
- include: line-inserted.hanging-eol-brackets
- include: pop-eol
- include: annotations
line-changed:
- meta_scope: markup.changed.updated-in-place.diff
- include: line-changed.hanging-eol-brackets
- include: pop-eol
- include: annotations
line-created-then-destroyed:
- meta_scope: markup.changed.created-then-destroyed.diff
- include: line-changed.hanging-eol-brackets
- include: pop-eol
- include: annotations
line-destroyed-then-created:
- meta_scope: markup.changed.destroyed-then-created.diff
- include: line-changed.hanging-eol-brackets
- include: pop-eol
- include: annotations
line-ignored:
- meta_scope: comment.line.diff
- include: pop-eol
- include: annotations
bracket-body:
- match: ^(?=\s*\])
pop: 1
- include: diffs
brace-body:
- match: ^\s*\}
pop: 1
- include: diffs
line-deleted.hanging-eol-brackets:
- match: \[$\n?
set: line-deleted.bracket-body
- match: \{$\n?
set: line-deleted.brace-body
line-deleted.bracket-body:
- match: ^(?=\s*\])
set: line-deleted
- include: diffs
line-deleted.brace-body:
- match: ^\s*\}
scope: markup.deleted.diff
pop: 1
- include: diffs
line-inserted.hanging-eol-brackets:
- match: \[$\n?
set: line-inserted.bracket-body
- match: \{$\n?
set: line-inserted.brace-body
line-inserted.bracket-body:
- match: ^(?=\s*\])
set: line-inserted
- include: diffs
line-inserted.brace-body:
- match: ^(?=\s*\})
set: line-inserted
- include: diffs
line-changed.hanging-eol-brackets:
- match: \[$\n?
set: line-changed.bracket-body
- match: \{$\n?
set: line-changed.brace-body
line-changed.bracket-body:
- match: ^\s*\]
scope: markup.changed.diff
pop: 1
- include: diffs
line-changed.brace-body:
- match: ^\s*\}
scope: markup.changed.diff
pop: 1
- include: diffs
summary:
- match: ^(?=Plan:[ ]\d)
push:
- meta_scope: meta.block.summary.terraform
- include: pop-eol
- match: ','
scope: punctuation.separator.sequence.terraform
- match: \.
scope: punctuation.terminator.terraform
- match: (\d+) to add
scope: markup.inserted.terraform
captures:
1: meta.number.integer.decimal.terraform constant.numeric.value.terraform
- match: (\d+) to change
scope: markup.changed.terraform
captures:
1: meta.number.integer.decimal.terraform constant.numeric.value.terraform
- match: (\d+) to destroy
scope: markup.deleted.terraform
captures:
1: meta.number.integer.decimal.terraform constant.numeric.value.terraform
pop-eol:
- match: \n|$
pop: 1