vscode-terraform icon indicating copy to clipboard operation
vscode-terraform copied to clipboard

Toggle Line Comment not working

Open Helmut-Onna opened this issue 5 years ago • 26 comments
trafficstars

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

Helmut-Onna avatar Aug 27 '20 10:08 Helmut-Onna

I'm encountering this issue with v2.2.2 as well. I rolled my extension back to v2.2.1 and "Toggle Line Comment" starts functioning again, so the problem appears to have been introduced with v2.2.2

VSCode 1.48.1 MacOS 10.15.2

ericmacfarland avatar Aug 27 '20 16:08 ericmacfarland

Hi! Sorry you're seeing this behavior. We're having trouble reproducing it with a default configuration – could you share your settings files?

aeschright avatar Aug 27 '20 20:08 aeschright

Hmmm, I reinstalled v2.2.2 just now and the issue appears to have resolved itself! @Helmut-Onna does the issue still occur for you?

ericmacfarland avatar Aug 28 '20 15:08 ericmacfarland

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 :)

Helmut-Onna avatar Aug 28 '20 16:08 Helmut-Onna

I just experienced the issue again, immediately after updating the language server. The same downgrade-then-upgrade approach resolved the issue, but I'm curious about why the LS update caused the issue.

ericmacfarland avatar Sep 02 '20 13:09 ericmacfarland

May have been related, also seemed to involve terraform, would suggest whatever bug this is (whether be in the plugin, or upstream vscode) it has maybe been around since May: https://github.com/microsoft/vscode/issues/98110

appilon avatar Sep 02 '20 18:09 appilon

Hi @ericmacfarland – would you be willing to file a bug upstream on the VSCode project? We'll keep looking for something on our end as well.

aeschright avatar Sep 02 '20 19:09 aeschright

Uninstalling and reinstalling fresh worked for me.

I was very close to completely ditching this plugin before I found this GitHub issue. Thanks @ericmacfarland for your suggestion.

eytanhanig avatar Sep 14 '20 01:09 eytanhanig

Also facing this issue from time to time. Just found out that simple Disable-(Reload)-Enable the Terraform plugin helps.

kdeyko avatar Jan 22 '21 08:01 kdeyko

none of disable-reload-enable or reinstalling or downgrade/upgrade worked for me.

only seems to be terraform files for me. other files work fine.

image

extension version 2.5.0

jamesongithub avatar Jan 26 '21 20:01 jamesongithub

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.

ghost avatar Feb 17 '21 16:02 ghost

Same issue here

okonon avatar Mar 03 '21 20:03 okonon

Once I updated to VS 1.55.2 ctrl + / started working for me.

tikicoder avatar Apr 16 '21 22:04 tikicoder

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.

bugre avatar May 28 '21 13:05 bugre

Disable/enable the plugin was enough for me

tia-whiteaway avatar Jun 03 '21 12:06 tia-whiteaway

Disable/enable the plugin was enough for me

same

stv-io avatar Jun 08 '21 15:06 stv-io

I just encountered this problem. A reinstall worked fine using the developer tools to reinstall extensions.

Zauxst avatar Jun 11 '21 21:06 Zauxst

Same issue here. Switching back to 4ops.terraform fixes the toggle issue

LaurentLesle avatar Jul 02 '21 03:07 LaurentLesle

Hi folks, It is known that VS Code unfortunately doesn't always handle conflicts well when multiple extensions claim the same file type and there some possibility that this problem may be caused by a combination of particular extensions which all claim *.tf files.

If you have any other extensions supporting Terraform files - have you tried disabling those - if yes - were you still able to reproduce this?

We plan to investigate these conflicts also as part of #692

Can anyone reproduce the issue on the latest version (2.14.0) with the latest LS version (0.19.0) and with all other Terraform extensions (if any are installed) disabled? If so I'd be interested in setting up a debugging session with you or gathering more details.

radeksimko avatar Jul 27 '21 13:07 radeksimko

@radeksimko Can confirm that deleting another Terraform plugin and restarting VSCode fixes the issue. That another extension was just installed and disabled, but it seems it still was causing the conflict. VSCode version: 1.59.0 HashiCorp Terraform: v2.14.0

greystitch avatar Aug 19 '21 09:08 greystitch

I updated #692 with a setting you can configure to instruct VS Code which extension handles which language type. This can alleviate having multiple extensions that register for the same language type.

jpogran avatar Aug 19 '21 18:08 jpogran

This has happened to me twice now. First time I disabled, reloaded, and enabled the HashiCorp Terraform extension and that fixed it. 2nd time that wouldn't fix it, I downgraded, reloaded, upgraded, reloaded, and that fixed it. I'm on VS Code 1.63.1 & TF extension 2.17.0

aj-cruz avatar Dec 16 '21 16:12 aj-cruz

I am also having the issue. Works good in tf files, doesn't work in tfvars.

jacoor avatar Dec 21 '21 13:12 jacoor

Broken again with vscode 1.65.0. Edit: actually it's Ansible extension.

Sispheor avatar Mar 04 '22 14:03 Sispheor

@Sispheor do you mind providing a link to that extension? I'd just like to understand why would an Ansible extension cause a problem for Terraform files. Usually the conflicts we have seen were between extensions that claim the same file extensions or same language IDs.

radeksimko avatar Mar 04 '22 14:03 radeksimko

No no I meant that the issue doesn't come from this repo. It's the official Red Hat Ansible plugin.

Sispheor avatar Mar 04 '22 15:03 Sispheor

As discussed this is most likely caused by another extension, or rather conflict between different extensions, which is VS Code's (upstream) issue.

We do track more high-level efforts in this area as part of https://github.com/hashicorp/vscode-terraform/issues/692

If folks are aware of a specific extension which causes this issue we'd appreciate a comment in https://github.com/hashicorp/vscode-terraform/issues/692

Aside from that there's not much we can do within this extension unfortunately.

radeksimko avatar Apr 24 '23 16:04 radeksimko

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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar May 25 '23 03:05 github-actions[bot]