From 4c1eedbf9eb1ccaea4ae78cf45c5fdb9dc976bd7 Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Wed, 17 Jan 2024 22:40:28 +0100 Subject: [PATCH 1/3] Separate HCL syntax into its own file --- Terraform-hcl.sublime-settings | 4 ++++ Terraform-hcl.sublime-syntax | 28 ++++++++++++++++++++++++++++ Terraform.sublime-syntax | 4 ---- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 Terraform-hcl.sublime-settings create mode 100644 Terraform-hcl.sublime-syntax diff --git a/Terraform-hcl.sublime-settings b/Terraform-hcl.sublime-settings new file mode 100644 index 0000000..8bbee60 --- /dev/null +++ b/Terraform-hcl.sublime-settings @@ -0,0 +1,4 @@ +{ + "tab_size": 2, + "translate_tabs_to_spaces": true +} diff --git a/Terraform-hcl.sublime-syntax b/Terraform-hcl.sublime-syntax new file mode 100644 index 0000000..d61d643 --- /dev/null +++ b/Terraform-hcl.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 (HCL) + +# File Extensions: +# +# - ".hcl": non-terraform tools often use this HCL syntax, i.e. Vault +# https://www.vaultproject.io/docs/configuration/ +file_extensions: + - hcl +scope: source.terraform-hcl + +contexts: + main: + - include: scope:source.terraform diff --git a/Terraform.sublime-syntax b/Terraform.sublime-syntax index a5624f5..7717623 100644 --- a/Terraform.sublime-syntax +++ b/Terraform.sublime-syntax @@ -19,12 +19,8 @@ name: Terraform # # - ".tf": the standard file extension # https://www.terraform.io/docs/language/index.html -# -# - ".hcl": non-terraform tools often use this HCL syntax, i.e. Vault -# https://www.vaultproject.io/docs/configuration/ file_extensions: - tf - - hcl scope: source.terraform variables: From 2ecf00303a24193ad27fc92167d992d04d05a14f Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Wed, 17 Jan 2024 22:52:40 +0100 Subject: [PATCH 2/3] comments handling --- Comments.tmPreferences | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Comments.tmPreferences b/Comments.tmPreferences index 81cc7e7..08154e3 100644 --- a/Comments.tmPreferences +++ b/Comments.tmPreferences @@ -5,7 +5,7 @@ name Comments scope - source.terraform, source.terraform-vars + source.terraform, source.terraform-vars, source.terraform-hcl settings shellVariables From 5d4c9f07c597785493048754aef72ab11166e53d Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Thu, 18 Jan 2024 09:19:21 +0100 Subject: [PATCH 3/3] rename to hcl (scope.hcl) --- Comments.tmPreferences | 2 +- Terraform-hcl.sublime-settings => HCL.sublime-settings | 0 Terraform-hcl.sublime-syntax => HCL.sublime-syntax | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) rename Terraform-hcl.sublime-settings => HCL.sublime-settings (100%) rename Terraform-hcl.sublime-syntax => HCL.sublime-syntax (93%) diff --git a/Comments.tmPreferences b/Comments.tmPreferences index 08154e3..5900b2f 100644 --- a/Comments.tmPreferences +++ b/Comments.tmPreferences @@ -5,7 +5,7 @@ name Comments scope - source.terraform, source.terraform-vars, source.terraform-hcl + source.terraform, source.terraform-vars, source.hcl settings shellVariables diff --git a/Terraform-hcl.sublime-settings b/HCL.sublime-settings similarity index 100% rename from Terraform-hcl.sublime-settings rename to HCL.sublime-settings diff --git a/Terraform-hcl.sublime-syntax b/HCL.sublime-syntax similarity index 93% rename from Terraform-hcl.sublime-syntax rename to HCL.sublime-syntax index d61d643..8373946 100644 --- a/Terraform-hcl.sublime-syntax +++ b/HCL.sublime-syntax @@ -13,7 +13,7 @@ # https://raw.githubusercontent.com/kkos/oniguruma/5.9.6/doc/RE # --- -name: Terraform (HCL) +name: HCL # File Extensions: # @@ -21,7 +21,7 @@ name: Terraform (HCL) # https://www.vaultproject.io/docs/configuration/ file_extensions: - hcl -scope: source.terraform-hcl +scope: source.hcl contexts: main: