fix: Add atoms for hcl

Signed-off-by: Xuanwo <github@xuanwo.io>
pull/264/head
Xuanwo 2022-04-24 15:57:51 +07:00
parent 3c973f4530
commit d4c3d114dc
No known key found for this signature in database
GPG Key ID: C423B4FA6B48E945
4 changed files with 11 additions and 5 deletions

@ -41,7 +41,7 @@ sample_files/haskell_before.hs sample_files/haskell_after.hs
9c668c79e56f1e1cecf1c02759c195a9 - 9c668c79e56f1e1cecf1c02759c195a9 -
sample_files/hcl_before.hcl sample_files/hcl_after.hcl sample_files/hcl_before.hcl sample_files/hcl_after.hcl
5918eacc75d3277c1f64df1116ec356d - f8a18b1f0b50c1a1736e13306cf3db52 -
sample_files/helpful_before.el sample_files/helpful_after.el sample_files/helpful_before.el sample_files/helpful_after.el
bce74573e003cc6b729a63a4bc34c4af - bce74573e003cc6b729a63a4bc34c4af -

@ -73,10 +73,16 @@ resource "example" "template_expressions" {
EOF EOF
tpl6 = <<-EOF tpl6 = <<-EOF
%{ for a in f(b) ~} %{ for a in f(x) ~}
%{~if a~} "true" %{~else~} "false" %{~endif~} %{~if a~} "true" %{~else~} "false" %{~endif~}
%{ endfor ~} %{ endfor ~}
EOF EOF
tpl7 = <<-EOF
%{ for a in f(b) ~}
"true"
%{ endfor ~}
EOF
} }
resource "example" "nested_blocks" { resource "example" "nested_blocks" {

@ -71,8 +71,8 @@ resource "example" "template_expressions" {
EOF EOF
tpl5 = <<-EOF tpl5 = <<-EOF
%{~if cond~} %{~if cond~}
"foo" "foo"
%{~else~} %{~else~}
4 4
%{~endif~} %{~endif~}

@ -313,7 +313,7 @@ pub fn from_language(language: guess::Language) -> TreeSitterConfig {
TreeSitterConfig { TreeSitterConfig {
name: "Hcl", name: "Hcl",
language, language,
atom_nodes: vec!["string"].into_iter().collect(), atom_nodes: vec!["string_lit", "heredoc_template"].into_iter().collect(),
delimiter_tokens: vec![ delimiter_tokens: vec![
("[", "]"), ("[", "]"),
("(", ")"), ("(", ")"),