-
Notifications
You must be signed in to change notification settings - Fork 180
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
Unable to find definitions or declarations in many cases #990
Comments
Hi @johnkeates
Nested expressions, such as
Lack of completion items which require knowledge of state is a known issue described in #734 or #652 - this would affect case like this
Can you be a bit more specific here about the setup? I am aware that we don't explicitly resolve symlinks in the language, as mentioned in hashicorp/terraform-ls#241 but I would be curious about the context in which this is causing you issues - i.e. where do you create a symlink in your hierarchy and where does it point to?
These should work as long as the modules are installed, i.e. you ran Screen.Recording.2022-03-14.at.15.37.42.movWe generally can't provide go-to-definition for remote modules until these are installed since there's nowhere to "go" (no files available locally to point to). However we do plan to index local modules even when these are not installed and provide all relevant functionality you see above. See more at hashicorp/terraform-ls#724 and hashicorp/terraform-ls#598 Aside from that for remote modules hosted in the Registry we plan to provide input and output completion, which is described in hashicorp/terraform-ls#599
Can you be more specific about what you mean here and how does it differ from "cross-module declarations"?
We implemented this recently as part of hashicorp/terraform-ls#727 which will be available in the upcoming release of LS and extension planned to be released likely this week. You can also try it out early via our preview extension https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform-preview It is unclear to me why this completion here doesn't bring all 4 documented attributes ( That I would expect to work as there is no remote state involved, unlike in my example above. A side note on your configuration, availability_zone = data.aws_availability_zones.available.names[count.index] which has the exact same meaning as it had in older versions of the language. |
Hi @radeksimko thank you for your extensive reply! I'll try to get some code anonymised and make screen recordings to show the effects I was writing about. Technically this is a bit of a compound issue which is not great form a ticket perspective, but if it turns out they are really separate issues it might be best to split it out (the ones you referred are indeed what I was looking for but couldn't find initially). As for the initialisation, I do work on active environments so the modules are all available in .terraform, and navigation (which is broken in different ways) in IntelliJ does work. |
I have opened a separate issue for the problem I was confused about above: hashicorp/terraform-ls#830 @johnkeates Is there any other problem you ran into which we don't track yet? If not, I'd like to close this issue and recommend subscribing to the individual ones which are also more easily addressable for us from maintenance perspective. |
@radeksimko Yes, there are a few other issues but I'll have to check with the existing ones to see if they are tracked with different descriptions. Right now life and work are getting in the way a little but I think closing this one in favour of more specialised individual issues is the best way to keep moving. |
@johnkeates If you say it's valid syntax then I'm guessing this one may be covered under hashicorp/terraform-ls#583 Can you check what's the variable type of variable "argocd_helm_release" {
type = object({
namespace = string
})
} |
I'm going to close this issue as I believe the underlying root causes are covered in other mentioned issues, namely:
If there is something that isn't covered, feel free to open a new issue and describe what it is there - we'd be happy to take a look. |
I have faced some cases that happens too, for example
the tooling help me to see the structure of many_configs, but when I have already added some, it doesnt work anymore no more smart auto complete =( if I hover, it shows the definition, but would be nice the completion for the properties of the object |
@AlbertoMonteiro This is a known issue we generally track under #641 or more specifically under hashicorp/terraform-ls#496 |
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. |
Issue Description
Unable to find definition or declaration
Environment Information
Terraform Information
Version: 1.1.5
Platform: darwin_amd64
Outdated: true
.vscode/extensions/hashicorp.terraform-2.20.0/bin/terraform-ls version
:0.25.2
platform: darwin/amd64
go: go1.17.5
compiler: gc
Visual Studio Code
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
Extension Logs
The HCL looks like this:
Hovering or navigating to usage/definition/declaration doesn't work in most cases and simply reports that it cannot be found. It can find Data Source Type
aws_availability_zones
but hoveringdata.aws_availability_zones.available.names
doesn't do anything, neither does navigating to the declaration ofdata.aws_availability_zones.available
.Typing
data.aws_availability_zones.av
doesn't yield autocompletion fordata.aws_availability_zones.available
either. It can dodata.aws_avail
and completedata.aws_availability_zones
but beyond that it's no use.Other things it can't find:
I've tried to find out if there is a list of known issues for finding usages/definitions but there doesn't seem to be a detailed "it does not cross this type of boundary" list of things it tries to resolve.
Example of a variable that is filled by tfvars:
variables.tf
environment.auto.tfvars
Can't navigate in either direction via references/declaration.
The text was updated successfully, but these errors were encountered: