Skip to content

Commit 329a58d

Browse files
authored
Merge pull request #49 from rchl/fix/separate-tfvars
Split the tfvars handling into a separate syntax file
2 parents 6eecc0c + 884b127 commit 329a58d

5 files changed

+3112
-7
lines changed

Comments.tmPreferences

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<key>name</key>
66
<string>Comments</string>
77
<key>scope</key>
8-
<string>source.terraform</string>
8+
<string>source.terraform, source.terraform-vars</string>
99
<key>settings</key>
1010
<dict>
1111
<key>shellVariables</key>

Terraform-vars.sublime-settings

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"tab_size": 2,
3+
"translate_tabs_to_spaces": true
4+
}

Terraform-vars.sublime-syntax

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
%YAML 1.2
2+
#
3+
# This syntax definition is based on the Terraform guide:
4+
# https://www.terraform.io/docs/configuration/index.html
5+
#
6+
# As well as the HCL Native Syntax Spec:
7+
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md
8+
#
9+
# For documentation on the .subline-syntax format:
10+
# https://www.sublimetext.com/docs/syntax.html
11+
#
12+
# Regex's in this file support the Oniguruma regex engine:
13+
# https://raw.githubusercontent.com/kkos/oniguruma/5.9.6/doc/RE
14+
#
15+
---
16+
name: Terraform (variables)
17+
18+
# File Extensions:
19+
#
20+
# - ".tfvars": variables definitions file
21+
# https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files
22+
file_extensions:
23+
- tfvars
24+
scope: source.terraform-vars
25+
26+
contexts:
27+
main:
28+
- include: scope:source.terraform

Terraform.sublime-syntax

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md
88
#
99
# For documentation on the .subline-syntax format:
10-
# https://www.sublimetext.com/docs/3/syntax.html
10+
# https://www.sublimetext.com/docs/syntax.html
1111
#
1212
# Regex's in this file support the Oniguruma regex engine:
1313
# https://raw.githubusercontent.com/kkos/oniguruma/5.9.6/doc/RE
@@ -20,14 +20,10 @@ name: Terraform
2020
# - ".tf": the standard file extension
2121
# https://www.terraform.io/docs/configuration/index.html#code-organization
2222
#
23-
# - ".tfvars": variables definitions file
24-
# https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files
25-
#
2623
# - ".hcl": non-terraform tools often use this HCL syntax, i.e. Vault
2724
# https://www.vaultproject.io/docs/configuration/
2825
file_extensions:
2926
- tf
30-
- tfvars
3127
- hcl
3228
scope: source.terraform
3329

@@ -549,4 +545,4 @@ contexts:
549545
- include: main
550546
- match: \}
551547
scope: punctuation.section.block.end.terraform
552-
pop: true
548+
pop: true

0 commit comments

Comments
 (0)