VladRassokhin / intellij-hcl

HCL language support for IntelliJ platform based IDEs
Apache License 2.0
244 stars 47 forks source link

Autocomplete not working correctly - Failed to parse file '/terraform/model/providers/kubernetes-alpha.json': null #330

Closed heschlie closed 3 years ago

heschlie commented 3 years ago

I've tried everything short of re-installing Arch, I am only seeing this issue with one of my machines, but it is driving me nuts and I could use some support.

Prerequisites

Installation details

Terraform Configuration Files

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
      version = ">=3.63.0"
    }
  }
}

provider "google" {
  project = "my-project"
  region  = "us-west1"
  zone    = "us-west1-a"
}

Exception

https://gist.github.com/heschlie/90d567b16d8d42e4024859e030468f1d https://gist.github.com/heschlie/53613423a11af1c29bd9b7dfbb8ed97d

Expected Behavior

when typing resource "google_, I would expect it to pop up an autocomplete list, and narrow down as I type, just like my other installs do.

Actual Behavior

Instead I either get nothing, or I have to pres ctrl-space several times in a row before the dialog pops up.

Steps to Reproduce

  1. open any .tf file
  2. start typing
  3. See a lack of autocomplete options

I don't expect this to be easily reproducable, the error at the top of the gist I think is the culprit, as it happens as soon as you launch the IDE.

Failed to parse file '/terraform/model/providers/kubernetes-alpha.json': null I have no idea why it is looking for this file, and I definitely don't have a terrform dir in my root drive.

EDIT: This seems to be limited to the google provider

esciara commented 3 years ago

I have the same problem with :

IntelliJ IDEA 2021.1 (Ultimate Edition)
Build #IU-211.6693.111, built on April 6, 2021

Runtime version: 11.0.10+9-b1341.35 x86_64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
macOS 11.3
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry: js.debugger.webconsole=false
Non-Bundled Plugins: codes.rudolph.idea.cfg (0.3.1), com.alayouni.ansiHighlight (1.2.4), com.andrey4623.rainbowcsv (2.0), com.intellij.ideolog (203.0.27.0), com.jetbrains.plugins.ini4idea (211.6693.44), ideanginx9 (0.1.9), net.seesharpsoft.intellij.plugins.csv (2.16.3), org.intellij.plugins.hcl (0.7.10), org.jetbrains.plugins.go-template (211.6693.44), org.jetbrains.plugins.rest (211.6693.44), mobi.hsz.idea.gitignore (4.1.0), name.kropp.intellij.makefile (211.6693.108), org.toml.lang (0.2.146.3826-211), com.jetbrains.lang.ejs (211.6693.65), com.jetbrains.plugins.jade (211.6693.65), com.jetbrains.plugins.yeoman (211.6693.64), intellij.prettierJS (211.6693.111), com.dmarcotte.handlebars (211.6693.44), org.jetbrains.plugins.ruby (211.6693.111), Pythonid (211.6693.115), com.github.nokia.pyvenv (1.3.1), ru.meanmail.plugin.requirements (2021.4-211), org.asciidoctor.intellij.asciidoc (0.32.43), org.jetbrains.plugins.go (211.6693.111), net.ashald.envfile (3.2.1), ru.adelf.idea.dotenv (2021.1)
Kotlin: 211-1.4.32-release-IJ6693.72

It works fine with the google-beta provider (which could be used as a workaround), but not with the google provider. Works fine with aws and azure.

I could not get any error message in the logs.

EDIT: actually, just declaring google-beta in addition to the google provider does the trick. Since google-beta is used only when explicitly declared as the provider to use for a resource, it is ignored.

cjkent commented 3 years ago

I'm seeing this problem with the latest EAP:

IntelliJ IDEA 2021.2 EAP (Ultimate Edition) Build #IU-212.4321.30, built on June 20, 2021 IntelliJ IDEA EAP User Expiration date: July 20, 2021 Runtime version: 11.0.11+9-b1504.3 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.15.7

The result is that Terraform support is totally broken - valid .tf files are shown with errors. Opening the same file in the current stable IntelliJ version works fine.

The file kubernetes-alpha.json referenced in the stack trace doesn't exist in my project. Like the original reporter, I don't even have a terraform directory in my project root.

VladRassokhin commented 3 years ago

Fixed in 0.7.11

esciara commented 3 years ago

@VladRassokhin it still does not work for me and I still need the google-beta hack to obtain autocomplete. I am on version 0.7.13 . image

VladRassokhin commented 3 years ago

@esciara How google-beta is related to issue "Autocomplete not working correctly - Failed to parse file '/terraform/model/providers/kubernetes-alpha.json'"? Please open separate issue.