[JAVA] Conveniences I've been using since migrating from Eclipse to IntelliJ IDEA (in terms of search and Git)

I used to use Eclipse until a while ago, but I was impressed with using IntelliJ IDEA. For those who are using Eclipse in the same way, I will introduce the usage that I (including members of the same project) often use. Also, if I didn't write it and it wasn't mentioned much in other articles, I'll add it. In this article

--Search-related matters --Things about git

I will write about.

There is an article that summarizes the shortcut collection, so I will write it from the perspective that is not mentioned there as much as possible. In addition, it will be introduced with the default function (although it will be more convenient if it is included) without adding plugins.

Of course, the image I'm using cannot use a work project, so I'm using a project for my personal hobby. This is an app project for you that allows you to scrape and search the schedule of Jazz live houses in Kansai. Please forgive that the code level and comments are also hobby level.

Premise of this article

Target person

――I'm using Eclipse because I'm using it at the assignment destination, and I'm using it because I've been using it for some reason. --Eclipse is used for server-side coding, and editor is used for client. ――I know IntelliJ, but somehow I keep using Eclipse. What is IntelliJ good for? --Since FW is spring, I use STS

Don't write

I will not mention the settings around in the first place.

--Differences between IntelliJ installation, free version, and paid version --How to import each framework --Git settings, etc. --How to load the project, etc.

By the way, the framework I use in my daily work is spring. At first, there was a prejudice that a spring boot project could not be developed unless it was a paid version, but if you think about it, it is still Java, so you can use it normally as a maven project or as a gradle project. However, spring-specific completion does not work (I used the paid version later, but since the newly used functions are client support and DB client function, there is no problem with Java coding even in the free version.) For server-side coding only, you can use it in the free version or in the spring project. Client (HTML, CSS, JavaScript, AltJs, etc.) support and springFW support (hibernate coding completion, some support for spring annotations? I don't know much because I don't use it.) DB client etc. will be paid version support I will.

Search

Find Action mac : shift + cmd + 9 win : shift + ctl + 9 If you somehow enter what you want to do or what you want to do, the candidates will be displayed in an instant. It's an editor and an IDE, but it doesn't start without it. Also, when I look at the articles in the shortcut collection, I don't remember the shortcuts themselves (I'll refer to what you can do), because you can instantly call up what you want to do from here, and frequently used actions. If so, the shortcut will be displayed when you search here, so you will remember it there. The image calls setting and commit from find action. fidAll.gif

Incremental search

Incremental search works by default in almost all items in IntelliJ, which is very useful. For example, if you open project View and press the key as it is, the search will start suddenly. It can be anything in the setting. The difference from other IDEs is that you can use it in the file, but it is a very pleasant experience because it does not work until increment in search, increment in git view, or only acronyms. I will.

Example in Project View projectView.gif

Examples in Recent search (recently used files or features) recentSerch.gif

search EveryWhere It is activated by pressing shift twice. There is another method called navigate class for moving classes, but I use it when moving html and js files. ss.gif Find in Path Search for a string or a few lines of strings throughout the project. The great thing is that you can edit the search location while you are searching. findInpath.gif

switcher I use it to move to the most recently used file or function, but Recent search can perform incremental search, so file movement may be faster there. switcher.gif

Jump to Navigation Bar In the project view, you can move while looking at the folder structure in the tree structure, but this is a navigation from a different perspective. navigate.gif

git edition

By default, git is also very useful. mac : cmd + 9 win : alt + 9 With version control git.gif

branches It is used when moving a branch. branches.gif

local history It's not git, but it seems to always remember editing files by default, so if you only have personal history without git, you can go back and merge the history without using git.

localHistory.gif

Search within git view

I use it on a daily basis. searchInGir.gif

compare with ... You can compare two branches. Of course you can do it with the source tree, but it is useful because the ease of viewing is different and you can merge as it is. The difference for each file is displayed. When there is a conflict in the progress of the project, I ask someone to merge the parts I touched, but I check if it's okay. I also check my merge when I feel uneasy and keep my mental health. compare.gif

Other useful editions

book mark When I was checking the logic written by other people in the past, when I was moving a method or class or trying to grasp the configuration, I thought "Isn't it like a bookmark ..." and found " It is a surprising function that is prepared when you search for "book ..". Was it also in Eclipse? IntelliJ has some features that don't disappoint, so for the time being, you can find action like "I wonder if there is such a thing," or right-click and it is usually prepared.

Add a book mark. book.gif

You can check the list of attached bookmarks and jump. showBook.gif

Finally, what is the goodness of IntelliJ (or rather Jet Brains products)

I am very particular about UX.

--Search speed (It seems that all items in the project are indexed when the project is loaded, not when searching.) --Completion speed (comparable to Eclipse completion) --Incremental search for almost all items --Easy to set up (setting in Emacs, setting various plug-ins in Atom and setting each plug-in, ...)

Such. It feels like the comfort of using it will become familiar to you as you learn new ways to use it. It seems that VS Code is very often used on clients, but I personally wanted to do server-side coding, client-side coding, DB client, and Git all in one. IntelliJ did just that, and until now client coding used Atom and DB clients used A5SQL, but I think that productivity has increased because it is now possible to integrate and develop all in one. I will.

Of course, IntelliJ has a lot of features, and I use other features besides those introduced here (debugging and features are useful, such as conditional break and watcher), and there are many features that I don't have. I think that. Also, I would like to add this if there is something like. If you are using Eclipse in a Java project, why not give it a try?

Recommended Posts

Conveniences I've been using since migrating from Eclipse to IntelliJ IDEA (in terms of search and Git)
Shortcut comparison for those migrating from Eclipse to IntelliJ IDEA (Windows)
Unable to get resources when using modules in Gradle and IntelliJ
Creating a project (and GitHub repository) using Java and Gradle in IntelliJ IDEA
[Useful to remember !!!] Easy creation of constructor and getter / setter in Eclipse
Confirmation and refactoring of the flow from request to controller in [httpclient]
Java --Introduce CheckStyle plugin to IntelliJ IDEA and reflect it in formatter