-
Notifications
You must be signed in to change notification settings - Fork 182
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
Valid tfvars found in sub-directories of root configuration reporting as incorrect syntax #1628
Comments
Hi @pro-krastinator Can you check the bottom bar for some more details? Specifically:
Ideally it should match what you see above, assuming this is on On a related note, can you double check for any custom |
Yes @radeksimko , you are right, most probably the cause was the line in my settings: version of the language server running and language ID chosen/detected for the file: I've forgot I've put it there having older version of
I guess, this issue can be closed if you do not need to add anything in regards, just for other community members who might be searching about the same issue. |
I would still suggest you avoid any manual associations of any files (including The reason is that AFAICT in VS Code there's no way to tell what exact features you expect to receive for those file types and so what it will attempt to do is to provide all features that go far beyond just highlighting. That includes completion, hover, go-to-definition, diagnostics etc. - and pretty much everything other than syntax highlighting will not be relevant and can even be wrong - just like what you saw with Until we build the support for template files (#636) the best solution is:
"files.associations": {
"*.tftpl": "hcl"
} That HCL extension does not make any assumptions about block or attribute names (unlike the Terraform one) and only provides basic syntax highlighting, which is probably the main feature you're looking for right now anyway. |
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. |
Extension Version
v2.29.0
VS Code Version
Version: 1.84.2 (user setup)
Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
Date: 2023-11-09T10:51:52.184Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045
Operating System
Edition: Windows 10 Enterprise, Version: 22H2, Build: 19045.3570
Terraform Version
Terraform v1.5.7 on linux_amd64
Steps to Reproduce
The issue is similar to the closed #1574
nonprod/terraform.tfvars
valid tfvars file reporting as having incorrect syntax;
Expected Behavior
Valid HCL tfvars aren't highlighted.
Actual Behavior
Error;
Unexpected attribute: An attribute named "test" is not expected here Terraform
Terraform Configuration
file
nonprod/terraform.tfvars
Project Structure
. ├── nonprod │ └── terraform.tfvars ├── output.tf └── prod └── terrafrom.tfvars 2 directories, 3 files
Gist
No response
Anything Else?
No response
Workarounds
Dragging and dropping tfvars into root directory appear to work, syntax highlighting seems to behave as expected.
Reverting to previous version of extension 2.27.2
References
Help Wanted
Community Note
The text was updated successfully, but these errors were encountered: