question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide opt out config option for ref count code lens

See original GitHub issue

Use Cases

The most recent versions of the extension and LS introduced code lens for displaying reference counts above top level blocks and attributes.

While many users may find this useful, some may find it distracting or just generally may not want it (https://github.com/hashicorp/terraform-ls/pull/584#issuecomment-891190519) and it would be useful if these users have a way of opting out of this code lens.

Proposal

Introduce a new config option enableReferenceCountCodeLens (defaulting to true) which will prevent the client from registering the relevant feature

https://github.com/hashicorp/vscode-terraform/blob/b3d812edd5ec334f5c42e7df109cef50dd32b5ac/src/clientHandler.ts#L181

and as a result prevent the relevant client capability to be sent to the server, which would in turn prevent it from sending the code lens back.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
jpograncommented, Sep 23, 2021

Hi @DoctorPolski and @abroun, thanks for the feedback. The CodeLens functionality placement is decided by VS Code, not our extension. This VS Code issue describes their rationale for not giving an option on placement or display. Unfortunately that is out of our hands.

The good news is, if you do not want any CodeLens displayed in any Terraform file right now, you can do so now with setting a language specific editor option:

"[terraform]": {
    "editor.codeLens": false
  },

This is a useful way to set editor settings per language, so each extension behaves as you desire without affecting other languages.

Alternately, if you do not want to see any CodeLens for anything ever, you can set the following without a language filter:

"editor.codeLens": false

In the longer term, it is common for extensions to create settings per CodeLens feature they add, so we will continue to look into that as we fill out the CodeLens functionality. There are more accelerators that we can add to the CodeLens line than just reference count.

3reactions
DoctorPolskicommented, Aug 9, 2021

Please, please, please.

Further, I feel such a potentially “invasive” feature should never have been implemented without the option to disable it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable codelens in VS code? - Stack Overflow
Go to File > Preferences > Settings; Under drop-down Text Editor , search for Code Lens and disable it.
Read more >
Why can I not disable the Codelens show references
it looks like only way to make reference go away is turning off codelens completely from options. go to option page and search...
Read more >
Reference count for functions - Rider Support | JetBrains
I noticed the gray part. I would like to see a ref count. This would allow me to to figure out how "hard"...
Read more >
CodeLens reference count is not shown for const fields #32320
Look at the const declaration. Expected Behavior: The const should show how many (count of total) references in the C# project. Actual Behavior:...
Read more >
Hide Codelens in Visual Studio - YouTube
Remove Reference Counts in VS Code | Hide Codelens in Visual Studio | Turn Off Codelens This is a Short Video on-How to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found