Vscode-terraform: Toggle Comment not working

Created on 19 Oct 2020  路  11Comments  路  Source: hashicorp/vscode-terraform

I'm not sure what happened but the Toggle Comment keyboard shortcut does not seem to be working. I've confirmed that it's limited to this particular plugin by uninstalling it and reinstalling it and it not working, while trying other Terraform plugins and them working correctly. I've also tried physically deleting the entire plugin folder from ~/.vscode/extensions folder to ensure that there weren't any stragglers from old versions, and I've also made sure that there were no plugin-specific settings in the settings.json being set.

Has anyone seen this before?

bug

All 11 comments

Update: sometimes completely deleting the hashicorp-terraform-<ver> folder from ~/.vscode/extensions does the trick for a while, but then it stops working again after some random number of days.

I confirm the above. In order to re-enable toggle comments on TF file I had to do both:

  • delete: ~/.vscode/extensions/hashicorp-terraform-<ver>
  • reinstall the plugin

Sorry you're seeing that behavior! Can you tell us what version you have for VSCode and the extension?

hashicorp.terraform-2.3.0

Happening to me as well, VSCode v1.53.0, Hashicorp Terraform 2.6.0.

Comment toggle works fine with other files I've tried (py, md, tpl), just doesn't work with .tf/.tfvars files since I updated to 2.6.0.

I tried downgrading to an older version and it didn't fix the issue.

Prior to today, I could remove/re-add when it crashed, but I'm not sure what happened but since the update to VSCode March 2021 (1.55.2) and version 2.10.0 of the extension, even removing and re-adding doesn't work any more.

Just to make sure we're looking at all the possibilities: what platform are you running VSCode on? and do you have anything like editor.autoClosingQuotes or editor.autoClosingBrackets in your settings?

Also, does this issue still happen if you disable the language server? ("Terraform: Disable Language Server" in the command palette)

In order:

  1. OS: macOS Big Sur 11.2.3
  2. Those settings don't exist in my settings
  3. Disabling the language server does seem to solve the problem, but then after re-enabling it, the issue stays resolved; I'm not sure what disabling and re-enabling it did but it would appear that the act of doing so resets something else?

I noticed this is not just a shortcut issue or keybinding; The toggle block / line comment does not work from the vscode Edit menu option neither.

I too am experiencing this. It's not just the keyboard binding, it's also the Edit-->Toggle Line Comment option in the UI. This seems to suggest that that tfvar and tf files aren't registered with the function that these options call within the vscode editor (editor.action.commentLine) to use the "#" comment, but I'm more of an ops person so take that with a grain of salt.

Platform:

Hashicorp Terraform Extension: 2.10.2

VSCode/Operating Environment:
Version: 1.56.2 (user setup)
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:13:13.157Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.19042

Also another update: disabling the language server and re-enabling it used to work but now with one of the most recent updates, it no longer does. I have to go manually remove the full Terraform extension folder from ~/.vscode/extensions and then reinstall it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kagarlickij picture kagarlickij  路  5Comments

vazkarvishal picture vazkarvishal  路  5Comments

jacobisaliveandwell picture jacobisaliveandwell  路  3Comments

meysholdt picture meysholdt  路  5Comments

QuinnStevens picture QuinnStevens  路  6Comments