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

Go to References not working case #592

Closed
Chupaka opened this issue Jul 23, 2021 · 6 comments · Fixed by #596
Closed

Go to References not working case #592

Chupaka opened this issue Jul 23, 2021 · 6 comments · Fixed by #596
Labels
bug Something isn't working textDocument/references

Comments

@Chupaka
Copy link

Chupaka commented Jul 23, 2021

Server Version

terraform-ls 0.19.1

Terraform Version

Terraform v1.0.2
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v3.75.0

Client Version

VS Code 1.58.2
HashiCorp Terraform v2.13.1

Terraform Configuration Files

variable "test2" {
  default = "mynameis"
}

resource "google_compute_instance" "checking" {
  name = "test"
  machine_type = "fake"
  network_interface {}
  boot_disk {
    initialize_params {
      image = "img"
    }
  }

  metadata = {
    "startup-script" = var.test2
  }
}

Log Output

2021/07/23 15:03:27 server.go:591: Received 1 new requests
2021/07/23 15:03:27 server.go:175: Processing 1 requests
2021/07/23 15:03:27 server.go:266: Checking request for "textDocument/references": {"textDocument":{"uri":"file:///Users/pavel.skuratovich/tmp/go-to-reference/file1.tf"},"position":{"line":1,"character":11},"context":{"includeDeclaration":true}}
2021/07/23 15:03:27 rpc_logger.go:29: Incoming request for "textDocument/references" (ID 36): {"textDocument":{"uri":"file:///Users/pavel.skuratovich/tmp/go-to-reference/file1.tf"},"position":{"line":1,"character":11},"context":{"includeDeclaration":true}}
2021/07/23 15:03:27 provider_schema.go:196: PSS: getting provider schema (/Users/pavel.skuratovich/tmp/go-to-reference, registry.terraform.io/-/google, )
2021/07/23 15:03:27 references.go:60: finding origins for inner-most target: &lang.ReferenceTarget{Addr:lang.Address{lang.RootStep{Name:"var"}, lang.AttrStep{Name:"test2"}}, ScopeId:"variable", RangePtr:(*hcl.Range)(0xc00863b1c0), Type:cty.String, Name:"", Description:lang.MarkupContent{Value:"", Kind:0x0}, NestedTargets:lang.ReferenceTargets(nil)}
2021/07/23 15:03:27 rpc_logger.go:50: Response to "textDocument/references" (ID 36): []
2021/07/23 15:03:27 server.go:247: Completed 1 requests [2.717054ms elapsed]

Steps to Reproduce

Click line 1-3 and select "Go to References"

Expected Behavior

Jump to line 16 (n"startup-script" = var.test2)

Actual Behavior

No references found for 'test2'

Linked issues

#585

@radeksimko
Copy link
Member

Thank you for the detailed repro case, as usual @Chupaka

I just merged a fix in #596 which will be shipped early next week.

@Chupaka
Copy link
Author

Chupaka commented Jul 30, 2021

@radeksimko looks like v0.20 broke something, as now the var in "startup-script" = var.test2 not even highlighted when I press Cmd. And it is highlighted in other places of code (for example, when I change name = "test" to name = var.test2)

@radeksimko
Copy link
Member

That is possible - there were some changes in how the expressions are parsed, (ironically) making it a more accurate - which in combination with collection of references being inaccurate caused mismatch of types and the reference not being recognized.

That should be fixed in the next release coming early next week.

@radeksimko
Copy link
Member

0.20.1 was just released and should address both mentioned issues.

@radeksimko radeksimko removed their assignment Aug 5, 2021
@Chupaka
Copy link
Author

Chupaka commented Aug 5, 2021

Yep, it does! Now terraform-ls looks perfect for me, thanks @radeksimko!

@github-actions
Copy link

github-actions bot commented Sep 5, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working textDocument/references
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants