From the course: Practical GitHub Code Search

Code results - GitHub Tutorial

From the course: Practical GitHub Code Search

Code results

- [Instructor] There's a few real subtle additions to the search results for code that I think are so good that you're not going to know that you didn't have them before. They look so natural that you're really going to love it. So I'm going to start off by once again being at just github.com. Which you can get to it just by clicking on this Mona Lisa icon here. And I want to scope this properly. So I know that I'm going to be looking for something in my own code. And instead of trying to create a search or a safe search for that I always just go here to this little icon and just go to my repositories. That'll scope the search so that now if I hit slash it's already there at owner, right? And I can type something in here. So I'm going to do a try a path and for a path I could do like *.py or do some sort of regular expression if I want to. So this is going to find all of my Python code and you can see that I don't code a ton in Python. Most of these aren't even mine they're just sort of part of other packages. I could try to now go directly to this feed.py as a result. I'm going to change the owner to repo and then here I can type in planet of the web and here notice that it's already looking for things and that first result was called podcast generator. So whether I type in generator or podcast generator it'll come up and there's a couple of them. I want to go to the first one. So I'm going to hit that and it takes me to the podcast generator file. I probably want to add specifically the Python file. So let's hit the slash again, and nice it remembered everything before. So I'm going to add that path *.py. And it takes me just to the one file I have, I could really put in a sort of, put in feed.py as the path. But this'll work. So what I want to show you is what happens when I actually click on this code. Now this is the new code view and sometimes some of these things will be hidden. So there's two sidebars, one on the left and one on the right. This one shows you the commit. So notice you can go to different branches. If you have been publishing different versions of this code you can actually go to the different branches or view all the branches. And this left sidebar is like a file view. And believe it or not, it wasn't here before. As soon as I saw it, it felt like something that was there already. If you do go to code view, you get kind of the list of files. So you know this is sort of a similar thing, but it's so much more useful that when you're looking at a specific piece of code that you get the files that are also in the same directory. And you can, you know, hit the 'T' key here you can see that there's a shortcut and start typing in something in here. So say that we wanted to find the action .yml. You can also just look for things within the sub directories right here. And if you want to you can also show or hide this right sidebar. So notice that sometimes this gets docked but this is the symbols panel. And symbol is basically anything that is not plain text in your code. So if it finds a symbol something that you have entered repeatedly notice that it's automatically highlighting it for you which is pretty cool. It tells you all the places where you have used this. So the sub element method in Python I'm using over and over. And sometimes it'll try to give you a definition depending on how you're using it of what this symbol even means. And it's going to get a lot better in the future. It's going to be able to recognize symbols from a lot of different languages and even give you feedback about how you use that symbol in multiple places and also what those symbols perhaps mean. So I can do right here, click on search for symbol and it can try to find that symbol which is also a qualifier in other files as well. So you can actually search for a symbol like where did I use this specific method? Which files have I used this in? And it'll take you to that and allow you to see all the other places where you're using. And see there's great navigation here. You can also filter the symbols if you have a ton of them. And this is just such a huge improvement. But what I really love about it is that it feels like it's always been there. When user interfaces are so good that it seems like an obvious thing you know they have done a fantastic job. And this is a fantastic way to work with and also look at the code that you're dealing with on a daily basis.

Contents