It is quite annoying to see codelens reference between the field and field's attributes. It requires to add a lot of additional spaces around to make everything readable. Is it possible to display CodeLens reference above the attributes?
-
7If found that the most effective way to deal with the visual clutter generated by Codelens was to just disable it. – Hans Passant Mar 17 '14 at 09:06
-
1@HansPassant, I agree. But I like the features of codeLens – Anarion Mar 17 '14 at 09:48
-
The features of CodeLens are not CodeLens features. Find All References is in the context menu and Ctrl+K,R on my keyboard. – Hans Passant Mar 17 '14 at 09:59
-
true, but that's only find all references. there are a bunch of other indicators that are not other features. – John Gardner Mar 26 '14 at 19:38
2 Answers
No, this is currently not possible.
If you'd like to see this, I suggest you give the product team a shout-out on the Visual Studio UserVoice and post back the link as a comment to this answer. I'd suggest not to move the code lens information, but to suggest the location to be made configurable :).
Though I can't disclose any details, I've seen your feedback before and I know it has been considered, but rejected.

- 106,458
- 22
- 256
- 341
-
2Please vote! https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/9135343-show-codelens-above-attributes-if-they-exists – pbristow Aug 27 '15 at 15:22
-
1Previous request was declined, new request: https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/19877623 – Josh Brown Jul 05 '17 at 17:12
This is an old question but as an update to @jessehouwing this is Visual Studio team answer:
Dear supporters for this suggestion
Thank you for your feedback on this idea.
We designed the Code Lens indicator to be as close to the actual function declaration as possible, to allow you to make a better cognitive connection with it. At one point during the development of Code Lens, we actually tried locating it above the attributes as this suggestion requests. It looked great in simple cases, but unfortunately it started to feel “disconnected” from the declaration when more attributes were added. It really looked strange at around three attributes, but started feeling a bit odd around two.
Here’s a pathological “real world” case which illustrates this -
https://github.com/dotnet/roslyn/blob/master/src/VisualStudio/CSharp/Impl/CSharpPackage.cs#L26
Imagine the indicator above the attributes in this case.
For this reason, we’re declining this suggestion at present.
Thanks! Mark Wilson-Thomas Program Manager, Visual Studio Editor Team
So sadly it won't be fixed, but after reading the whole answer, I have to agree.

- 6,980
- 3
- 31
- 56
-
9I don't. The most common case is 1-2 attributes, not a full page thereof. – Medinoc Oct 10 '18 at 09:28
-
3Isn't this why `if` was invented? (ok so you lose consistency but I wanted to make the cheeky remark so couldn't help myself) ... but I think I'd be happy with "if one attribute" put it above attributes otherwise above method name – Myster Oct 10 '18 at 23:10
-
1Fun fact: in Roslyn code analysis, attributes *are* part of the "actual function declaration" (`MethodDeclarationSyntax`). By their own logic, they should honor this request. – Kevin Krumwiede Apr 22 '23 at 20:42