Skip to content

CodeLens on hover #26204

Closed
Closed

Description

@rezorrand
  • VSCode Version: Version 1.12.1 (1.12.1)
  • OS Version: macOS Sierra 10.12.4 (16E195)

CodeLens could be on-demand, instead of always showing all references to all items, the references view could be shown on mouse over instead, or at least have an option for mouse over. Now view feels very cluttered with it, but needs unnecessary steps if it's completely disabled.

Activity

  1. changed the title [-]CodeLens on hover[/-] [+]CodeLens on hover [feature-request] [editor][/+] on May 8, 2017
  2. changed the title [-]CodeLens on hover [feature-request] [editor][/-] [+]CodeLens on hover [feature-request] [editor] [ux][/+] on May 8, 2017
  3. added
    feature-request
    on May 8, 2017
  4. changed the title [-]CodeLens on hover [feature-request] [editor] [ux][/-] [+]CodeLens on hover[/+] on May 9, 2017
  5. sttz commented on Jun 8, 2017

    @sttz

    I would appreciate this is as well. I like the functionality of the code lens but having the references always displayed clutters the code and it's also a bit distracting during editing when the lines move to make space for the reference count.

  6. mattmcnabb commented on Jun 27, 2017

    @mattmcnabb

    I'd like to add to this as well. Code lenses are great but sometimes feel a bit awkward when they interrupt the line height in the editor, particularly if the code has several lines in close proximity that instantiate a lens.

    It would be nice if CodeLens supported a different method of representation. For instance, instead of adding code lenses above the referenced line of code, developers could opt to use a symbol in the margin which can be expanded on hover. Another way could be to use an inline marker similar to the problem squiggles - maybe leveraging a different color or shape to indicate that it's a lens?

    Thanks!

  7. maltezefalkon commented on Dec 5, 2017

    @maltezefalkon

    +1

    It's great information to have when you need it, but most of the time it's just in the way!

  8. AurimasNav commented on Feb 28, 2018

    @AurimasNav

    Came here looking for a way to disable "n references"

  9. tustin2121 commented on Dec 1, 2018

    @tustin2121

    ANYTHING to make it so the stupid feature stops taking up more vertical space. An option to put it to the side, an option to hover it, an option to make it into a little indicator to the left that you hover over like the suggestion list, ANYTHING ELSE that makes it so it quits making my code suddenly jump to be twice as high than it needs to be! It might be a nice feature, but the fact that it jumps and makes the code bloated means I turn it off every time it appears!

    It frustrates me most that there's already been a bunch of issues created about it, and they've all be closed and locked, because apparently the dev team only likes it when their most touted feature is in your face and they refuse to see how annoying it can be.

  10. Pondidum commented on Dec 6, 2018

    @Pondidum

    Jetbrains' Rider has an option to push their code lens-like feature to the end of the line like so:

    image

    I would love this for Code as having the lines constantly jump up and down as I type is irritating.

  11. aarsten commented on Dec 26, 2018

    @aarsten

    I would really like this as well. Most of the time CodeLens is a massive distraction when editing code. When you are concentrating hard on the code you are editing, having extraneous information jump out at you and having the lines of code move around is exasperating. It becomes an invasion of your mental space. Since it is impossible to ignore it a part of your thoughts necessarily go there and therefore away from the code.

    Sometimes the information is useful, and it would be nice to have it available at the fingertips, so both display on hover and display at the end of the line would be good solutions. I would prefer on hover though so the code display is less cluttered most of the time.

    As it is now, unfortunately, all I can do is turn it off. So that is what I do.

  12. 1 remaining item

  13. giulianisanches commented on Jun 25, 2019

    @giulianisanches

    It would be greate to have it at the end of the lines and/or on hover, for sure.

    Toggle will help for now :)

  14. ackvf commented on Oct 9, 2019

    @ackvf

    I would prefer if the position of cursor controlled when to display references.

  15. entr0cks commented on Dec 19, 2019

    @entr0cks

    Was about to make the same request as Andy Sammalmaa (@Pondidum), to add them to end of line.
    The new implementation of code lens in current version (which I understand is reverted in 1.42) messes code readability up bad with reference counts between properties of regular objects.
    Edit: to address ackvf's point, I would like to see them.

  16. vladislav-kostin commented on Jan 7, 2020

    @vladislav-kostin

    I always thought that it has to be in the end of the line. I have to disable it because it get's in the way. Came here to suggest to show it on hover as well. Seems like such an obvious and must-have feature now.

  17. NNemec commented on Feb 24, 2020

    @NNemec

    My main concern is the visual distraction. Moving it to the end of the line would only reduce the waste of vertical space. I would definitely go for a pure mouseover with only a really subtle visual hint to indicate that there is some information available.

  18. NemoStein commented on Aug 2, 2020

    @NemoStein
  19. Luuccc commented on Oct 4, 2020

    @Luuccc
  20. timmy-newtron commented on Jul 27, 2021

    @timmy-newtron

    Is there any new info on this?
    I am currently developing a language extension and most of the CodeLenses I use show contextual information that is not of interest all the time.
    An option to only show CodeLenses at the current cursor position / line would be fantastic.

    My current workaround would involve a custom LSP endpoint for executeCommand (https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#workspace_executeCommand) that receives the current cursor position, calculates CodeLenses for that position and returns them to only show these - quite inelegant, as moving the cursor triggers recalculation of CodeLenses. But this won't work as there is no way to manually trigger rendering of codelenses upon change of the cursor position.

    Is there any possibility to access the currently displayed CodeLenses at all?

  21. added
    *out-of-scope
    on Oct 12, 2021
  22. vscode-triage-bot commented on Oct 12, 2021

    @vscode-triage-bot

    We closed this issue because we don't plan to address it in the foreseeable future. You can find more detailed information about our decision-making process here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

    If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

    Thanks for your understanding and happy coding!

  23. lucerattow commented on Dec 16, 2025

    @lucerattow

    I strongly support this feature request.

    For years, I have disabled Code Lens in both Visual Studio Community and Visual Studio Code because the inline display is visually distracting and creates too much noise in the editor. However, the information provided by Code Lens (references, implementations, etc.) is undeniably useful.

    This is a widely shared concern. Throughout the years, I have discussed this with colleagues, and we all share the same experience: we avoid using this useful feature because of the visual clutter it generates.

    Making Code Lens on-demand via Hover would be an excellent solution, as it preserves the utility while dramatically improving the editor's visual clarity.

    I would also like to suggest considering the Status Bar as an additional option. Showing the Code Lens information there when the cursor is in the function/class could be another minimal-impact way to deliver this valuable context without cluttering the main code area.


    ⚙️ Important: Focus on Configurability

    This does not have to be a mandatory change. The goal should be to make the display method configurable. Users who prefer Code Lens inline should be able to keep it that way, and those who want it on hover or in the status bar should have those options available.


    Please reconsider marking this as out-of-scope, as there is significant user demand for a less intrusive way to access this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*out-of-scopecode-lensfeature-request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions