Home > Java > javaTutorial > body text

⌨ DE Shortcuts I Use Daily

DDD
Release: 2024-09-19 06:29:37
Original
522 people have browsed it

This is a repost from the Software Mastery newsletter. If you like what you see, consider subscribing to get emails delivered right to your inbox!

Welcome to the second issue of the Software Mastery newsletter.

In this issue, I want to share three shortcuts you should be aware of when navigating large codebases as a software engineer:

  1. Search for a file by name.
  2. Search for a string in your codebase.
  3. Jump to declaration (and back).

Whether you're new to a codebase or an expert, these shortcuts will make you more productive at finding what you’re looking for.

Since I primarily use IntelliJ, my examples will be for this IDE. However, all the mentioned shortcuts should also be available in other IDEs.

Search for a File by Name

Sometimes, we know the name of the file we want to find, but we either don’t remember which folder it is in or don’t want to expand a bunch of folders in an IDE’s file explorer to get to it.

In these cases, it’s useful to know how to search for a file by name. In IntelliJ, one way to do this is Ctrl Shift N, which opens the search everywhere window on the "Files" tab.

In this window, you can type the name of the file you want to open. For Java and other object-oriented programming languages, you’ll want to type the name of a class here (e.g., MyAwesomeClass).

Bonus tip: The search anywhere feature employs a kind of fuzzy search, so for a class like MyAwesomeClass, you can get away with typing the first letter of each word:

⌨ DE Shortcuts I Use Daily

Search for a String in Your Codebase

Searching for a string in a codebase is useful for various reasons:

  1. You can search for examples of how to use some class or method.
  2. You can find comments or documentation you vaguely remember reading before.
  3. You can search for a piece of code you want to navigate to, even if you don’t remember the file it’s in.

In IntelliJ, you can search for a string with Ctrl Shift F, which opens the find in files window.

⌨ DE Shortcuts I Use Daily

Jump to Declaration (and Back)

Finally, the last shortcut I want to share is actually a pair.

When working in an unfamiliar codebase, you often need to read code written by other people, which invokes more code written by other people, and so on.

For your sanity, you’ll want to know how to jump to the declaration of a class, method, or field and how to go back to where you were before.

In IntelliJ, you can jump to declaration with Ctrl B. To go back, one option is Ctrl Alt Left Arrow.

⌨ DE Shortcuts I Use Daily

Your Turn!

I hope this week’s issue convinced you to use these three IDE shortcuts in your day-to-day work.

Are there any other shortcuts you can’t live without? Reply to this email or comment below to let me know!

Thanks for reading!

Sammy

The above is the detailed content of ⌨ DE Shortcuts I Use Daily. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template