REW

How To Add Auto Suggestion In Eclipse?

Published Aug 29, 2025 4 min read
On this page

The built-in auto-suggestion feature in Eclipse, known as Content Assist, is a powerful tool for accelerating coding. While it can be manually triggered with a keyboard shortcut, you can enable it to activate automatically as you type by adjusting a simple preference setting.

How to enable and customize auto-suggestions

Step 1: Open Eclipse preferences

First, open the main preferences dialog in Eclipse.

  • On Windows and Linux: Go to Window > Preferences.
  • On macOS: Go to Eclipse > Preferences.

Step 2: Navigate to Content Assist settings

In the Preferences window, use the search bar or the navigation tree to find the relevant settings.

  1. Expand the Java section.
  2. Expand the Editor section.
  3. Click on Content Assist.

Step 3: Configure auto-activation triggers

In the Content Assist pane, look for the "Auto Activation" section.

  1. Enable auto activation: Ensure the "Enable auto activation" checkbox is checked. You can also adjust the Auto activation delay here, which is the amount of time Eclipse waits before displaying suggestions.
  2. Define triggers for Java: In the "Auto activation triggers for Java" text field, you can specify the characters that cause the suggestion box to appear.
    • The common, most effective setting is to enter all lowercase and uppercase letters, the dot operator, and other special characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._@.
    • The period (.) is a critical trigger for suggesting methods and fields for an object.
    • The at-sign (@) is helpful for triggering annotation completion.
  3. Refine proposals (optional): Click the "Advanced" button to fine-tune the types of suggestions that appear. In the dialog, ensure that relevant proposal categories, such as Java Proposals, Java Type Proposals, and Java Non-Type Proposals, are selected. This is also a helpful step if you find the default suggestions are not working as expected.

Step 4: Apply and close

After making your changes, click "Apply and Close" to save your new settings. The changes should take effect immediately.

Additional troubleshooting and tips

If auto-suggestion is still not working, consider these steps:

Use the keyboard shortcut

Even with auto-activation enabled, the manual trigger remains a fast way to get suggestions. The default shortcut is Ctrl + Space.

Disable automatic insertion

By default, Eclipse might automatically insert a suggestion if you type a character that triggers it, which can be annoying.

  1. Go to Window > Preferences > Java > Editor > Content Assist.
  2. Check the box for "Disable insertion triggers except 'Enter'".

Address common conflicts

In some operating systems, particularly on Linux (e.g., Ubuntu) and macOS, the Ctrl + Space shortcut is used for other system-wide functions.

  • On Ubuntu: This shortcut is often assigned to change keyboard input methods. You must reassign it in your system's keyboard settings.
  • On macOS: Check System Settings > Keyboard > Input Sources to unbind Ctrl + Space from the "Select next source in Input menu" feature.

Refresh your project

Sometimes, Eclipse's internal index becomes corrupted. To fix this, try the following:

  1. Right-click your project in the Package Explorer.
  2. Select "Close Project".
  3. Right-click the project again and select "Open Project".

Check for corrupted workspace

If refreshing the project doesn't work, there may be an issue with your workspace.

  1. Close Eclipse.
  2. Rename the .metadata folder inside your workspace directory.
  3. Restart Eclipse, which will create a new, clean workspace.
  4. Re-import your projects using File > Import > General > Existing Projects into Workspace.

Install language-specific extensions

For languages other than Java (e.g., C/C++, JavaScript), ensure you have the correct Eclipse plug-ins installed. The configuration for Content Assist may also vary slightly depending on the language.

Enhancing your auto-suggestion experience

Beyond basic auto-activation, you can use these features to boost your productivity with Content Assist:

Template proposals

Eclipse can generate boilerplate code from templates, which are also suggested via Content Assist.

  • Typing sysout and pressing Ctrl + Space will generate System.out.println().
  • Typing main and pressing Ctrl + Space will generate the public static void main(String[] args) method signature.

Organized imports

Use the Ctrl + Shift + O shortcut to automatically add and organize any necessary import statements, which ensures Content Assist can correctly identify classes from imported packages.

Generating getters and setters

You can auto-generate accessor methods for your class fields.

  1. Right-click within your code.
  2. Select Source > Generate Getters and Setters....
Enjoyed this article? Share it with a friend.