VladRassokhin/intellij-hcl

Syntax issue with for expressions in latest plugin/PyCharm version

allenhumphreys opened this issue · 3 comments

Thank you for opening an issue.
In this template paragraph text could be removed, however please retain headers.

Prerequisites

  • Ensure you have latest version of plugin installed
  • Search for possible issue duplicates

Installation details

  • IDE version (Help->About->Copy to Clipboard)
IDE Info

PyCharm 2021.2.1 (Professional Edition) Build #PY-212.5080.64, built on August 25, 2021 Licensed to Seegrid Corporation / Allen Humphreys Subscription is active until March 23, 2022. Runtime version: 11.0.11+9-b1504.16 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.5.2 GC: ParNew, ConcurrentMarkSweep Memory: 1979M Cores: 12 Non-Bundled Plugins: me.lensvol.blackconnect (0.4.5), org.toml.lang (0.2.154.4085-212), org.intellij.plugins.hcl (0.7.13), Jetbrains TeamCity Plugin (2021.1.92869), NodeJS (212.5080.16), com.jetbrains.intellij.datalore (0.1.13-212), com.leinardi.pycharm.mypy (0.11.2), com.koxudaxi.pydantic (0.3.7), com.koxudaxi.poetry (1.1.5-212), com.intellij.gradle (212.4746.57)

  • intellij-hcl plugin version (Settings->Plugins) 0.7.13
  • Terraform version (terraform -v) v1.0.0

Terraform Configuration Files

locals {
  # Ignore these behind the scenes settings
  ignored_existing_settings = ["AzureWebJobsStorage", "FUNCTIONS_EXTENSION_VERSION"]
  existing_app_settings = { for setting_name, encoded_object in data.external.existing-app-settings.result :
    setting_name => sensitive(jsondecode(encoded_object).value) if !contains(local.ignored_existing_settings, setting_name)
  }
  # App Settings we apply regardless of runtime
  common_app_settings = {
    WEBSITE_RUN_FROM_PACKAGE       = sensitive("")
    APPINSIGHTS_INSTRUMENTATIONKEY = var.app_insights_instrumentation_key

    # The webpage is bad for things that do health checks and download the entire page, like frontdoor
    AzureWebJobsDisableHomepage = "true"
  }
}

Expected Behavior

What should have happened?

Correct syntax highlighting.

Actual Behavior

What actually happened?

The plugin encounters some syntax that it can't handle, and then the rest of the file is not highlighted. It reports an error of '(', <operator> or <property> expected, got 'setting_name' but the configuration is valid.

Screen Shot 2021-09-10 at 1 35 09 PM

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Use the config above

Yeah, parser bug around expressions precedence. Will be fixed in the next plugin update.
For now you could write !(contains(local....) (wrap method call with parentheses)

I had an intuition that some parenthesis somewhere might help but I didn’t try very many permutations!

Thanks for all the new updates and fixes, love the plugin a lot!

Fixed in 0.7.14