Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textDocument/complete: Get schemas for invalid configs #56

Open
radeksimko opened this issue Apr 21, 2020 · 0 comments
Open

textDocument/complete: Get schemas for invalid configs #56

radeksimko opened this issue Apr 21, 2020 · 0 comments

Comments

@radeksimko
Copy link
Member

radeksimko commented Apr 21, 2020

Server Version

v0.1.0

Terraform Version

v0.12.24

Terraform Configuration Files

provider "aws" {
}

data "" "name" {

}

Log Output

2020/04/21 09:54:43 schema_storage.go:112: error obtaining schemas: Unable to retrieve schemas: failed to get schemas: terraform (pid 72418) exited (code 1): exit status 1
stdout: ""
stderr: "\x1b[31m\n\x1b[1m\x1b[31mError: \x1b[0m\x1b[0m\x1b[1mInvalid data source name\x1b[0m\n\n\x1b[0m  on main.tf line 19, in data \"\" \"name\":\n  19: data \x1b[4m\"\"\x1b[0m \"name\" {\n\x1b[0m\nA name must start with a letter or underscore and may contain only letters,\ndigits, underscores, and dashes.\n\x1b[0m\x1b[0m\n"

Expected Behavior

Schemas (for aws) are obtained via Terraform and cached.

Actual Behavior

No schema was obtained due invalid config, making completion impossible for any provider in any part of the config.

Steps to Reproduce

  1. Open a folder in IDE with the above config
  2. Open file with the above config from that folder
  3. Trigger autocompletion anywhere in that file

Scope

This issue affects users which start (i.e. in LSP's terms initialize the folder) with invalid config, but shouldn't affect those which start with a valid one and make it invalid as part of editing it, since the schema would already be cached.

Proposal

Once hashicorp/terraform#24261 is addressed then LS could be getting schemas for all providers regardless of what the config's shape is and whether it's even valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant