Open crazyoptimist opened 1 month ago
Hi @crazyoptimist! Thanks for the report. Unfortunately I can't reproduce the bug.
Can you please share the full language server log output? Does this bug occur all the time when you open the file?
It's that simple example. And here's my variables.tf:
variable "namespace" {
description = "Project naming prefix"
type = string
default = "dev"
}
I think above things are better than language server log, and I don't know how I can grab the server log yet. I use terraform-ls.exe on windows, with vim 9.1 and coc.nvim.
Thank you!
An interesting thing is that if I open the variables.tf on a vim's split window, the error goes away. Afterwards, even if I close the variables.tf buffer, the error doesn't appear again.
The error is reproduced when I shutdown vim and reopen the file.
Even if I open both file buffers, the error persists unless I open them on the same screen using split windows (using :split
command).
Interesting find, thank you.
You can write the language server log to a file by passing an additional argument in your coc.vim configuration: https://github.com/hashicorp/terraform-ls/blob/main/docs/TROUBLESHOOTING.md#logging-to-files
Attached is a minimal log file. I believe you can ignore Error: Backend initialization required, please run "terraform init"
, because I originally found it when I ran it. Now I've moved to another machine and can't find the same error on Mac/Linux.
Thank you for your guidance on logging!
Language Server Version
0.33.1
Terraform Version
Terraform v1.8.4 on windows_amd64
Client Version
Vim (coc.nvim) 9.1
Terraform Configuration
Steps to Reproduce
variables.tf
and define a variablenamespace
of string type.terraform init
andterraform apply -auto-approve
Expected Behavior
It should not complain because it's not a bug at all.
Actual Behavior
terraform-ls complains
No declaration found for "var.namespace" (Terraform)
It shows up as an error.
Gist
No response
Workarounds
No workarounds I can find.
References
No response
Help Wanted
Community Note