tree-sitter-grammars / tree-sitter-hcl

HCL grammar for tree-sitter
https://tree-sitter-grammars.github.io/tree-sitter-hcl/
Apache License 2.0
92 stars 20 forks source link

Parentheses in a heredoc break highlighting #27

Closed bravoecho closed 1 year ago

bravoecho commented 1 year ago

Description Starting from a valid Terraform file containing heredocs that have parentheses inside blocks:

To Reproduce Steps to reproduce the behavior:

  1. In the example file, tpl5, add parentheses around the string "foo", everything works normally. original original-parentheses-added

  2. In tpl6, add parentheses around or after the nested if block, the highlight will break. original-with-nested-block Screenshot 2022-11-24 at 09 43 51 parentheses-around-nested-block Screenshot 2022-11-24 at 09 43 45

Expected behavior Parentheses around and after nested blocks in a heredoc are valid and correctly highlighted.

Additional information Also verified with nested for loops.

MichaHoffmann commented 1 year ago

Hey, thanks for the report! Ill look into it over the weekend

MichaHoffmann commented 1 year ago

Great find, template expressions were a bit messed up, there were other bugs too with empty if/else or for directives; i added a few tests and fixed precedences; it should work in the next release!

MichaHoffmann commented 1 year ago

I think it closed automatically.

MichaHoffmann commented 1 year ago

After updating nvim-treesitter it works for me now: image

Can i close the issue?

bravoecho commented 1 year ago

Oh my, thank you so much, that was awesome, it's perfect now! I can't tell you how important it was to me, thanks again!