What is the keyboard shortcut for method suggestions in Eclipse on Mac OS X?

In Eclipse on Windows can I press myObject.ctrl+space to get a list of all methods for the object. But on Mac OS X this doesn't seem to work. I have tried ctrl+space, cmd+space and alt+space but nothing seems to work.

What is the keyboard shortcut for method suggestions in Eclipse on Mac OS X?


Solution 1:

By default I believe it's ctrl+space. You can check by going to Preferences > General > Keys and filtering for 'content assist'.

If it's not working, you may have a binding from OS X or another application overriding it. If a window with a blank list is popping up, you may need to adjust which suggestions are shown by default in Preferences > Java > Editor > Content Assist > Advanced. You can continue pressing the binding to cycle through the different types of suggestions.

Solution 2:

For OSX Mavericks/Yosemite and later/earlier versions.

By default, Ctrl+Space is mapped to Spotlight, therefore if you want to use this shortcut in Eclipse you'll need to unmap it:

  1. Go to -> System Preferences -> Keyboard.
  2. Click the Shortcuts tab.
  3. Select Spotlight in the left pane (see screenshot below).
  4. Untick Show Spotlight Search field next to the shortcut combination ^Space as shown in the screenshot below.

NOTE: obviously, you can just remap the Spotlight hot key to something else, in case you want to have a shortcut for it, e.g. I remapped it to Alt+F2. Keep in mind, you can always bring up the Spotlight search field by clicking it's icon (🔍 ) in the MacOS menu bar.

Now Ctr+Space will work in Eclipse

Now Ctr+Space should work in Eclipse as expected.

Solution 3:

Finally! I found how to get the keyboard shortcut for code completion working in Eclipse on Mac OS X. At work, on Linux, I use CTRL-SPACE all the time in Eclipse. Unfortunately that did not work on my MacBook: CMD-SPACE triggers the spotlight search widget and CTRL-SPACE is tied to the Quicksilver launcher in my case.enter image description here And there was much frustration. First: don't say "code completion", but "content assist" in Eclipse. To bring even more confusion, there is also the "word completion" tool in the edit menu, but that's not what you normally want (it's just limited to completing a variable name without much context sensitivity). "Content assist" offers you the usual suggestions you expect from a completion tool (function names, variables, methods, properties, modules, ...). Once I got this, it I just had to edit the keyboard shortcut for "content assist" to something that was still available (I chose ALT-SPACE).

Solution 4:

Think its shift+ctrl+space.

In my installation the equivalent to the auto suggest is unbound, but you can attach a binding in Preferences>General>Keys. The Command is called 'Content Assist (type: Java Proposals)'.