We got a great suggestion from VSLee in the community about parameter usage highlighting. VSLee says:
implementation, it is hard to see where a particular parameter is being
referenced, or if it is even being used at all.
you could highlight all of the places that parameter is referenced in a
function. Maybe used the marching ants instead to avoid confusion with
all of the other highlighting that is being done in other parts of the
code. You could turn off the highlighting whenever the cursor is not on a parameter, to prevent overstimulating the user.
First off, this bug was excellently presented to us. Not only did
it present the problem succinctly, but it also provided a useful
proposal that considered the potential drawbacks that could be
involved. It's far easier for us to consider suggestions when
they've already been so well fleshed out by the submitter.
So this sounded like a great idea to me when i read it. We
already have a couple of features in VS2005 that provide similar
features. The first is "find all references". When invoked
on the declaration of a variable it will find all uses of that variable
in your code. These results are presented in a list that you can
then iterate through. The problem with this is that this feature
is not what we would call "code focused". What do i mean by
that? Well, we consider "code focused" development to mean that
the preferred way for the developer to interact with his program is
through... well... "code". This may seem surprising to you.
After all, how else could you interact with your program? Well,
there are numerous ways. There are things like Class View, Class
Designer, the WinForms designer, etc. So a tool which
provides information in a separate mechanism from your code would not
necessarily be "code focused". Why is being "code focused"
important to us? Well, to put it simply, it's important to us
because so many of you have told us it's important to you. You
live and breathe code and you're most comfortable within that
The second related feature that we have is the "code definition
window". This is a "code focused" tool that will show you
the declaration of any symbol when your cursor is on any
reference. So this is close to what VSLee asked for, in that we
show the information to you as you're looking at the code, except that
we're showing the definition, not the references.
I was looking for a small diversion today and so I spent around an hour
today with Kevin coding up this feature. We decided to take it a
bit further. So instead of just method parameter, we also just
work on variables as well. It was a lot of fun, was surprisingly
easy to code up, and behaves quite nicely after our initial
implementation. (I'll post pictures later when i can take some
screen caps from work). You just put your cursor on an identifier
and after a 1/4 second delay you'll see all references highlighted in
the code (using a yellow highlighter-like background). Why the
quarter-second delay? Well, we've received a large amount of
feedback about the C# IDE UI being too "noisy" (i.e. too much
flash/glitz). If we didn't have the delay, then you would start
seeing yellow highlighting flashing occurring as you navigated around
the screen. We had the same problem with brace
highlighting. The initial implementation was really distracting
for users because as they arrowed around their code they would keep
having things distracting them in their peripheral vision. Often
they wouldn't even know what it was (since they'd move off the brace),
but would just get confused and unhappy. To prevent that we use
the delay so you won't see the highlighting until you settle on single
place in the code.
I like the current implementation, however kevin
feels that it could use some work. He feels that users will want
to click on variable, see all references highlighted, and then munge
the code around while the markers stay active. This is something
that won't work with the current implementation because when you
navigate away from the current variable we're going clear all the
highlighting since you're no longer on a variable. So he's trying
to come up with a simple and intuitive model where users can do things
like highlight (and clear highlighting) references so that you can
navigate around (using the cursor) without losing these visual
cues. And, on top of that, he'd also like a model whereby you
could have all that and modify your code as well. Of course, this
is much more difficult problem since it means we need to track code
across edits (which is a very E&C type thing), which makes the
whole model much more heavyweight and possibly more difficult to
What do you think? Would you like to see the feature as VSLee
asked for it? Or would you prefer something more extensive?
Unfortunately, because we're shutting down and are absolutely packed on
your schedule, this feature won't be making it in to VS2005.
However, because it's such a nifty little enhancement that can provide
you with useful information within your code it's something i'm going
to push for inclusion when we start working on the next version.