Vscode-terraform: Syntax highlighting broken for JSON blocks

Created on 25 Aug 2020  ·  6Comments  ·  Source: hashicorp/vscode-terraform

After one of the recent upgrades (most likely 2.2.0 or 2.2.1) the syntax highlighting got broken in one of my tf files. The code that breaks highlighting:

locals {
  dockerconfigjson1 = {
    "auths" : {
      "docker.io" = {
        email    = "[email protected]"
        username = "user"
        password = "password567"
        auth     = base64encode(join(":", ["user", "password567"]))
      }
    }
  }
  dockerconfigjson2 = {
    "auths" : {
      "company-docker-repo.net:6555" = {
        email    = "[email protected]"
        username = "user"
        password = "password123"
        auth     = base64encode(join(":", ["user", "password123"]))
      }
    }
  }
}

After the end of dockerconfigjson1 block the highlighting is broken - all the text is highlighted in the same color.

bug syntax

All 6 comments

I can report the same thing happening.
Screen Shot 2020-08-25 at 6 24 31 PM

Thanks for the lengthy examples @domenjesenovec and @vibhuyadav – I can see where the problem is so I'm prioritizing another patch release to fix this. Stay tuned! In the meantime, you may want to downgrade to an earlier version.

What's the piece that's breaking? Just curious

It's to do with the syntax matcher needing to be flexible enough to catch all of the possible things that might be assigned to those object keys, but also not treat the closing bracket as part of the value – basically I fixed the regular expression that matches the brackets by tightening up what could be assigned as a value, but now it's failing to match your function calls.

The update for this has been released in v2.2.2.

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vazkarvishal picture vazkarvishal  ·  5Comments

vfab picture vfab  ·  4Comments

jacobisaliveandwell picture jacobisaliveandwell  ·  3Comments

beinnova picture beinnova  ·  7Comments

kagarlickij picture kagarlickij  ·  5Comments