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

Intellisense completion for variable identifier replaces var.name with var.var.name #1791

Open
1 task
dustindortch opened this issue Jul 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@dustindortch
Copy link

dustindortch commented Jul 10, 2024

Extension Version

v2.31.0

VS Code Version

Version: 1.91.0
Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286
Date: 2024-07-01T18:53:23.353Z (1 wk ago)
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

Operating System

macOS Sonoma Version 14.5 (23F79)

Terraform Version

Terraform v1.8.5 on darwin_arm64

Steps to Reproduce

  1. Begin writing an expression
  2. Type "var." and the first few characters of a variable name (e.g. "na" for variable called "name")
  3. Press tab to accept autocomplete suggestion

Expected Behavior

Autocomplete yields "var.name"

Actual Behavior

Autocomplete yields "var.var.name"

Terraform Configuration

locals {
  lambdas = {
    for k, v in var.lambdas k => merge(
      v,
      {
        name = startswith(k, var.var.app_prefix) ? join("-", [k, var.environment]) : join("-", [var.app_prefix, k, var.environment])
      }
    )
  }
}

Project Structure

.
├── .github
│   ├── actions
│   │   ├── terraform_apply
│   │   ├── terraform_fmt
│   │   ├── terraform_install
│   │   ├── terraform_plan
│   │   └── terraform_validate
│   └── workflows
├── .gitignore
├── .terraform
│   ├── modules
│   └── providers
│       └── registry.terraform.io
│           └── hashicorp
│               └── aws
│                   └── 5.57.0
│                       └── darwin_arm64
│                           ├── LICENSE.txt
│                           └── terraform-provider-aws_v5.57.0_x5
├── .terraform.lock.hcl
├── README.md
├── main.tf
├── outputs.tf
├── terraform.tfstate
├── terraform.tfstate.backup
├── tfplan
└── variables.tf

Gist

No response

Anything Else?

terraform-docs v0.18
tfenv v3.0.0

I have had this issue for a couple of years and I get head nods from others when I talk about it. I was attributing this to GitHub Copilot, but I am getting the exact same issue on a Windows 10 system with a clean install of VS Code (with an OOB configuration), without GitHub Copilot.

This does not happen with other identifiers (i.e. local, module, each, etc.)

Workarounds

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@dustindortch dustindortch added the bug Something isn't working label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant