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

Resolve issue with tfvars comment toggling #937

Merged
merged 3 commits into from
Feb 14, 2022
Merged

Conversation

NachoxMacho
Copy link
Contributor

This fixes a bug with comment toggling found while I was using the extension. Basically, if a user opens a *.tfvars first, it breaks the comment toggling in *.tfvars files till the session is reloaded. This adds the explicit mapping to the configuration files, and activates the extension once a *.tfvars file is opened, and doesn't rely on a *.tf file to be loaded first.

Resolves #936 and may be related to #480

@hashicorp-cla
Copy link

hashicorp-cla commented Feb 11, 2022

CLA assistant check
All committers have signed the CLA.

@radeksimko radeksimko added enhancement New feature or request syntax labels Feb 11, 2022
@jpogran
Copy link
Contributor

jpogran commented Feb 11, 2022

Thank you @NachoxMacho for this! We've been tracking similar reports but did not make the connection to tfvar files specifically.

Can you adjust the whitespace indents for this change to 2 spaces and push up those changes? If you can't, I'll push up the change later.

@NachoxMacho
Copy link
Contributor Author

Thank you @NachoxMacho for this! We've been tracking similar reports but did not make the connection to tfvar files specifically.

Can you adjust the whitespace indents for this change to 2 spaces and push up those changes? If you can't, I'll push up the change later.

Not sure I'm following, I'm showing indentation at 2 spaces in my vscode session, and everything is appearing lined up. Am I missing something?

@jpogran
Copy link
Contributor

jpogran commented Feb 11, 2022

If you look at the git diff, it shows the difference in spacing:

image

If I run npm run format in the project (which runs prettier) or use the VS Code Format Document option, I get:

image

And if I amend those changes onto your commit, I get only the lines your changed showing:

image

If this doesn't work for you locally, there could be an editor setting or git config setting that is overriding spacing. I'm happy to adjust it, this shouldn't block adding your welcome addition.

@NachoxMacho
Copy link
Contributor Author

If you could adjust it, that would be great. I'm not getting any output from git diff so I'm guessing somewhere I have it configured to ignore whitespace changes like this. I'll take a look at it but don't want to hold up these changes on me figuring out my weird settings.

@jpogran
Copy link
Contributor

jpogran commented Feb 11, 2022

Done! Took a little longer because you opened this PR from main on your fork. It's easier if you create a branch, commit there, then open a PR from that branch, but no worries. Thanks again!

Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with an empty folder, created a new tfvars file. Once file was created, extension activated and comment functionality was available

@jpogran jpogran merged commit f38e8dc into hashicorp:main Feb 14, 2022
@jpogran
Copy link
Contributor

jpogran commented Feb 14, 2022

Thank you for the contribution!

@jpogran jpogran removed the syntax label Feb 14, 2022
@jpogran jpogran added this to the 2.20.0 milestone Feb 22, 2022
@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 Mar 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toggle Comment broken on tfvars files
4 participants