Looking for any tips you all might have for making this easier.
Ask HN: How Do You Navigate Code?
1–10 of 39 posts
Re: Ask HN: How Do You Navigate Code?
#2Re: Ask HN: How Do You Navigate Code?
#3F12: Go to definition
Shift+F12: Go to usages
Ctrl+-: Go back
Ctrl+Shift+-: Go forward
Once you get used to it, it's as easy as browsing the web.
Since I started using VSCode I did not have to work with codebases that were complex enough to make these features valuable but some VSCode language extensions support tree views of call hierarchies and type hierarchies. Here's the documentation for the Java extension.
https://code.visualstudio.com/docs/java/java-editing#_call-h...
https://code.visualstudio.com/docs/java/java-editing#_type-h...
You can set keybindings for them too.
Re: Ask HN: How Do You Navigate Code?
#4I use VSCode and mostly navigate via: F12: Go to definition Shift+F12: Go to usages Ctrl+-: Go back Ctrl+Shift+-: Go forward Once you get used to it, it's as easy as browsing the web. Since I started using VSCode I did not have to work with codebases that were complex enough to make these features valuable but some VSCode language extensions support tree views of call hierarchies and type hierarchies. Here's the docu…
Sometimes I do this by just adding a comment, and now that file will at least show up in version control as changed and I can get back to it if I need to, but that's also a little bit janky and I have to be careful I don't leave that cruft around on accident when I commit.
I'm trying out a bookmark extension in VS code and we'll see how it goes, I'm already a little bit annoyed by it in that it doesn't seem to let me organize the bookmarks in any way, so it might be somewhat useful for temporary spelunking, but I won't for example be able to save these bookmarks to refer to them later, which seems like it could be useful.
Sourcegraph has this concept of "Notebooks" which allows you to add files and intermix markdown, which feels like a pretty cool idea, and if I'm just reading code in Sourcegraph it's great, but when I'm in my code editor and making changes I don't want to bounce over to another tool. Maybe it's as simple as keeping some sort of Markdown file open that I write into and then add links to file line numbers as I go, I haven't tried that but I suppose it wouldn't be the worst, and allows me to organize the links in any fashion I see fit.
Re: Ask HN: How Do You Navigate Code?
#5I use VSCode and mostly navigate via: F12: Go to definition Shift+F12: Go to usages Ctrl+-: Go back Ctrl+Shift+-: Go forward Once you get used to it, it's as easy as browsing the web. Since I started using VSCode I did not have to work with codebases that were complex enough to make these features valuable but some VSCode language extensions support tree views of call hierarchies and type hierarchies. Here's the docu…
Re: Ask HN: How Do You Navigate Code?
#6Re: Ask HN: How Do You Navigate Code?
#7I use VSCode and mostly navigate via: F12: Go to definition Shift+F12: Go to usages Ctrl+-: Go back Ctrl+Shift+-: Go forward Once you get used to it, it's as easy as browsing the web. Since I started using VSCode I did not have to work with codebases that were complex enough to make these features valuable but some VSCode language extensions support tree views of call hierarchies and type hierarchies. Here's the docu…
I use these as well, but maybe something I didn't articulate well is that it's often useful to remember where I've been. One thing that I haven't played with in VS Code but that bites me a lot (and sorry, I don't know the proper name for this setting/feature) is that often when you're navigating you're doing so in the same vs code tab. If I remember to double-click the tab it'll hang around, but that's a pretty janky…
It follows you around as you navigate search results and files and you can add searches, files, and file ranges to it, as well as notes for each item. Quick demo video: https://storage.googleapis.com/sourcegraph-assets/docs/image...
Re: Ask HN: How Do You Navigate Code?
#8- gd = go to definition
- gr = open a hovering window filled with references to symbol
This is enough to get through every codebase I've yet encountered (Go, Typescript, Python, Java, C++). I also like to use and in vim which allows you to jump between the most recently viewed locations.
For keeping context, I just write everything down! Either in a scratch file or on a digital notetaking app on my iPad.