Provide opt out config option for ref count code lens
See original GitHub issueUse 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
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:
 - Created 2 years ago
 - Reactions:5
 - Comments:5 (1 by maintainers)
 
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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:
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:
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.
Please, please, please.
Further, I feel such a potentially “invasive” feature should never have been implemented without the option to disable it.