Eyes Above The Waves

Robert O'Callahan. Christian. Repatriate Kiwi. Hacker.

Monday 8 November 2010

Eclipse Breakthrough

I've been using Eclipse for quite a while now as my code editor. A few years ago I tried using the "smart" CDT features on Gecko but they didn't work very well. Now, five years later (how time flies!) I am very pleased to report that they work much much better! I'm sure the software has improved (Eclipse 3.6.1, CDT 7), but my laptop now having four CPU cores and 8GB of memory has probably helped too :-).

I create an "empty" C++ project with the source directory pointing to an existing hg repository. I turn off the automatic build options, but enable all the indexing features. I turn off the "scalability" option for the C++ editor --- setting the number-of-lines threshold to 100,000 doesn't seem to cause any problems for me. In the project properties, I add resource filters to exclude everything under the .hg and object directories. In the "Paths And Symbols" page of the project properties, I add all the symbol definitions from the generated mozilla-config.h file of my debug build. This probably could be automated but I did it manually. Then I let the indexer run to completion. It doesn't take very long --- minutes, not hours.

With all that done, many features seem to mostly work, at least in layout and gfx code:


  • Ctrl-click on an identifier jumps to its definition
  • Ctrl-click on an identifier at its definition jumps to the declaration if there's a separate declaration
  • Hovering over an identifer shows its definition
  • Opening a "Type Hierarchy" shows the superclasses and subclasses of the selected class (or the class of the method containing the caret)
  • Opening a "Call Hierarchy" shows the callers/callees of the selected method
  • Opening "Quick Type Hierarchy" on a virtual method declaration shows the classes implementing that method
  • Opening "References / Project" shows all references to the selected declaration
  • Context-sensitive autocomplete often works.

All very useful! And all very smooth and fast, on my laptop anyway. Major kudos to the Eclipse team, this should really improve my productivity.

Of course, it's not perfect. For example, autocomplete after "foo->", where 'foo' is an nsCOMPtr or nsRefPtr, doesn't seem to work. However, the features work well enough that I'm getting into the habit of using the features and expecting them to work.



Comments

Sid
Yeah, I'm honestly pretty amazed they got intellisense for foo-> working in VC++.
Jason
Have you tried using an HG plugin for Eclipse?
Robert O'Callahan
I have used one of the hg plugins in the past. It was pretty good, but I'm not sure it's a win over using the command line for me.
Philipp
I fully agree. I use Eclipse for Mozilla development for about two years now and it's amazingly stable and fast (building the initial index takes around 30 minutes here). I especially love the complete resolution of macros.
FACORAT Fabrice
NetBeans may be a good solution and many people are saying that NetBeans is faster than Eclipse
gleason ricardo
good you will rather substantially get employing your info all the period https://itunesdownloadapp.com First of all, let's speak about the caveats of employing Play Music nice.
KellieWilliams
your setups to keep your personal privacy as well as various playstoreapp.co you have to download and install BlueStacks Android Emulator