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

Toggle Line Comment not working #480

Closed
Helmut-Onna opened this issue Aug 27, 2020 · 28 comments
Closed

Toggle Line Comment not working #480

Helmut-Onna opened this issue Aug 27, 2020 · 28 comments
Labels
bug Something isn't working extension-only

Comments

@Helmut-Onna
Copy link

Helmut-Onna commented Aug 27, 2020

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

@ericmacfarland
Copy link

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

@aeschright
Copy link
Contributor

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

@aeschright aeschright added the bug Something isn't working label Aug 27, 2020
@ericmacfarland
Copy link

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?

@Helmut-Onna
Copy link
Author

Helmut-Onna commented Aug 28, 2020

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

@ericmacfarland
Copy link

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.

@appilon
Copy link
Contributor

appilon commented Sep 2, 2020

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:
microsoft/vscode#98110

@aeschright
Copy link
Contributor

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 aeschright reopened this Sep 2, 2020
@eytanhanig
Copy link

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.

@kdeyko
Copy link

kdeyko commented Jan 22, 2021

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

@jamesongithub
Copy link

jamesongithub commented Jan 26, 2021

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

@ghost
Copy link

ghost commented Feb 17, 2021

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.

@okonon
Copy link

okonon commented Mar 3, 2021

Same issue here

@tikicoder
Copy link

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

@bugre
Copy link

bugre commented May 28, 2021

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.

@tia-whiteaway
Copy link

Disable/enable the plugin was enough for me

@stv-io
Copy link

stv-io commented Jun 8, 2021

Disable/enable the plugin was enough for me

same

@Zauxst
Copy link

Zauxst commented Jun 11, 2021

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

@LaurentLesle
Copy link

LaurentLesle commented Jul 2, 2021

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

@radeksimko
Copy link
Member

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.

@greystitch
Copy link

@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

@jpogran
Copy link
Contributor

jpogran commented Aug 19, 2021

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.

@aj-cruz
Copy link

aj-cruz commented Dec 16, 2021

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

@jacoor
Copy link

jacoor commented Dec 21, 2021

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

@Sispheor
Copy link

Sispheor commented Mar 4, 2022

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

@radeksimko
Copy link
Member

@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.

@Sispheor
Copy link

Sispheor commented Mar 4, 2022

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

@radeksimko
Copy link
Member

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 #692

If folks are aware of a specific extension which causes this issue we'd appreciate a comment in #692

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

@radeksimko radeksimko closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2023
@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators May 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working extension-only
Projects
None yet
Development

No branches or pull requests