 On part two of our series on finding code in Visual Studio Toolbox, we talk more about the different ways that we can search within Visual Studio, including the brand new cross repo search. Hey everybody, welcome to Visual Studio Toolbox. I'm your host Leslie Richardson, and we are back for part two of our finding code series, and I'm here once again with Dante Gagne and Andrew Chung, who are going to be talking to us about the different ways that we can search outside of our own solutions. So yeah, the wait is over. I've been on pins and needles wondering how I can search for things outside of my solution. So do you want to tell us more about that, Andrew? Yeah, Dante really left you on the cliffhanger there last week. Yeah, so I'd love to walk you through that today. I think we have a couple of other ways to search through code that I'll show today as well as a few things that we're looking towards building in the future. That is great. So what is this mysterious feature? How can I do this? So let me share my screen. So last time Dante I know showed a lot about finding files, and so that's where we'll start off. And I'm not sure if anyone noticed or not, but there was a tab here called find online. So I know we were kind of leaving you on a cliffhanger, but anyone who is eagle-eyed may have seen that. Now this is a feature that we're working towards in the future, so it's still very much in-house right now. And the idea is that what we want to do is let you search beyond your solution, because especially in the last five, 10 years or so, we know that just looking in your code is not good enough. People want to find things outside of their code in their repo, across repos, and so on. And so what we would like to do is to offer the same shortcut control shift, use find files, but essentially leverage GitHub and Azure DevOps in order to let you look for code across your repository. So yeah, keep your eye out on find online. Right now it's an int preview, but this is something we're working towards, and soon you'll be able to search across your repository. What I'm here to talk to you about today are a couple of other search controls that you can use to look for code. And Bonte may have mentioned last time this is a project that we worked on, but I've actually been slacking off. I haven't been working on this in the last little while. I remember doing something with images, but to be honest, it's been so long. I don't remember what the... Bonte's carrying all the weight. So in this case, for me to get back to where I was, as I said, I know I was doing something with images. I don't know what the exact file name or method name was, but I know it started with image. So one way you can go at it is just to start and search for the word image. And if I hit find all, what I'll start seeing here is find in files gives a really great complete list of all of the search results. What I'd like to draw your attention to is that this is great. If I'm looking for a method or a file specifically, there are other search controls that I can use so that I don't have a giant list of results. Like right now I have two projects that I've got loaded, but you can imagine as we keep building this, if it gets to 10 projects, 20 projects, this list is going to grow pretty significantly. So one of the controls that we've built code search into is this search box in the top control queue. This is a new search box that we added in VS 2019 and initially it was used to search features only. We recently added a new tab here called code. And yeah, what's really cool about it is that it focuses your search so that we can search for just classes, types, members and files. So the shortcut to get into here is control queue. I can either click into the code tab to get a code specific search, or I can see, as you can see, there's a shortcut control queue control T that searches just code. And if I type in the same search query here image, what you'll see is I only have two results compared to this list down here where I had a lot. And the reason is because the list that Final Files provides, it matches every single word that has an image in it, including comments, everything in your file. This code search up here really focuses my search to just files, classes, members, types and so on. And so since I already know I'm looking for a method, then I just need to see those specific results. Awesome. So I can use the more global VS search if I just want the narrowed down files, file name, method name, only scenario rate. Absolutely. Yeah. The other couple of differences I wanted to call out is I'm not sure if you noticed, but as I started typing, the results, the results coming dynamically. So I don't, if I'm really lazy, I don't really know where to begin. We've all been there. Yeah. Let me just do long. It's like five, six letters. Yeah. Five letters. My goodness. And a few other things. There's a couple of filters up here. So once again, like I'm showing you a fairly small project right now, fairly small solution. But if this started growing in size, I can focus my search to just files or the types or to members. Cool. That is so nifty. Because that wasn't, that wasn't there when that search was initially introduced, right? No. And that would, and that's the thing is just like, we know that sometimes it's really difficult to try to remember all these different shortcuts and visual studios. You remember f5, control f5 and that's it. Yeah. So yeah, what we're trying to do is essentially get more functionality into a centralized search box. So you only have to remember one shortcut. Like even with the bugger tools, which I work on, like I use this tool all the time because I don't remember half the debugging tools are all the time just manually going through the toolbar. Absolutely. Cool. The other search box I wanted to show you is actually one that's been in Visual Studio for a long time. But I mentioned before, like there's just a ton of different shortcut stuff folks have to remember. So people who have used this can continue using this shortcut. And for those who haven't used it before, you can use these control queue search that I just showed. So the other search box is the shortcut is control T and it's called go to all. Very similar capabilities that we had. So if I type in image, you'll see that I get the same two results. The search itself is focused on just files types members. One thing that's really cool about this search box is I don't know if you noticed, but I actually had a little panel that popped up as I typed in the word image. Yeah. Yeah. So what's really cool about this is you can go through each result and it'll give you a preview. So this right now is a preview. I haven't actually done anything to open it. I have no idea where this file is, but it's focused on this first result. And so I can kind of take a look at whether or not this is the thing I wanted to look at before I go double click and fully commit to opening this up. It's so great. So I don't have to fully commit to leaving one file open and then having to remember to exit out of it because there's too many tabs going on. Absolutely. And yeah, you can imagine if there's a lot of results, I can just kind of like go through each one. This is showing the one in the same file, but if I showed something like card, I think was another one that Dante had showed earlier, I can really start going through each one and looking at where. That is fantastic. Yeah. Cool. So to go back into this, I now know, well, there's only one file around image. And so this is the file that I want to look at. And I'm able to get to it fairly easily. Who knew? I just thought control up was the only search for a while there. Yeah. So there's definitely many different ways to get into your code and to search your code. So we'd love to hear more. You know, you can always play around with each control and let us know if you have any issues, any concerns or any ideas. So is GoToTask, is that a new Visual Studio 2019 feature or which goes for a very, very long time? Really? Yeah, it's been around since before I've joined Microsoft. Oh, then it's definitely been around much longer than I've been around. But as I mentioned, like unfortunately, because we do have a lot of short tests to remember, sometimes you pull like, you know, control F is a fairly typical shortcut to remember for finding anything, you know, not just in Visual Studio, but in websites, in box and so on, right? And so control F is something people remember more. Control T is slightly difficult. And so we're trying to offer a bit more, a few other places where code search is a bit more discoverable. And that's why we start rolling into control T. Or sorry, control Q. Yeah, lots of controls. Yes. Yeah, so if I'm not a keyboard shortcut guru, where should I go to check out, go to task or any of these fines? Like can I check it out in the toolbox or the toolbar somewhere? So I think if you're not really keyboard savvy, or if you don't remember shortcuts a lot, then that's exactly why we designed control Q. I would just go through here and look through this. And yeah. Great. Awesome. And now that I found this file, I finally remembered like where I was months ago. The last time I looked at this, I hoped Dante isn't listening too much. But I can see right here that like I've got a to do. So I was smart enough to at least remind myself that the next time I come, I have work to do. Well, at least he left something. Yeah. So that's that's pretty cool. And, you know, it's been a while. So I'm looking through this file. And I noticed that like the first line, I'm actually using an external package in order to do image, to do some sort of image manipulation. So what I'm looking to do here, it looks like is I want to resize. There's an image, there's a file path I want to take. I've got some dimensions on this file, and I want to resize it. And says resize using mutate methods. So all right, let's let's use this mutate method and see what happens. And kind of see it away. Uh oh, like I can't just call mutate. That's not good in the processing context. Yeah. And so this gets a little bit crazy now, right? It's like down the rabbit hole you go. How do I actually get this to work? So I'm going to say these things really, really cool. And this is something that we just released at our event at build. And it's still in private preview. But it's, it's, I think it's just really awesome. Like in the past, when I get stuck to a point like this, I would just jump on to Google or back overflow. Any of these things and start typing in, you know, what the heck is mutate? Like mutate examples, please help. Right. And what we've been working on is the ability to, if I right click on this mutate symbol, have you ever heard of find all references? Yeah. Cool. So tell me more. I believe that's the one where it just tells you everywhere in your code that has used that, that function beforehand. Yep. Absolutely. And so like I did a find all references on mutate, nothing too exciting, right? It's like, yeah, you, you are, you are right here in this one place. Thank you. This is great. So one, what I'm able to do now is you'll notice if I click on here, this was scoped to my loaded solution. If I select all sources, and just let me hold this up a little bit, I start seeing a bunch more results and there's these external results. And some of these repositories are different. I'm looking at, you're right. You're right. Down there. Absolutely. So what these are are actually cross repository results of code that references mutate. And why this is awesome is that instead of having to jump out to Google Stack Overflow to understand how this code is being used, I've got a list of samples right now and I can click through this. Oh my gosh. We can actually go into the other repositories just to see what this looks like. Yeah. So what it does is it actually downloads this specific file into a temp folder. And if I drag this back down, I can start looking through this specific file. Get out of here. And if I want to, I can continue to navigate through this. So, you know, this looks a little bit too complicated in terms of whatever. Yeah. It's just starting the right direction though. But yeah, it can essentially go through each of these results and each time I click one, it just downloads it into a temp folder. Once I close VS, it'll clear it out. So I don't have to worry about all of these files sitting around somewhere. Oh my gosh. This is so cool. And these are all public repositories, right? Yeah. So these are public repositories on GitHub and this is all done in the background using a service called a rich code navigation. It builds an index of all the code in the cloud so that you can access these results from VS or even VS code or code spaces. This is amazing. Wow. What's the catch? Is this just compatible with GitHub repos or can you use Azure DevOps or anything like that? Yeah. So great question. We're just starting off, as I mentioned, like, you know, we just kicked us off a build. So for now, we're scoping it to just public repos in GitHub. And we started off indexing really, really popular external packages because we figured, you know, if you're in kind of like the top 100 new Git packages, then they're ones that people use a lot, right? Yeah. So we started off with that. If you'd like to kind of nominate additional repositories to be indexed, you know, if you're working on something really cool and you want other people to kind of learn about your repository to be able to navigate to it real quickly or to find examples, you can also sign up for private preview on aka.ms slash rich code navigation. And you can nominate your repository there. So that's kind of the catch is that, like, we do, we are going to building indexes of these repositories. But right now, we started off with our first kind of stab at the best guess, most popular repos. Sure. And it's still like permission secure, and it's still permission space. So like, if you want to offer up your repository for this, then you can. Yeah. So that's why we started with public repositories. Eventually, we are, we would love to support private repositories. But as you mentioned, like, we want to make sure that everything's secure before we go down that route. You're kidding. I want to know the inner workings of everyone's new patent inventions. So to kind of finish this off, like, you know, this was the thing that I wanted to look at. I this is read only, that is the other task. But I mean, that's kind of a good thing that I'm not going around. That would be a nightmare. So but I can still copy and go back into my to do over here, paste this. And obviously, my variable here is image and the IMG. And it looks like it was resizing a very specific dimension. I want to change that to width and the height. Because that's what I had my parameters there. And look, no errors. I'm good. I can try running it. Oh, my gosh, happens on the first try to. Yeah. That is amazing. Like what person hasn't used like an external library or API like this and didn't have to Google something about how to use it or looking for examples. So that is really cool that it's now integrated within Visual Studio itself. You don't even have to leave it constantly to just understand how to implement the method. Well, I liked it. Yeah. Maybe maybe if you're interested, you can also sign up. So I'm definitely going to be signing up for this private preview like immediately after this chat. But out of curiosity, when do you think we'll be able to see this tool outside of private preview? Yeah, and sorry, we've been hiding it from you. Yeah. I feel like I've been betrayed. This has existed the whole time without my knowledge. We just need to talk more and do more of these conversations. Yeah. So private preview is right now. It started about a month ago. We're targeting public preview towards the end of this year. That is so exciting. So I can expect to see this as just like a mini Christmas present waiting for me. Awesome. So thank you so much for sharing that awesome feature, not just cross-repost search, but also the go-to task. Go to all. Go to all, darn it. I'm thinking of the control T keyboard shortcut, so I thought T for task. But go to all and of course global search and find and vials from part one. Who knew there were so many different ways you could search in Visual Studio? Yeah, to kind of make sure we got all of them covered, right? Right, cover all your bases. So what can we see in the imminent future regarding either cross-repost search or any of these other search tools? So on my side, as we alluded to, we're looking at search in areas that are outside of just the solution. So that find online tab, keep your eye on it as soon as we have more information. I'm happy to come back and talk a bit more about it and give you a demo of that. And our private preview for rich code navigation, that's definitely something you can try right now. We're still building up the indexes, still building up the repos, so this is a good chance to kind of nominate the repositories that you would like to see. Awesome. As far as finding files is concerned, a lot of the efforts we're doing right now are making sure our support for the Visual Studio Code Spaces is top-notch. But we're definitely, like I said, we're talking to the community. We're looking for those areas where the new UI really could be a little better. What are the changes that we made that don't work with your flow? What are the areas that you may have asked four years ago for something with finding files and it just kind of got forgotten about? We've gone through a lot of those backlogs, but we need to keep hearing it. We need to keep knowing those four years ago this was something we couldn't do, maybe now we can. And if people still need it, we want to hear about it. So developer community, again, that's where we want to look, but we're going to be looking for more improvements. We're also going to be looking to take those performance improvements and bring it to the other areas in Visual Studio like control F, the quick find and things like that. We want to bring those same algorithm improvements there to get that same performance, the same memory improvements that we had. Cool. And yeah, just for the record regarding developer community, we do read them. It's not just a bot reading through and triaging everything and grouping things based off of what will or won't be done. Like each of us individually will go through our related bugs that you guys share and we'll look over each and every one of them. All right. So thank you so much for telling me all the different ways that we can find code within Visual Studio. I'm looking forward to those feature updates. And with that, happy coding. Thank you. Thank you.