microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.65k stars 28.68k forks source link

Explore line-end-rendering of code lenses #90235

Open jrieken opened 4 years ago

jrieken commented 4 years ago

This is about exploring to render code lenses not interleaved with source text but at the end line source lines. The reasoning is that it might impact code structure less but at the cost of discoverability, e.g with long lines code lens won't be visible by default. This is an exploration with unknown outcome and any result will surely be configurable so that existing behaviour can be kept the way it is today.

baybal commented 4 years ago

Hello, I saw your notice. Will be willing to provide feedback.

I think the best about non-inline design is that you don't re-flow the text every time. I'm all for some kind of on-hover popup, or a keyboard triggered display of code lens.

What I think about discoverability, I think you only need to see things like function/method references only when you want to see them.

drew-gross commented 4 years ago

I would also like this feature! Mostly because when a Code Lens appears or disappears while I am typing, the whole page shifts and the code I was looking at moves out from under my eyes. I have disable Code Lens entirely because of this, even though the actions it provides are quite useful (specifically in the Bazel extension)

AltitudeApps commented 4 years ago

Here to mention the chain of threads I found after doing a web search, where I was trying to find out how to keep myself from hammering nails into my screen in an attempt to keep my document from jiggling around:

Not wanting to entirely disable the feature, but hoping for some way to configure it, I started with: https://www.google.com/search?q=vscode+c%23+codelens+hide

Which led to: https://stackoverflow.com/questions/34356510/how-to-disable-codelens-in-vs-code

where a comment pointed to: https://github.com/Microsoft/vscode/issues/23652

which referenced: https://github.com/microsoft/vscode/issues/19917

where I saw mentioned this item: https://github.com/microsoft/vscode/issues/73413

which has this very nice UI mockup by @baybal

So it looks like there is a long standing desire to see this tool modified such that the benefits can still be gleaned, but without having the visual layout of the document be tampered with, Clippy-style. "Oh, I see you're looking at a function definition. Want to see the 42 places where you've used it??"

I am not really interested in the conversation about how to make the pain somehow less painful by altering the animation strategy so that I somehow notice the pain less. "Make it smaller?" No. "Make it faster?" No. No, no, no. I don't want the tool to insert elements into the document at all, unless I request it.

The tool is fantastic, and the information and insight it provides can be described as highly valuable, as it saves the user from searching files for references, half of which will be commented out, etc. But no tool is so valuable as to justify the behavior this tool exhibits: one of jumping up into my face, showing me what it can do, every time I switch to a file.

What is needed: a way to display access to this information, without tampering with the layout of the document.

Of primary concern:

I spend a lot of time in VSCode, but not all my time. Many of the solutions offered have been, in a way, rather insular, in that they propose to smooth out the experience within VSCode. But a solution which meets the above criteria will completely address the issue, no matter what.

Although I really like @baybul's mockup, I understand that isn't what is being proposed here. And I think we should clarify that when we say "line-ending-renderings", we might actually mean: "some-rendering-which-occurs-lexcially-subsequent"

However, I think this functionality would best be served by its own custom gutter/column, appearing on the right. It would only have to be wide enough to display a few characters, like in @baybul's shorthand suggestion. The substance of the information could then be displayed on demand, by either hovering over, or a click, etc. Hints about semantic information are already appearing on the right, in the form of the little red indicators for parsing errors, etc.

Having it be "end-of-line" style would mean that it could be jaggy looking, with the indicator appearing in whatever column. And what about instances where there are two or more items occurring on the same line? Would this would mean the indicator would have to be inserted into the text, in-line? Then we're back to the same problem where the tool is tampering with the layout of the document, only now it's doing it horizontally rather than vertically.

This "code-lens" capability, (which is actually a whole class of features, each provided by their own extension), really deserves its own gutter, its own vertical real estate.

I'm afraid that without a place of its own, code-lens is going to be camping all over my real estate for the next 20 years...

AltitudeApps commented 4 years ago

Could a collaborator please mention https://github.com/Microsoft/vscode/issues/23652 and https://github.com/microsoft/vscode/issues/19917 in this thread? Those threads are more likely to be found when people are searching the web regarding this issue, but obviously they are much less likely to find this thread if it isn't mentioned over in those threads. I linked those items in this thread because they contain plenty of relevant and valuable discussion, and it would be nice if the links went in both directions.

Thanks.

Edit: two more related issues:
https://github.com/PowerShell/vscode-powershell/issues/924
https://github.com/Microsoft/vscode/issues/26204

probablykasper commented 3 years ago

I would really like an option to have codelenses show like the mockup in #23652. Quokka.js, for instance, shows values in a similar way: 102697266-e739f580-4234-11eb-8e51-6e3bf7e47060

In my opinion, when the codelens looks like this it hurts readability a bit. And in this case, there is plenty of horizontal space available: 102697212-6c70da80-4234-11eb-8977-c29504df3215

irvnriir commented 2 years ago

coming from https://github.com/PowerShell/vscode-powershell/issues/924

as far i see/use features added to this "interleaved" widget , they all are secondary and obviously should not obscure the view .

possible solutions for all the related issues are

  1. moving this widget to behind it's subject line, probably with preventing it going out the pane's border, and maybe with adding a sub-menu button .

  2. moving it to context menu

    • 1. it's items to a sub-menu .
    • 2. or as a button which opens a sub-interface .

      i also have "Go to References" and Peek\Peek References buttons in the context menu . this makes no sense because they do exactly the same thing . how would "Go to References" (multiple) be even possible ?

      the "Go to References"

      • should simply be changed to open the cached Code Lens with references ( the one opened when the widget's <<_>> reference<<|"s">> is clicked ) . in conjunction with "editor.codeLens": false , this would already solve mine issue .

      • and could be changed to 2.2. button .

  3. moving it to the Hover . this would also be better with : while a key (by default ctrl or something) is pressed with "editor.hover.sticky": false , Hover would be shown instantly and stay up .

uservoice for what solution is preferred to get focused : 1. 😆 , 2. 🎉 , 3. 🚀 .

p.s. this thread's name is a bit more limited than i relate to

starball5 commented 1 year ago

Related on Stack Overflow: How can I display code lenses at the end of the line in VS Code?.

adrianulima commented 1 week ago

Until this is not solved, I published a simple extension to the Marketplace image

Note this is still v0.1.0, I've been using with Typescript and C# for a week and no problems so far, not sure which other languages (CodeLensProviders) it supports. PullRequests are welcomed.

I used to disable CodeLens just because of those skipping line, now I can still have the feature without the annoying visuals.