Archive for the ‘Tips & Tricks’ Category

Do you know where ‘Go To…’ can get you?

Thursday, January 19th, 2012

How often do you use ‘Go To Class/File/Symbol’ feature in IntelliJ IDEA? Pretty often I would guess. But do you know everything you can do with it? Let me go through a couple of often overlooked gems.

Do you know that when you search for file or class you can preview an image (Ctrl-Shift-I) or see a quick doc (Ctrl-Q)?

It is also possible to open multiple items in the editor (multiselect with Ctrl or Shift) or run multiple selected tests right from the search (Ctrl-Shift-F10).

And you can open all search results in the ‘Find’ tool-window to process them one by one later.

Did I mention your favorite feature? No? Please, share it with everyone! :)

Favorites tool-window in IntelliJ IDEA 11

Thursday, December 29th, 2011

When working with big projects we always come back to 10-20 items/files where we do the most of our work.

IntelliJ IDEA helps you collecting all these items in one place — ‘Favorites’. It’s easy to add a file, a class or a method to the Favorites by simply pressing Alt+Shift+F. You can also drag and drop items to the Favorites.

And now with ‘Favorites’ being a separate tool-window, just press Alt+2 (or Cmd+2) whenever you need to access one of your precious items again.

New in 11: Git log gets more power

Monday, November 14th, 2011

The most exciting news for me is that now in forthcoming IntelliJ IDEA 11, we show Git revisions graph!

Now that IntelliJ IDEA can visualize commits links, we’ve added context actions to tag a commit, create (and checkout) new branch, and checkout a selected revision.

I want to specifically mention the highlight actions — now you can see what commits are in “ancestors subgraph” for a selected commit. By default, IntelliJ IDEA shows HEAD subgraph, i.e. you see what commits you have in your working tree now.

It is really convenient when you are checking what commits went into some tag (or branch).

To find any commit in git log (in already shown part), use the new “Goto Commit” action — type commit hash, or description fragment, or branch or tag name, and be navigated to it.

And, finally — when browsing history, sometimes you work with a set of commits and need to track this set.

Now you can mark commits by simply pressing Space and they get stared.

New in 11: Create library from Project View

Thursday, October 27th, 2011

Did you know what in IntelliJ IDEA 10.5 you can mark a directory as a Source Root or a Test Source Root right from the Project View?

In IntelliJ IDEA 11 you also can create a library without opening the Project Structure dialog: just select jar files in the Project Structure and choose ‘Add as Library…‘ in the context menu:

The IDE will create a new library and will add it to the dependencies list of the selected module:

New in 11: Javadoc editing improvements

Thursday, October 20th, 2011

Recently I realized that javadoc editing may be easily improved by introducing some handy little features. After using them for a couple of days, I can say they are cool, so, it’s time to share them with you. And you can try them all in the latest IntelliJ IDEA 11 EAP.

The main idea is to ease fulfilling method javadoc stubs that IntelliJ IDEA generates for you:

  • Smart “End”
    Pressing End when the caret is located after javadoc parameter name relocates it to the position where description should start. It respects ‘Align parameters description’ code style setting as well (‘Code Style | Javadoc | Alignment’).
    Before:
    After:
  • Smart “Enter”
    We rather often need to write a multi-line javadoc parameter description. Now pressing Enter preserves previous line indent if a corresponding option is enabled (‘Editor | Smart Keys | Enter | Smart indent’).
    Before:

    After:
  • Smart complete statement
    Corresponding support is added for smart complete statement (Ctrl+Shift+Enter by default).
    Before:

    After:

Debugger: working with sub-ranges for arrays and lists

Friday, September 30th, 2011

During debugging IntelliJ IDEA shows only the first 100 elements of arrays and collections. It’s enough in most cases. However, it’s sometimes convenient to use a custom range. Exactly for this the ‘Adjust Range’ action has been available for arrays for quite a long time. But recently we’ve made a couple of improvements to it. Namely:

  • ‘Adjust Range’ works with lists now
  • adjusted range is preserved for local variables delivered to another stack frame

Quick demonstration example:

  1. Start debugger and wait until target break point is hit;
  2. Right click on target array/list and select the ‘Adjust Range…’ action:
  3. Define a range:
  4. Check the result:

Refactoring in IntelliJ IDEA, Live by Robert C. Martin (Uncle Bob)

Monday, September 12th, 2011

It’s still over 3 months before the holiday season, but we just got a great present from our long time friend Robert C. Martin (Uncle Bob) — a live refactoring demo performed by the legendary software expert himself. He’s, of course, using IntelliJ IDEA!

Check out this video where Uncle Bob shows some refactoring techniques transforming a “large and ugly” function into a clean and readable piece of Java code, using such refactorings as Rename, Extract Method, Inline Variable, and others. We learn something new every time we watch experts like Uncle Bob.


You can also watch this video on JetBrains TV.

The video is part of the highly recommended “Clean Code” series of educational “code-casts.” More Clean Code videos are available at cleancoders.com.
Robert C. Martin (Uncle Bob) is the Master Craftsman at 8th Light Inc., 8thlight.com.

As a separate note, Robert C. Martin has recently released a new book “The Clean Coder: A Code of Conduct for Professional Programmers” which we think is a must read for every professional software developer.

Enjoy the demo and develop with pleasure!
-The JetBrains Team

New in 11: Changes digest for easier pre-commit review

Friday, September 9th, 2011

As for me, after a few years of working in a huge project inside a big team, I became concerned about accidentally breaking the project.

That’s why every time I commit something, I double-check my changes.

In the forthcoming IntelliJ IDEA 11 EAP, I have a special “digest” changes presentation for that!

It helps me in my last pre-commit check immediately inside the commit dialog:

And I also use it all the time when coding, to recall my changes:

NB: to see the digest of changes in Changes | Local, use the new “Change Details” toolbar button.

To tell the truth, even when I was in the middle of this “digest” changes feature, I simply couldn’t live without it, so I compiled a build of IntelliJ IDEA for myself and used digest view while developing the digest view!

IntelliJ IDEA 11 EAP is to be announced any day now. Stay tuned!

IntelliJ IDEA does not show some files? Know the hiding-places

Thursday, April 28th, 2011

Have you ever found yourself in a situation when there is a file that exists on the disc but IntelliJ IDEA doesn’t show it anywhere? You press synchronize but nothing happens? OK, may be the next few tips will be helpful.

  • Check “Ignored files and folders” in File | Settings | File Types:
  • Check “Excluded roots” in File | Project Structure

Your files are shown in Project View but they are missed at runtime?

  • Check compilation patterns in File | Settings | Compiler
  • Check that they were not excluded from compilation in File | Settings | Compiler | Excludes

We hope that these simple tricks will save your time as well as ours. :)

New Diff Tools in IntelliJ IDEA 10.5

Monday, April 25th, 2011

We at JetBrains know how important it is to track what has been changed in your project from one version or revision to another. This is why IntelliJ IDEA 10.5 brings you new Diff Tools for comparing local directories, DB objects (Data Sources, Schemes, Tables). In later updates we’re planning on including even remote to local files comparison as well. Diff Tools are available via Ctrl+D, or from context menu, wherever you may need them.

Say, to compare two Data Sources (or Tables, or Schemes, come to that), all you need is select them in Data Sources tool window, and then invoke the Compare action either from context menu, or via toolbar:

Comparing two local folders is just as easy: the action is available in Project View file tree.