hashicorp / vscode-terraform

HashiCorp Terraform VSCode extension
https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform
Mozilla Public License 2.0
922 stars 179 forks source link

Syntax Highlighting Breaks If a Function is Split Over Multiple Lines When in String Interpolation #1756

Open dli-spoton opened 4 months ago

dli-spoton commented 4 months ago

Extension Version

v2.30.1

VS Code Version

Version: 1.89.1 (Universal) Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685 Date: 2024-05-07T05:14:24.611Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Darwin arm64 23.4.0

Operating System

macOS Sonoma Version 14.4.1 (23E224)

Terraform Version

Terraform v1.5.7 on darwin_arm64

Steps to Reproduce

Create a main.tf with the following:

locals {
  list = [
    "1", "2", "3"
  ]
  function = [
    for i in local.list : "Out: ${join("-", [i, "join"]
    )}" if i != "2"
  ]
}

output "test" {
  value = local.function
}

Expected Behavior

Screenshot 2024-05-15 at 2 05 51 PM Syntax highlighting works as expected after the closing ) for the join function in v2.29.5

Actual Behavior

Screenshot 2024-05-15 at 2 05 22 PM Doesn't seem to associate the closing ) to the join() after updating to v2.30.1

Terraform Configuration

No response

Project Structure

No response

Gist

No response

Anything Else?

No response

Workarounds

No response

References

No response

Help Wanted

Community Note

dbanck commented 4 months ago

Thank you for the report!

I'm able to reproduce the issue and have created an issue to track the required grammar changes: https://github.com/hashicorp/syntax/issues/128