[MUSIC]
>> Hi, my name is Dante Gagne,
and I'm one of the Program Managers here on Visual Studio.
Today I'm here to share some tips and tricks with you
to get more productivity in
the editor space in Visual Studio 2022. Let's dive into it.
For starters, one of the first things that we're using in
Visual Studio 2022 is a new font.
Now, it looks similar to the old one,
but you'll notice if you changes,
the big thing that we used here is,
this is the Cascadia font,
which was originally developed by
the Windows Terminal team to have a little bit more readability,
particularly with folks in the accessibility space,
folks who have a reading disability,
dyslexia, character dysmorphia,
and things along those lines.
What the font does is add more weight in the areas
that our eyes used to disambiguate one character from the other,
we found this create more productivity in
the Visual Studio space by using this Font.
One of the other things that this font
does is introduce the idea of ligatures.
Now, these are not new to Visual Studio,
but this is the first time Visual Studio
has shipped with a font that supports them.
If you look down here on line 27,
you'll see a handful of character sequences that
mean different things in
different languages, but they're pretty common.
Now I'm going to press Control Q to bring up
Visual Studio search and search for the font.
I'm going to change the font from Cascadia Mono to Cascadia Code.
The only difference between these two fonts is
the fact that Cascadia Code has got the ligatures.
Now, as soon as I do that on line 27,
you'll see that those sequences of characters had been replaced
with a single glyph that represents the concept.
For instance, the exclamation point equal,
that means not equal to in C#,
has been replaced with the glyph that
mathematically means not equal to.
One of the real values of this is
for folks with cognitive differences,
like folks who show up on the autistic spectrum.
This allows them to recognize the concept without having to
cognitively recognize a sequence
of characters that have a specific meaning.
Now personally, I use
the Cascadia Code because I liked the glyphs.
But this is an example of where you can
decide which way you would like to do it.
Do you want to use the glyphs or do you
want the individual characters,
the control that is left up to you.
Another feature that we added
originally for accessibility reasons,
but we're finding more and more people like it,
is the line spacing.
The office cognitive reader allows
you to increase the amount of spaces between lines,
which helps folks who have
reading disabilities be able to read the lines more easily.
We decide to bring that feature over to Visual Studio.
I'm going to hit Control Q again,
search for a line spacing.
It'll take me into Tools Options and I can see the
drop-down right here that shows it currently I'm using 1.0,
which is no space between lines.
Now if I click on that one and change to 2.0,
as soon as I hit "Okay", well,
this is a preview build of Visual Studio and it's got a bug in it.
But if I move over to this other document,
you'll see that it's now spacing
those lines out with enough space between
them to reduce the character
crowding that can be problematic for folks,
again with reading disabilities or folks on
the autistic spectrum where too much
character crowding can actually cause problems for them.
Another feature that we introduced with Visual Studio
2022 is subword navigation.
Now if I hold down the Control key
and press the left and right arrow keys,
you'll notice that the cursor moves by entire words at a time.
Punctuation is treated as a single word.
Here it's components, authorization, and so on.
If I also hold down Alt when I hit left and right,
you'll notice that now the cursor will go to
subwords or camera case navigation.
That is, it looks for
any capital letters in a word and uses those as
a stock as well to allow you to find
a particular place in the word that you're looking for.
This has been a very highly requested feature
for Visual Studio for a long time,
and we actually got this from an intranet project
last summer that were now able to share
with all of the Visual Studio folks from here.
Selection by word also works.
If I hit Control Shift and move,
it will expand the selection by entire words.
But if I hold down Control Shift and Alt together,
it will now expand or retract the selection by some words.
But we've recently made a few tweaks to
it and I'd like to show those features off.
Maybe folks are familiar with the original feature,
but I definitely want to show off how they change and that's
box selection and multiple carets.
I'm going to move my cursor up here
and draw my caret at the beginning of this line.
I'm going to press Shift and Alt as I move out.
Now, so long as I stay on the same line,
you won't see any changes.
But as soon as I hit the up and down arrow keys,
you'll see that Visual Studio is creating
what we call a box selection.
This is a set of cursors in
a rectangular selection pattern and I can
type something new and you'll
see the each one of those instances takes
a selection and I can apply repeated
edits in multiple locations all at the same time.
Box selection has been around a Visual Studio for quite a while.
The big tweak that we changed is now how box selection
will behave in response to further character navigation.
Specifically, if I press the End key,
you'll see that the Box selection has been broken
and each one of the cursors is now its own instance.
Now I can press the Left and Right arrow keys,
and each one of those cursors will move
together even though I've now been
broken off that box selection restriction
where everything had to be in a perfect rectangle.
You'll even notice at the bottom right here,
it shows that I'm now in multi-caret mode,
which allows for easier navigation
and I can do things like Up and Down arrow,
Home and End and everything like that.
We'll use the multi-caret behavior.
Now for those who aren't familiar with multi-caret,
this allows me to use multiple carets at the same time to
do edits in areas and may not be perfectly lined up.
I'm going to press the Control key.
I'm going to move my cursor up here by clicking
and then I'm going to press Control Alt and
click to create new cursors before each one of the finds.
Now I've got multiple cursors that will
all react with my cursor keys together,
so it's very easy for me to just move over, delete,
add one, and now all of those instances
have been modified to the specific version that I want.
Now I could be using a find and replace to do that.
But there are cases where
the multi-cursor can be particularly handy,
especially if what you want to replace
is in the proximity of a token,
but not that specific token itself.
Now naturally, we wouldn't want to implement something
here that keyboard users wouldn't be able to do.
I'm going to press Escape to abort the multi-caret experience,
move myself over to the five and select it.
Then I'm going to press Shift Alt period,
and that will create an additional caret
at the next instance of whatever I had selected.
By hitting Shift Alt period multiple times,
it's created a handful cursors here and
now I've got that multi-edit experience again.
Last but not least, if I wanted to,
I could select that five,
I'm going to press Escape to abort the mode.
I'm going to select a five and Shift, Alt, Semicolon.
That will go through and find all the instances of that string in
the particular document that I've
got and go ahead and create these carets for me.
Quick warning about that last one though,
is the carets that get created,
It may not always be in your viewport.
You can see up here where I have five,
that was changed even
though that wasn't something that I could see.
Just make sure you know what you're doing with the multi-caret,
but it can be extremely powerful when you use it correctly.
On view to fix that so my document will load correctly next time.
Now there's one more command that I want to show that
it's more of a safety net than a command,
I'm going to press Control,
Shift F to bring up Find in Files.
Now a lot of folks are familiar with this dialogue,
but what I'm going to do is I'm going to search for a space.
Now, normally this isn't an operation
that I would do and over the course of my solution,
I've got a lot of instances of spaces throughout all my projects.
This is something that if I were to hit Find all right now,
my CPU would spike,
I might experience some UI lags inside Visual Studio.
Certainly not what I actually want
depending on the size of my solution,
this could actually cause me a substantial amount of time.
Now, the safety net that's in place,
if we detect that we found more than
10,000 instances of your match,
we're going to bring up a dialog and warn you, hey,
are you sure you actually wanted to keep this off?
We've found from talking to
folks that usually the match they're looking
for is in the first couple dozen or even 100 results.
In most cases, if you have a search that has these many results,
it probably isn't something you actually want.
This gives you an opportunity to
abort that search and not have to wait
for Visual Studio to finish
that entire process or if it was a search,
you actually want it, you can just click "Show All" and
it will go ahead and bring all the results in.
Now if you're the person who frequently does
searches where you want more than 10,000 results,
there's a checkbox over here to say, you know what?
Always show it, I don't want you to stop in the way form.
Now, in this case, I don't really care
about how many spaces there are on my document,
so I'm going to cancel the search.
You'll find at the bottom it's
letting me know that it cancel the search.
Over in the status bar, it's giving me guidance
that maybe you want to refine your search and try again.
These are just a couple of features that we've
added with Visual Studio recently
that folks are telling us that they're finding a lot
of use out of and we wanted to share with you today.
These are just a few of the tips
that we're bringing in Visual Studio
2022 to help you be more productive in the editor.
Of course, this isn't all of them.
We encourage you to take a look at
the Visual Studio Blog and other sources
like that as we get
more features that we want to raise visibility on.
As always, thanks a lot for your help. Have fun coding.