Skip to main content
View on YouTube to comment and like!

Syntax Video

MAXIMUM VS Code Productivity β€” Navigating Codebases Quickly

Chapter 1 0:00

Intro

one of the biggest productivity gains you can have as a web developer is getting very good at navigating through your editor I'm talking about being able to find the function that it is you're trying to work on be able to open up the file that it is that you need being able to navigate between two different parts of the codebase that you're working on or uh be able to select and highlight and cut and paste and edit the parts of your codebase without having to spend too much time on it if you can get really fast and efficient at those things you can have a lot more time to actually work on solving hard problems in your codebase so this is 15 or so of my favorite techniques for doing it some of them are just little tips and tricks and other ones are reframing sort of how you think about navigating through your codebase you have here is called go back and if you need to know what the keyboard shortcuts are I'll throw them up on the screen but you can always open up your command pallet with the command shift p and just type in the name of the command that we're doing you're going to

Chapter 3 2:11

Jump to Last Edit Location

Chapter 5 3:35

Goto Line and Columns

when I have a minified JavaScript bundle and I it's tells me something like line one of course it's all on one line but you want to go to character 3000 to be able to see what actually went wrong you're probably aware that you can open up files as well so if you hit command p and you search something like tb. TS you can open up the file by that specific name and and you're you're up and running right there right I often use that with fuzzy search as well because things like nextjs have everything named page. TSX um so if I'm looking for the tips page I'll just type in like tips and Page there and now it will fuzzy search it based on the contents of that search now going to a specific file is good but going to a specific symbol is even better so in vs code a symbol is something like a function or a variable or a CSS selector or a markdown heading so if you open up your command pallet

Chapter 6 4:06

Fuzzy Search Files

Chapter 7 4:38

Goto Symbols

and then type in at this will show you a listing of all of the symbols in that specific file and if you put a colon on the end it's actually going to group them based on the type of symbol that you want so you see I have two functions in this file and six different variables that searches in the current file but you can also search on a workspace level so if you hit command t or if you open up your command pallet and put a pound in there it's going to give you every single symbol in the entire project and you can then quickly search for what it is that you're looking for so here I'm looking for something related to the database and it's showing me all of the DB symbols that are in my whole project that's great because if you can move from thinking in terms of your project as a bunch of files to I just need to jump to

Chapter 8 4:53

Goto Symbol in Workspace

either where I last edited this thing or where I was last looking at it with my cursor or I need to move to this spefic specific function I don't know where it is I might not even care where it is a lot of people just hide their tabs because they don't care about it I just want to go to wherever that function has been defined and being able to open up that symbol right like this let's go to get DB boom immediately brings it right to me so open up your command pallet we've talked about using at we talked about using pound to go to symbols but you can also just use the command pallet to do a search in your files with the percentage sign so if you type in percentage sign in something like DB that will search your entire project for the word DB and you can just kind of go through it all and it will preview them in real time this is much better than the sidebar search um for when you're quickly just trying to find something in your project I'm big fan of it you can click on this button right here to open

Chapter 10 6:57

Goto Definition

Chapter 11 7:20

View References

code base that you are unfamiliar with because you don't know where where anything is you can simply just click through to all the pieces vs code knows about your application knows about your Imports and your ports knows about all of your symbols so rather than doing everything based on text search use the references and symbols on how they're all connected to each other all right let's talk about editing lines of code uh rather than moving from file to file first one is copying a line up or down so I have this file here and this line needs to be duplicated so I'll hit my option shift Arrow key and down and that will duplicate the line and put me on that line if you want to stay on the line you can use the other arrow keys you go up and that will duplicate it underneath it but keep your cursor on that current line now I also really like to use what's called line bubbling which is I want to move this line up in this array so what I'll simply do is hold my option key and use my arrows and this

Chapter 12 8:08

Line Bubbling

will bubble it up and down it works with multiple lines as well so you can move them up and down I use that all day long to rearrange items that are inside of it next we have have the ability to move and select and move your cursor by line by word by file by letter so this is really important for being able to move around quickly without having to use your mouse so of course you know how to move letter by letter you just use your arrow keys um but most importantly I find myself just almost always just moving through word by word so if you throw your option or alt into the mix and use your arrow keys now all of a sudden we're jumping word by word right and you'll notice that this post table right here by the way if you hold you throw in shift that will allow you to select word by word or letter by letter depending on what you're you're doing um but you see I have this post table here and it assumes that post table is is one word now under using underscore gang won't care about this but if you're

Chapter 13 8:58

Move + Select by Word

Chapter 14 9:39

Select by Word camelCase

using camel case you want to be able to select word by word you can throw in uh control into the mix and what that will do is now you're jumping word by word but it's taking the capital into account so I have this post table here and I want to select the actual just the word posts right I could like a sucker hit my mouse five times um but you can hit option control shift and right arrow and now that just selects just the word posts and then I'm going to hit my command D two more times to select the other instances that I have and I can just go ahead and rename it to the values that I'm looking for so jumping word by word is really good being able to jump to the beginning and the end of the line is really key so that's just holding command um and using my arrow keys to jump back in fourth if a line is wrapped you'll see that this line right here is wrapped around the thing you hit it once to get to the end

of the line uh the visual line and then you hit it a second time and that's going to get you to the actual end of the line now once you do have something selected sometimes you want to expand the amount that you are selected so if you open up your command pette and just type in expand to this expand selection to scope is really handy because what it will do is it will sort of just creep out scope by scope um and allow you to do it so sometimes you got to do it a couple times to get exactly what you want oh there we go the whole object that I'm passing to this argument now I have that selected I can go ahead and cut it and put that into a value here and then go ahead and pass the query in there now I love that but it doesn't work with strings and almost always I'm finding myself needing to select everything inside of a string so I have this plugin called quick and simple text selection and what it does you can hit command K and then just a semicolon and

Chapter 15 10:52

Expand to Scope

Chapter 16 10:55

Expand to Quotes

it will expand your selection to the stuff that is inside of the quotes works with backck single and double quotes you can also use the same plugin to toggle quotes which I find really handy so if I have a string right here and his name of web almost always have use pretty or something like that it'll just fix the quotes but if you do need to explicitly toggle what the quotes are guess if we just hit our Command quote and it will cycle your string through the three different kinds of quotes that you use in JavaScript or two different kinds of quotes that you're using in um whatever other weird language you're using last little tip I have here is turn on breadcrumbs this little bar right here in vs code shows you your breadcrumbs and it shows you um kind of where you're at and nested inside of your code base um but it can be really handy if you want to uh be able to switch between symbols that are in your project see like look at this we've got all the different symbols there and you can quickly find one if you want to be able

Chapter 17 11:52

Toggle Quotes

Chapter 18 11:54

Toggle Quotes

Chapter 20 13:12

Goodbye

Quote it with credit and a link. Quoting Syntax