vscode-terraform: Toggle Line Comment not working
The “Toggle Line Comment” editor.action.commentLine is broken. (key combo in MacOS: cmd /)
It works with other formats (yaml, json, c++, shell, etc) but its not (no longer?) working with Terraform files.
VSCode Terraform Plugin Version: 2.2.2
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 26
- Comments: 28 (7 by maintainers)
Same issue here
This issue is still present, but I discovered an odd workaround for it earlier today. If you install the HCL extension, you’ll get the ability to comment back but it will be with
//rather than#. You’ll notice at this point that your tf files show as type “HCL” in the bottom right.If you change the file type back to “Terraform”, the old commenting shortcut works again and uses
#like before.No idea why this works, but it does. If you uninstall the HCL extension, the shortcut stops working again.
Disable/enable the plugin was enough for me
Hi, it is fixed now, close if you want.
But please note I had to follow the “downgrade-upgrade version” steps similar to what Eric described since my first attempt to install it “from cero” didn’t worked: 1- uninstal extension/plugin (vscode will restart/refresh) 2- install latest (v2.2.2) terraform plugin/extension, 3- try a TF file, not working 4- downgrade to extension v2.2.1 (vscode restarts/refreshes itself) 5- confirmed, toggle comments work 6- upgrade to v2.2.2 (vscode restarts/refreshes itself) 7- try again toggle comment line in a TF file, it works!
Maybe it was a leftover from my previous upgrade/downgrade attempts when the highlighting was broken in v2.1.1+ (went down in versions one by one to 2.1.0 since highlighting was working on that one)
Anyway, thanks a lot for the help, specially to Eric since without that downgrade step I guess I would had required to reinstall vscode fully 😃
Broken again with vscode 1.65.0. Edit: actually it’s Ansible extension.
can confirm that vscode Version: 1.56.2 (Version: 1.56.2 on OS: Darwin x64 18.7.0 ) with hashicorp.terraform extension (v2.11.0) it also stopped working after upgrading language server.
I didn’t need to downgrade, just uninstall and install the extension again, and block comment (cmd+/) started to work again.
Also facing this issue from time to time. Just found out that simple Disable-(Reload)-Enable the Terraform plugin helps.