 We have here to my left Kendra Havens going to be talking about all about writing beautiful code faster. How are you Kendra? I'm doing good. How are you Seth? Fantastic. Now for those that are watching, make sure you send in your questions because we'll have a little wrap at the end. Okay? Definitely. All right. Let's turn it over to you my friend. Okay. So welcome to write beautiful code faster with Kendra Havens. Yeah. That's the title they made me use. Good stuff. So first off, I really want to talk all about the .NET productivity improvements in Visual Studio 2019. A ton of those start with UX and Shell. So first off, side by side installation. I know many of you might not be totally ready to make the jump switch entirely to 2019, and that is absolutely okay because with the Visual Studio installer, you can have multiple versions of Visual Studio 2017 right next to 2019, both installed on your machine. You can switch back to 2017 if you run into any issues and use 2019 for all of the projects that you absolutely can. Okay. So as soon as I open it up, you might see notice the difference. I'm in the blue theme. It's a little bit more purple-y as I like to describe it. Amanda was just talking about some of the UI changes you might see. One of the biggest, most useful productivity tips I want to call out is control queue search. So we had this in 2017. It was actually off to the right just a little bit. We've centered it, and we've indexed way, way more in it and we've enabled this fuzzy searching. So let's say I'm trying to open up the start window, and I can misspell it as Star Widow, and I can actually still go ahead and launch it. So Pratik was just talking about getting to code really quickly. So we have simplified the experience, and you can still see all of your most recent files, and that's what I definitely use the most. More things that you can do is adding items from control queue, as well as always looking up different code style options that you may have. So I'll be using this a ton throughout the rest of my demos. So a major thing that we wanted to add, speaking of getting to code fast, is we have enabled a way to load solution filters. So let's say you're working on a project, you're working on a subset of code, you don't want to load the entire solution, only a few projects, you can actually unload certain projects in your solution. So I've unloaded my test, right-click on the solution file, and save it as a solution filter, and I have one saved already that I can go ahead and open up. So it saves as a .slnf file, and when I click on it, it only loads the projects that were loaded when I saved that solution filter. So that is a huge deal for enterprises with hundreds, maybe even thousands of projects in one solution. We're not here to judge your architecture decisions for sure. So it's a great way to open code really quickly, really excited about solution filters. I think Amanda just called this out in the Q&A, but you might notice that these code lens references are now showing up in the community. So you can get references, you can get your get history, you can show like authors and recent changes, code lens is super useful, it's super good, just prompt for learning a little bit more about your methods and the code that you're working in and helping you learn more context. So you can edit what code lenses appear on your solution. All I did was in control queue search, I typed in code lens and I have everything enabled because I want to know as much as possible. Okay. So and that is in community. Another thing that is new in Visual Studio 2019, which is a huge reason to upgrade is per monitor awareness. So it used to be when you launched Visual Studio on your laptop, and you dragged it to another monitor because you're living that blessed multi-monitor lifestyle, Visual Studio wouldn't always resize correctly. So now we're much more smart about adjusting fonts for high resolution, which is absolutely wonderful. Okay. So next off, all of the tooling improvements we have in Visual Studio 2019. So first off, new classification colors. You will notice your editor is much more colorful. So keywords, and I just mentioned this in the keynote, so I'll recap it just a little bit. Keywords, user methods, local variable names, perimeter names, and overloaded operators are all getting new colorization, and you can actually customize these colors if you don't love the ones that we chose for you. So I'll go ahead and go to fonts and colors. Again, I just use control queue search. I didn't need to go through environment and find fonts and colors and all of that. If I scroll down to user members, there's my properties and locals and constants and all of that I can adjust myself. Speaking of weird hot dog themes. No, as we were developing this, a lot of people were excited to see statics were bolded in some of our first iterations. We got a lot of pushback because it was just jumping out to too many people. I was definitely one of the people where I was like, whoa, statics. Why are you yelling at me? But if you really did love that, you can still enable it to be a platform and not make all of your decisions for you. So yeah, that's a new one. So Allison will be mentioning even more about IntelliCode. You've seen a lot of IntelliCode excitement so far in the Keynotes. I can totally use IntelliCode all over my project. It's an extension. We're hoping it will soon be on by default at some point, but you can go and grab it at aka.ms slash IntelliCode. That'll bring you to this page. It works for multiple languages as Allison mentioned, and it offers smarter completion for dot completion, smarter overload suggestions, and it learns from your context, which is super helpful. It even indexes things that like newtonsoft.json is not a Microsoft library. It's a super popular NuGet package in the community. It still learns what suggestions are most popular in certain situations. So we still have DCLA's object being offered here. So super excited about IntelliCode. Another thing I'm really excited about tooling is, I'll go ahead and reload my test project, is for SDK style projects. So using .NET Core projects or .NET Framework adapted to the SDK style, you can simply double click on that project in the solution explorer, and it opens the CS project immediately. We are so far away from the good old days of having to right click and unload and edit your CS project. Just a simple double click. Awesome editing experience for a CS project. It is all about the little things trying to make your experience better. Another thing about the CS project is, you can now find CS projects in GoToAllNavigation. So I can type GoTont control T, and that's how I can get to files member is recent files are my particular favorite navigation. Now we also index CS projects. So any files within those, we even show a preview. So if I closed out of that and retype here, it will show CS project in your little preview window without fully opening the file. Pretty sweet. Okay. So speaking of being able to find code quickly, we added a new category into our find all references. So that's shift F11, or you can right-click and find all references. We added this kind of category that categorizes references by the reference type. So read, write, name only, and you can actually filter all of these to, for example, only the right references. So you can see everywhere that this particular variable is being written to, which is very helpful. Super, super big ask and totally new in 2019. I am excited to show off the search local and watch windows during debugging, but I'm actually going to leave that for Leslie, that has a talk later in the day. So stay tuned for more debugging features. Really excited about that. Okay. So I mentioned in the keynote a little bit about code style and management. So let's dig into that a little bit further. So many of you may be familiar with adjusting code style through your tools options. So you can scroll around, you can set your prior preferences to prefer var or explicit type, and you can set the severity of this as well. So something new in 2019 is being able to generate your editor config file from these settings. So I have one generated here, and this is where I can manage all of these settings. So if I went and looked up my var rules, I can say that right now it's actually preferring the explicit type because it's set to false, and I can go ahead and change it to a suggestion and we can see it impact my code. So here I'm using var in my test project. I can go ahead and select all matching using shift-alt-dot, and change that to a suggestion. That's multi-cursor by the way. If any of you were like, oh yeah, shift-alt-click or shift-alt-dot to insert at the next matching. Very cool. So now when I go here, I am now getting these dots underneath my var. So the code fix for this is going and changing it to explicit type, but let's say I want to do this for my entire file, and I want to go ahead and fix some of my inconsistent spacing. I have curly braces sometimes on the first line, sometimes the second. I want to apply all of my formatting fixes, and my code fixes all at once. I can do that using code cleanup. So we added this little broom icon to the bottom of files. So I can click it to execute code cleanup, which is Ctrl-K, Ctrl-E, or I can go and configure code cleanup, and here I can actually specify what fixers I want code cleanup to apply. So here I can apply implicit-explicit type preferences, so I've promoted that to be associated with my code cleanup profile. So this is just deciding what fixers exactly are associated with a certain keyboard command. So if I apply Ctrl-KE, it fixes all of my spacing, and it changed my vars into explicit types. Cool. Another thing I want to call out is, so we have a lot of asks for code cleanup to be able to work on your entire solution. We are working on that. We also have a lot of asks have code cleanup somehow work on the command line, so people might be able to check it into CICD. Right now, we do have a .NET format global tool that will apply formatting options, so not all code style fixers, more like white space fixers. The curly braces would be a good example of that, or having space in between the parentheses of a method. You can hook up the .NET format global tool right now to your CICD pipeline, so it'll do some formatting, not all code style. We're still developing the area, and we're really open to feedback on it. Cool. So next, I'll move on to .NET refactorings and code fixes. So I have a ton to get through. Let's see how fast I can go. So first up is sync namespace and folder name. So a lot of people have been really excited in requesting that one. So if I went ahead and dragged my emoji test.cs to my home controller, so I just changed its containing folder name. If I now go to my namespace and hit control. Which is the trusty keyboard shortcut for accessing all of your tooltips and light bulb suggestions for wherever your cursor is. I will get the suggestion to change my namespace to my folder name. Boom. So now it's in the home controller namespace, and this will also change all of the references to this namespace and update all of them as you would expect. So in the keynote, I was super glad they got this in. We have convert for each to link. So you have the link query body, or you could also use the link method syntax or the call form. So it's all in one line using a lambda. Very nice. We can invert conditionals. So right here, I can tell you what this app does, and actually I can go ahead and run it. So this app grabs all of your tweets that you're currently making on Twitter, and it runs it through Azure Cognitive Services to get the sentiment score. When I click Analyze here, it will give me back the scores along with the tweets. We also have this ability to analyze the average. So it totals the average sentiment for each user. Just pretty nice little code. Tweets are very important to me, obviously. So here is where we gauge whether or not the tweet sentiment score qualifies as happy, sad, or indifferent. So I have some conditional operators here, and maybe I want this to read happy, indifferent, and then sad. I can go ahead and hit control dot after I place my cursor right next to a logical operator, and it will invert that condition. So it didn't actually change the meaning of my code. Scores that are still less than 0.3, we would qualify as sad, and above that was indifferent. So it just changed the way the code is written. So nice little refactoring to have. Okay. Another ask that was very popular was being able to not only extract your interface, but extract your interface to the current file. So I can access this by hitting just placing my cursor in any class, and I can hit extract interface. It opens this little dialogue, and now I have an i-emoji search interface, and emoji search is implementing it. But what if I meant to add more members and to that interface? What if I added some to my type and I actually want to promote them so I can use them in other places this interface is inherited? I can do that with pull members up. So I place my cursor in any of the members, and I can pull members up to a base type. So it reopens that dialogue, and I can go ahead and select all the members, and I can pull them up to my interface. So handy dandy little refactoring that we offer now. Okay. So here I have a super long list of parameters, right? It goes all the way off the page. I'm looking at multiple different emojis. New refactoring we're offering is wrap-in-durant-every-parameter. So I can do that here and now I can actually read not only my list of string but my string text. So pretty helpful there. Okay. Let's say that this is another very popular refactoring. I'm trying to type out a function that I know I have the dependency installed in my project, but I just don't have the using statement. So here I'm trying to call Newtonsoft.json. I get an actual code fix to add the missing using. So I can add using Newtonsoft.json, pop that at the top of my project, and now I can get all of the intelligence that I actually wanted for it. Cool. Let's see. So going back to my emoji search class, I wanted to call out that the regex I have here, you may notice it's getting some colorization. That's because we added regex language support in Visual Studio 2019. You even have brace detection and some error messages. So it can sense when you're missing something or you mistype something because let's be real. Typing regex is hard enough, so we're trying to make that a lot easier for you. You may notice I'm getting some warning text here. So I never actually use this variable, and I'm also reassigning it in some place. So I'm getting two different code fixes here. One is to remove the redundant assignment. So that's what I'm getting dots on. So when I take that, it eliminates one assignment that I never used in my code, and the warning is because I never actually use this variable at all. So now we have dead code analysis that will actually see what variables you aren't using and what you can erase. So this will definitely help you clean up your code. All right. So that's not even all of our code fixes and refactorings. There's definitely way more that I wanted to show off. You can find the complete list in our release notes, along with our blog posts as well. We have another one coming out today. Should be really great. So Q&A. Are you ready for me, Seth? Let's do it. I love Q&A. Hold on, they're going to probably get my mic ready. There we go. I can start to hear stuff. There we go. So here's the thing that I love about Visual Studio is how productive I am with just autocomplete. If you could summarize the top three things that 20, 19 years like you should totally look at this. Because I feel like there's so many hidden things like the editor config stuff you were doing. Some of that stuff when you went into like deep into the menu system, I was like, I've never heard of that. Like what are the top three things that people should look at? Okay. First off, I really love Intel code. I won't stop talking about it. It's totally Allison's thing. She'll talk about it more later. But that smarter completion is so key. We ran it over 2,000 open source GitHub repos in order to train this AI model. It's super cool. Yeah. So my mind is boggled. I started in what like 2014 was my first internship. I did not know computers would be making my coding experience so much better at this time. I've been doing just autocomplete for so long that now seeing it being even smarter to me is super cool. So what we want to do is we want to make sure to get your questions in. So I'm going to get them right here as I get them. Here's one from Mike. Great VS292 presentation. Where can I find the code to your Twitter sentiment analysis you showed during your presentation care to share? Sure. Some of the emoji search classes and that kind of stuff I added myself, but generally there's a great tutorial on Twitter sentiment analysis that you can find in our Azure docs. I'll try to figure out the link for it and tweet it. Awesome. We'll make sure to put it out there for you. From Travis. Oh, I know Travis. For code cleanup, how do you configure it to run Roslin Analyzer fixes like those found in Stylecop would love to have one-click member reordering and spacing fixes. Sure. So a lot of the Stylecop analyzers we have implemented in our Roslin Analyzers repo. So this is a repository separate from what ships with the compiler because it offers a lot more suggestions than we want to have on by default. But if you want to go and grab that Nougat package, I think you'll get a lot of what you would normally see in Stylecop. Awesome. Not 100 percent, but a lot of them. Okay. So enough of them, right? Let us know. Can you show me one more time because something happened with audio when I was outside? I want to see the menu where you were changing a lot of the coloring. Can you show that because I want to be able to get to that again when I go back. So let's go to our screen if we can. So it's super easy to open. You use Control-Q and just type in fonts, right? See, that's the part I miss because the thing is, I've got to use search. Yeah. This is the problem that I have. I was walking by because I'm going to be honest with everybody. I went to actually grab a doughnut, but don't tell anybody because it's our secret. But I saw you were in this menu changing very specific things and you can see it on your screen right now if we go to the screen. I have a hard time finding the right thing. Why don't you impress upon me because I need the impression here stuck in my head. What kinds of things can you search for when you're doing search? So all of our menu commands used to be the only things accessible through search. Now we have things like adding certain NuGet packages or adding a project to NuFile and search as well, as well as a ton of stuff in tools options. Not everything in tools options is there. It depends on how we tag it when we check in, but we're trying to add more and more. If there's something that was really difficult to find, please let us know. Absolutely. You can let us know. Actually, I'll go ahead and call out this little guy at the top that Amanda was talking about. This is our little report a problem guy. And it'll take you to Visual Studio Developer Community. And you can go ahead and report a problem there or suggest a feature. And we will absolutely go through it. Awesome. I think the challenge that I have is I'm stuck like in this stage of Visual Studio where when I search for things, I'm like I'm searching for things in a file. But that's not what search is nowadays, right? It's search for all sorts of things. Tools options, commands, NuGet packages. It's super useful. Control Q. Yes. OK. So here is a question I think from David. When you use solution filters and do a rebuild all, what gets built just the filtered projects or all of them? Do you know that one? Yes, just the filtered projects. So you will still have issues if you have unloaded dependencies and whatnot. But if you don't have any, if all of the dependencies are loaded, it'll build just fine. Fantastic. Yeah, we figured that out at the MVP summit when I didn't know, so we tried it out. He's like, I'm going to figure that one out. It's the same, like we all do the same thing, OK? From Jens, when you show new features, could you also state if they are in community? So all the stuff that you were showing, which part is in community and which part isn't? Do you know? Yeah, the biggest thing to call out, everything? Yeah, everything I just showed was in community. So all the code fixes and refactorings and stuff automatically in. CodeLens is now in community. It's really excited about. Hey, that's cool. Yeah, editing project files, yeah. Everything is just in there. What I want to do now is we have a couple of minutes, and then as your questions come in, I want to make sure that we call out some people. Here's some people in Boston that are here that are watching. Look at how cool they are. Thanks, Jim, for that. Hi, Jim. And I wanted to do a little inception here. Mind blowing. Hold on, let me line it up. This is cool, I mean. Can someone tweet a picture of this? Yeah, let me get in there so you can be ready. I'm going to get the exact. OK, all right, so they probably got it already. Good. OK, another couple of people. We have people here in Minneapolis from Mike. I know Mike, he's nice. Look at them. They're all watching. And then we had someone from more far, oh, here we are, from Denmark. You can see they're in the evening hour over there. OK, a couple of other questions. When we talk about Visual Studio IntelliCode, they talked a little earlier about training a model. Can you show us where somebody is? Is that you? They're doing that next, right? Yeah, yeah. Allison will be doing that right after we do it. They're like over here. Which is good, because I'm not sure. I don't have a good. You got me. From Andre, when adding a new file with search control q, is there an easy way to tell the folder that I want the new file to be created in? Oh, I should just make it pick from Andre. Control q. So you can add new files with control, search control q. It opens up the regular add file dialogue. So the same sort of input that let's see if I can add new item. Yeah, so it just opens up sort of the same page that you would see. And when I hit add, so it learns, oh, that's right. Control q actually is contextual for what you have selected versus in the solution explorer or in your editor, which is also really trippy. I see. That's kind of cool. It's like knowing. We're not even going to be able to code anymore if you people have your way. I'm just saying, right? Yeah, absolutely. That'll be really cool. So you're saying that it opens based upon context. So someone was very helpful. Let's do a third one here if we can. Because we have another minute. Let me get in there here. OK, all right, so. I love the internet. Thank you so much. This is great. All right, so hold on. Thank you, Kendra. We're all done. Thank you so much for your presentation. We're going to get this recorded and put up.