Skip to content

Disable "n reference(s)" display for functions #924

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

Closed
Bill-Stewart opened this issue Jun 26, 2017 · 20 comments
Closed

Disable "n reference(s)" display for functions #924

Bill-Stewart opened this issue Jun 26, 2017 · 20 comments
Labels
Area-Configuration Issue-Enhancement A feature request (enhancement). Resolution-Fixed Will close automatically.

Comments

@Bill-Stewart
Copy link

Is there a way to turn this off? Thanks!

@daviwil
Copy link
Contributor

daviwil commented Jun 26, 2017

Not currently, but I'll add a setting for it.

@daviwil daviwil added this to the June 2017 milestone Jun 26, 2017
@rkeithhill
Copy link
Contributor

@Bill-Stewart If you want to turn off all code lens support in PowerShell scripts, then you can do that now with your user settings. Press Ctrl+, and add this to the end e.g.:

"[powershell]": {
    "editor.codeLens": false
}

@daviwil
Copy link
Contributor

daviwil commented Jun 26, 2017

Thanks Keith! Didn't know there was a switch at the editor level :)

@Bill-Stewart
Copy link
Author

Thanks @rkeithhill - I don't want to disable all of code lens - just the references thing on functions that takes up vertical screen real-estate and creates a strange editing experience (weird line height on function lines).

@Bill-Stewart
Copy link
Author

Thanks @daviwil - If we can turn off that display, that would be great!

@rkeithhill
Copy link
Contributor

So does that mean you want the Run Tests | Debug Tests code lens disabled as well? These take up vertical screen real-estate. Just trying to understand the ask because the extension adds more than one type of code lens (function references and Pester test run/debug support).

I don't want to disable all of code lens

Do you mean for PowerShell or for all languages? If you meant "all languages" then the setting I showed above disables code lens just for PowerShell scripts. Then again, if you use say GitLens then you wouldn't get the Git commit info code lens. Of course, if you have any code lens enabled it will occupy the same amount of vertical space.

@Bill-Stewart
Copy link
Author

Bill-Stewart commented Jun 27, 2017

I meant just the part that says "n reference(s)" under the function name. It creates distracting screen jumping when cursoring past them up or down, particularly in RDP (and I use vscode in RDP quite a bit).

@daviwil
Copy link
Contributor

daviwil commented Jun 27, 2017

If you use the setting that Keith gave you, those things will disappear. Keith was referring to another set of those items that show up over Pester tests, but you probably wouldn't want to see those either since they would take up the same screen real estate. I'd say using Keith's setting would be the most expedient approach to disable them right now until we can add one to the extension.

@Bill-Stewart
Copy link
Author

Sure, that workaround is fine for now. Thanks!

@mattmcnabb
Copy link
Contributor

See this feature request for VSCode

I love CodeLens, but I wish that it offered a different way to display the markers - it does feel a bit clumsy sometimes when these things interrupt your code's visual flow.

@daviwil daviwil modified the milestones: June 2017, July 2017 Jul 11, 2017
@daviwil daviwil modified the milestones: July 2017, Future Oct 26, 2017
@musm
Copy link

musm commented Apr 26, 2019

I was searching for this issue, since I too find them insanely distracting. So is the work around still

"[powershell]": {
    "editor.codeLens": false
}

@TylerLeonhardt
Copy link
Member

It should be. If you're experiencing trouble, please let us know.

@musm
Copy link

musm commented Apr 26, 2019

Can you add the option

"powershell.referencesCodeLens.enabled": true

so only references are disabled?

@TylerLeonhardt
Copy link
Member

Yes, that is something that can be added - and based on the history that seems to be what this issue is tracking.

I can't say that it's the highest priority issue right now though but it's something we should add.

@rkeithhill
Copy link
Contributor

Sounds reasonable to me but I'd prefer a setting name like powershell.codeLens.ReferenceProvider.enabled or something like that. That way, if we were to add more code lens settings, they'd sort together.

@AltitudeApps
Copy link

This class of issues regarding how code lens tampers with the presentation and layout of the user's document has been going on for years, even preceding the existence of VSCode. For example:

developercommunity.visualstudio.com - Why can I not disable the Codelens show references circa 2017
StackExchange - How to turn off CodeLens-References - circa 2013 circa 2013

There is a (relatively) recent issue posted in the VSCode repo: microsoft/vscode#90235 , which has links back to other tickets where this persistently recurring topic has been discussed, going as far back as 2017. (If not earlier, but that is as far back as I've found so far.)

I find this feature to be unbelievably irritating, in spite of its inherent usefulness. I have just "switched it off" completely for years. But I just recently started working on a box where I haven't worked before, and after I installed the C# extension, the "code-lens references" issue popped up again, and has been plaguing me for days. Now I'm seeing it in PowerShell. I must have disabled it completely years ago on my other setups, because I don't ever remember seeing code-lens happening in any of my PowerShell editing. (And I have a lot, going back years.)

I don't want to just turn the whole thing off, but that's what I've done just now. Because sanity.

In any case, the problem is harder than it looks, as discussed here: microsoft/vscode#23652 (comment) , but I wanted to let this audience know that the larger discussion about how this problem might be tackled may be starting up again here: microsoft/vscode#90235 , and in particular I wanted to draw attention to @baybal's intriguing suggestion here: microsoft/vscode#73413 (comment)

1

By the way, I found this thread via a search: https://www.google.com/search?q=%22powershell%22+turn+off+codelens , which I did in frustration after having been able to turn off the code-lens references in C# yesterday, but upon opening a .ps1 file today... Arrghh! There it is again !!

My rather involved thoughts on the topic can be found in this comment: microsoft/vscode#90235 (comment) , where I basically applaud @baybal's mockups, but suggest that the gutter for code-lens should be on the right, with the other cues about information which is semantic in nature.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Aug 30, 2020
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Sep 1, 2020
@SydneyhSmith SydneyhSmith removed this from the Future milestone Jan 26, 2021
@fflaten
Copy link
Contributor

fflaten commented Feb 12, 2023

This should now be fixed by #4139

@andyleejordan andyleejordan added the Resolution-Fixed Will close automatically. label Feb 13, 2023
@andyleejordan
Copy link
Member

Use the setting powershell.enableReferencesCodeLens to disable code lenses for just the PowerShell extension (but also, try them out again, they're much faster now!)

@andyleejordan
Copy link
Member

Sounds reasonable to me but I'd prefer a setting name like powershell.codeLens.ReferenceProvider.enabled or something like that. That way, if we were to add more code lens settings, they'd sort together.

Keith I just want you to know you're right, that would have been a much better name and I wish I'd seen this.

@ghost ghost closed this as completed Feb 13, 2023
@ghost
Copy link

ghost commented Feb 13, 2023

This issue has been marked as fixed. It has been automatically closed for housekeeping purposes.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Configuration Issue-Enhancement A feature request (enhancement). Resolution-Fixed Will close automatically.
Projects
None yet
Development

No branches or pull requests

10 participants