Skip to content

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

Closed

Description

Is there a way to turn this off? Thanks!

Activity

  1. daviwil commented on Jun 26, 2017

    @daviwil
    Contributor

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

  2. rkeithhill commented on Jun 26, 2017

    @rkeithhill
    Contributor

    Bill Stewart (@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
    }
    
  3. daviwil commented on Jun 26, 2017

    @daviwil
    Contributor

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

  4. Bill-Stewart commented on Jun 26, 2017

    @Bill-Stewart
    Author

    Thanks Keith Hill (@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).

  5. Bill-Stewart commented on Jun 26, 2017

    @Bill-Stewart
    Author

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

  6. rkeithhill commented on Jun 26, 2017

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

  7. Bill-Stewart commented on Jun 27, 2017

    @Bill-Stewart
    Author

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

  8. daviwil commented on Jun 27, 2017

    @daviwil
    Contributor

    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.

  9. Bill-Stewart commented on Jun 27, 2017

    @Bill-Stewart
    Author

    Sure, that workaround is fine for now. Thanks!

  10. mattmcnabb commented on Jun 27, 2017

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

  11. removed this from the June 2017 milestone on Jul 11, 2017
  12. 6 remaining items

  13. TylerLeonhardt commented on Apr 26, 2019

    @TylerLeonhardt
    Member

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

  14. musm commented on Apr 26, 2019

    @musm

    Can you add the option

    "powershell.referencesCodeLens.enabled": true

    so only references are disabled?

  15. TylerLeonhardt commented on Apr 26, 2019

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

  16. rkeithhill commented on Apr 27, 2019

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

  17. AltitudeApps commented on Aug 30, 2020

    @AltitudeApps

    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.

  18. ghost added
    Needs: Maintainer Attention
    on Aug 30, 2020
  19. removed this from the milestone on Jan 26, 2021
  20. fflaten commented on Feb 12, 2023

    @fflaten
    Contributor

    This should now be fixed by #4139

  21. andyleejordan commented on Feb 13, 2023

    @andyleejordan
    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!)

  22. andyleejordan commented on Feb 13, 2023

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

  23. ghost closed this as completedon Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-ConfigurationIssue-EnhancementResolution-Fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions