Skip to content

Commit

Permalink
Merge pull request #49 from rchl/fix/separate-tfvars
Browse files Browse the repository at this point in the history
Split the tfvars handling into a separate syntax file
  • Loading branch information
radeksimko committed Jun 21, 2021
2 parents 6eecc0c + 884b127 commit 329a58d
Show file tree
Hide file tree
Showing 5 changed files with 3,112 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Comments.tmPreferences
Expand Up @@ -5,7 +5,7 @@
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.terraform</string>
<string>source.terraform, source.terraform-vars</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
Expand Down
4 changes: 4 additions & 0 deletions Terraform-vars.sublime-settings
@@ -0,0 +1,4 @@
{
"tab_size": 2,
"translate_tabs_to_spaces": true
}
28 changes: 28 additions & 0 deletions Terraform-vars.sublime-syntax
@@ -0,0 +1,28 @@
%YAML 1.2
#
# This syntax definition is based on the Terraform guide:
# https://www.terraform.io/docs/configuration/index.html
#
# As well as the HCL Native Syntax Spec:
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md
#
# For documentation on the .subline-syntax format:
# https://www.sublimetext.com/docs/syntax.html
#
# Regex's in this file support the Oniguruma regex engine:
# https://raw.githubusercontent.com/kkos/oniguruma/5.9.6/doc/RE
#
---
name: Terraform (variables)

# File Extensions:
#
# - ".tfvars": variables definitions file
# https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files
file_extensions:
- tfvars
scope: source.terraform-vars

contexts:
main:
- include: scope:source.terraform
8 changes: 2 additions & 6 deletions Terraform.sublime-syntax
Expand Up @@ -7,7 +7,7 @@
# https://github.com/hashicorp/hcl2/blob/master/hcl/hclsyntax/spec.md
#
# For documentation on the .subline-syntax format:
# https://www.sublimetext.com/docs/3/syntax.html
# https://www.sublimetext.com/docs/syntax.html
#
# Regex's in this file support the Oniguruma regex engine:
# https://raw.githubusercontent.com/kkos/oniguruma/5.9.6/doc/RE
Expand All @@ -20,14 +20,10 @@ name: Terraform
# - ".tf": the standard file extension
# https://www.terraform.io/docs/configuration/index.html#code-organization
#
# - ".tfvars": variables definitions file
# https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files
#
# - ".hcl": non-terraform tools often use this HCL syntax, i.e. Vault
# https://www.vaultproject.io/docs/configuration/
file_extensions:
- tf
- tfvars
- hcl
scope: source.terraform

Expand Down Expand Up @@ -549,4 +545,4 @@ contexts:
- include: main
- match: \}
scope: punctuation.section.block.end.terraform
pop: true
pop: true

0 comments on commit 329a58d

Please sign in to comment.