 On today's Visual Studio Toolbox, Matt Christensen returns to show us some of his favorite features in Visual Studio 2019. Should we make this a longer or shorter episode? Hi, welcome to Visual Studio Toolbox. I'm your host, Robert Green, and joining me today is Matt Christensen. Matt, welcome back. Thank you very much. It's been a long time, way too long since you've been on the show. I agree. It's good to be back. We are here to talk about Visual Studio 2019, which has just recently shipped, had a great launch, a lot of great content from the launch event. We'll have pointers to that. But what I thought we would do is a couple things. One is just have you come on and show us some of your favorite features, to keep the excitement going. Then two, we're going to try and experiment. We talk a lot about how long these shows should be, and when do people stop watching, and I tend to go longer than people want because I tend to talk a lot. We're going to try and experiment today. I'm going to do less talking, and we're going to focus more on demos, and we're going to see what happens if we keep this a shorter episode, and then you guys are going to tell us whether or not you like it. So I basically have 15 minutes. 15 minutes. To show as many of my favorite features as I can. Starting right now. All right. So in Visual Studio 2019, I want to start with the new search experience. We completely redid how we do Visual Studio search. I love it. So as I search, as I type, you see here how I get search results, and I get that globally from around Visual Studio, all the commands, menus, components, templates, all sorts of things, including options. So let me just start by going in here and make a font a little larger in the editor when we get to that. I can also say new console app. That gives me the console app template. I'm just going to say, okay, to create that, and that was it. I now have a new console app. Wow. That was fast, right? So that's even faster than calling up the new dialogue and searching in that. It is. Yes. That's why it's one of my favorite features. It makes me more productive. Yeah. So let's start coding here. So this is just the default static void. Main method I have here. Let's see if we can do something a little different. So let's create a string array, and I'm going to create a new array of strings. I'm going to put two strings in there, and I basically want hello world to be in an array. So I'm going to copy hello, control C to copy, and I'm going to go straight on and control C again on world. So now I've copied both. So now I want to hit control shift V to insert. It not control V to paste, but control shift V, and that gives me the clipboard ring, which is now visualized so I can choose which of the things I've copied and insert them super easily like this. Nice. Yeah. So if you do a control V, will it insert in order? Yes. So the control V is just a normal paste. Right. But control shift V, which has been there for a long time. Control V has been there for a long time. Control shift V has been there for a long time too. But as a new thing, it visualized. You can see what's in the clipboard ring is what it's called. So control C, control C has always stored multiple things to the clipboard? Yeah. Cool. Yeah. So moving on, let's say that I want to take, I want to print out, I want to concatenate these two hello and world, I want to concatenate them into one string, and that I want to write out to the console. But only, and this is a contrived example, but I want to make an if statement here to say, if my list.length is larger than zero, but then I want to print out. So I'm just going to hit dot and look at all these new things I've got here, refactoring. So we've got a bunch of new refactoring that makes it super easy to do all sorts of more advanced things. I'm actually just going to add braces to this one like this. So that's been there for a while. But it's really helpful to have all these new refactoring that make it easier to convert code from one thing to the other, going back from link queries to for each loops and vice versa, really, really helpful. So now I can simply just go down here and do a string join. I'm going to join on an empty string, and I'm going to provide a list. Now see what happened here. I'm going to just force this again. So I'm going to see here, zoom in. Notice how the first two items, list and arcs has a star because IntelliCode, which is a new feature in Visual Studio, it's an optional extension at the moment, so you have to install that. But it knows the context I'm in, it knows that this particular method, the string join method takes an array of strings, and then it knows that, oh, I actually have two that are in scope. I have arcs up here and I have list right here. So it suggests to me those at the top of the completion list. So that's just super helpful, and I can easily insert it like that. Cool. So IntelliCode is really a fantastic aid, especially when you're dealing with new APIs that you're not so familiar with. It helps you to figure out what is the most common use patterns of different APIs. IntelliCode is basically in IntelliSense with a bunch of AI behind it, getting very smart about it. So we've been scanning like thousands of GitHub repos for the different languages, for C-Sharp for instance, to figure out how people use various different APIs. Based on that, we put that into a machine learning model, and outcomes a very, very clever IntelliSense engine that, well, that sits on top of the current IntelliSense. So that's very nice, and I forgot a parenthesis here. All right. So let's set a breakpoint and hit F5. So now it runs and it breaks, and I can see down here in my locals window that I have my list member here, and I can now search. So I can now search for world, and notice how it can find values that are in lists or dictionaries or whatever, no matter how deep they are in the hierarchy of things. So that's really welcomed, and that search works in autos, locals, and the watch windows. So it makes it very easy to find these hard to find sometimes values of properties and so on. Cool. So I'm just going to continue here, F5, and we can see the hello world is printed out. But notice, it didn't close down when it was done. It keeps going, and there it goes, and that's very nice. So that was some of the new things. So what you probably couldn't tell was that the step debugging was a lot faster. So as I was setting the breakpoint and it was hitting, that's over 50 percent faster now than it used to be. Okay. And that's a very nice thing. Yeah. It's kind of hard to tell on a simple console app like this. Yeah. All right. So let's make a mistake here. So I'm removing a parenthesis here, so now I have a syntax error. So at the bottom of the window, I now have what's called a document health indicator. So it tells me without having the error list open, I can now see that, oh, I actually have one error. I don't have any warnings, but that makes it super easy for me to see that, oh, it's not green, this file actually have some issues. Right. And typically that's because you scroll your syntax errors out of view, and so you don't necessarily know when you try to build, for instance. So glancing at this makes it super convenient to see. And so I can navigate between these errors, alt, page up and page down. And so that takes me exactly to where they are, and I can fix them super easily. And now, no issues found, we're good to go. Cool. So that's in addition to the, showing it on the scroll bar as well, right? Yeah, so it's just having more, well, yeah, it gives you the navigation so you can very easily go between the errors and see what's going on. So I want to show another thing here. So let's just save this. Let's add this to source control. Let's do that. So I'm going to right click the solution, and I'm going to add solution to source control. And it's going to add it to git. And here we go. And now it's all first commit. Now let's make a change. And this change I want to do is I want to clean up this file a little bit. So I want to remove all the comments. And you can see there are other things here like, I have unused using statements and so on. I might even have like, let's just produce some, let's produce some formatting issues here. Like I have some wrong indentation here. So I have an extension called comment remover that lets me very easily just remove comments with a keyboard shortcut like that. And now I want to do the code cleanup. And so as a new feature down here at the bottom, let's zoom in here a little bit. We can see that we have a couple of profiles for code cleanup that we can run. One of them has a keyboard shortcut assigned to it. And we can configure those two profiles in here. So I configure them to have a bunch of code fixers. Now these code fixers, I can remove them out or back into what the profile will run. And these includes like sort usings or remove unnecessary usings, a bunch of things. So now if I hit control KE, that was the keyboard shortcut. We can see here how my code is just tightened up. And if I were to do a code review, I'm in a much better place right now because now we don't have to talk about formatting and coding style conventions and so on. And how do you create those? You go down here to the bottom and open the menu and click configure code cleanup. And so how do you find additional fixers to add? So right now the only fixers are the ones that are built in, there are 14 built in. Okay. So in the future we'll see this change. Okay. But as of right now, we have these 14 built in. And they're super helpful. So now I have a change. I'm gonna save the file. I'm gonna commit it. But I'm not gonna fully commit this. I'm gonna call this cleanup. Instead I'm gonna stash it. So I'm just gonna stash. So what happens is I don't create another branch. I basically create a stash where I take the changes that I have and put them away locally. And if you see what happened is that my changes in the source here was reverted because I took the changes and stashed them. So if you think of, if you're used to TFS for instance, you have a shelf set. The difference is the shelf set is actually actually exist in the remote server whereas git stash only exists locally. So only on my machine here. Ah, okay. But I have it right down here. I can apply it at any time I want. And typical use cases for this is I make a change but then I have to fix a buck really quick and I have to change branches. So I can stash my stuff, change my branch and then come back afterwards to that branch and apply it again. Or I can work in one branch, figure out, oh man, I should have done it in the other branch. Stash my change, change to that other branch and apply it to that branch. So that's super helpful that I can do it all the way right here. All right. And let me show you another really cool thing. This is the last thing I wanna show. Okay. So let's close this solution. And I'm gonna open a bigger solution that's got a bunch of projects. The Pro Power Tools. My all time favorite. Pro Power Tools. Actually I wanna do something a little bit different. I wanna open it in a different way. You know the very first Visual Studio Toolbox episode which I'm about to productivity power tools. Split into two episodes because you know we had to keep it short. So now I wanna open a solution that's on my disk here and there's now a new option down here to say don't load the projects. That's kind of bizarre until you see what's going on. This is a solution that has many projects. There are solutions out there that are way bigger, right? But you saw how fast this was loaded. Yes. So a typical scenario is that if you have a solution with a lot of projects and you might only work on a subset of those projects. So it could be like you have a back end and then you have like a windows desktop front end and an ASP.NET front end. But you only work on either the ASP.NET front end or any of these other things. And so why even load the rest? So now nothing is loaded. And I can go in and say I wanna load this particular project. So just like normal, I can say reload project. But now I can also go in here and say load project dependencies. So it knows, okay, I have this particular project has other dependencies on other projects in the solution that it needs in order to build. So now I can do that. And that was in this case, it was just this other project up here. Cool. And so now these are the only two projects loaded. And I can hide everything else. Or show it again up here. Is there a way to basically set the equivalent of a profile where some days I wanna load these three projects, other times I wanna load a different three projects? Yes, I'm glad you're asking. So now that I have sort of my definition here, these are the two projects I want in the solution that I care about. I can right click and say save a solution filter. I love that. This was not scripted, ladies and gentlemen. I actually was just thinking that would be a cool thing to have that's already in there. It was a perfect segue. Cool. So this saves a file. So I'm gonna call this one, since you know the project names are column guide. So I'm just gonna call it column guide. And if we look here, it's gonna save as an SLNF file. So solution filter is the F. Cool. So save that. And now let's just close this solution. Now I have the SLNF. I open it and boom, it only loads those. So that SLNF file roams in my repo. So other members of my team can also use this. You can create as many as you want. So it can be one for the ASPnet team, one for the desktop team, one for the backend team and so on, right? Excellent. Yeah. So that's very helpful. And so one question that we get with this is, well, what if you make changes to the solution file? Like let's say you add new solution items, like in here, for instance, what if I add a new file here? Like, well, how does that then roam between those different filters? Well, the good news is that the filters are actually just a small little JSON file describing just the project that has to load, but it still uses the original SLN file to figure out what is there. So when you make changes to the actual solution, everyone gets to benefit, regardless of what filter they have applied. Right. Because it's just a filter of what's projects open. Yeah, exactly. Cool. So if you have a big solution, then this is gonna speed up your work day a lot. That's excellent. Yeah. Cool. So those were my favorite features of the new. There's a bunch more, but these are my favorites. That was one minute of me talking in 15 minutes of demo. We did it. Hey. I actually like this a lot. I think we should do more of these. But as always, you guys let us know if you liked the 15 minutes or if you wanted us to spend more time diving down. So as always, this shows all about you. So let us know what you think. Hope you like that, and we will see you next time on Visual Studio Toolbox.