How can I enable autocomplete in Eclipse? I can't find it!
If you would like to use autocomplete all the time without having to worry about hitting Ctrl + Spacebar or your own keyboard shortcut, you can make the following adjustment in the Eclipse preferences to trigger autocomplete simply by typing several different characters:
Eclipse > Preferences > Java > Editor > Content Assist
Auto Activation > Auto activation triggers for Java
Enter all the characters you want to trigger autocomplete, such as the following:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._
Now any time that you type any of these characters, Eclipse will trigger autocomplete suggestions based on the context.
By default in Eclipse you only have to press Ctrl + space for autocomplete. Then select the desired method and wait 500ms for the javadoc info to pop up.
If this doesn't work go to the Eclipse Windows menu → Preferences → Java → Editor → Content assist and check your settings here
window->preferences->java->Editor->Contest Assist
Enter in Auto activation triggers for java:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._
Apply and Close
other method:
type initial letter then ctrl+spacebar for auto-complete options.
For auto-completion triggers in Eclipse like IntelliJ, follow these steps,
Go to the Eclipse Windows menu -> Preferences -> Java -> Editor -> Content assist and check your settings here
Enter in Autocomplete activation string for java:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._#
Apply and Close the Dialog box.
Thanks.
For anyone having this problem with newer versions of Eclipse, head over to Window->Preferences->Java->Editor->Content assist->Advanced and mark Java Proposals and Chain Template Proposals as active.
I am not sure if this has to be explicitly enabled anywhere..but for this to work in the first place you need to include the javadoc jar files with the related jars in your project. Then when you do a Cntrl+Space it shows autocomplete and javadocs.
If you are only unfamiliar with the auto-complete while typing syntax or inbuilt methods in the eclipse you can simply type the desired syntax or method name and press Ctrl+Space that will display the list of desired options and you can select one of them.
If the auto-complete option is not enabled then you have to check your settings from Windows menu -> Preferences -> Java -> Editor -> Content assist
If the auto-complete option is not enabled then you have to check your settings from Windows menu -> Preferences -> Java -> Editor -> Content assist->Advanced and mark Java Proposals and Chain Template Proposals .
In Eclipse click Windows Drop-Down > Click Preferences > Navigate to Java > Editor > Content Assist
In order to Make the Auto suggestion/completion to work you have to set trigger that invoke the Auto Completion.
Now go to,
Auto Activation > Auto activation triggers for Java
Enter all the characters you want to trigger autocomplete to be
invoked in Eclipse IDE, such as the following:
Alpahabets: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
OR
Special Characters: ~!##$%^&*()_+=-:;'"|?/.,
OR
Any combination of Alpahabets & Special Characters.
Now based on the references, Eclipse will trigger autocomplete suggestions for you.
For me, it helped after I changed the theme to 'mac' since I am running on a MacOSX.
Eclipse: >Preferences > General > Appearance > Choose 'Mac' from the menu.
Related
I use Netbeans 7.2.1, when I type private String a(Java code), the IDE shows a tip window aString which asks me to name a variable with its type as postfix. In addition, when I continue to type ;, it completes the code with private String aString;. Actually, I do not like this naming style, so, how to change the settings?
For windows :
Go to Tools > Options > Editor > Code Completion
Select Language Java from dropdown
Auto pop-up on typing any Java identifier part
You can take help from the images below:
Under Preferences -> Editor -> Code Completion is where you can find the auto complete properties. You can disable the 'Auto Popup Completion Window' to keep it from automatically popping.
You can bring up the auto complete popup with the hotkey: control+space
Also while the completion window is displayed, pressing the esc will close it without inserting an autocomplete value.
Go to: Preferences -> Editor -> Formatting.
In the drop-down box "Language", choose "Java".
There are many other categories you can choose from and you can customize your code formatting style there.
I tried using the Toggle mark occurrences (Alt + Shift + O) button and also in Preferences -> General -> Editors -> Text Editor -> Annotations and setting the C/C++ Occurrences and C/C++ Write occurrences. But still when I select a word it won't highlight all occurrences of that specific word.
What I am using is Eclipse Indigo Service Release 2 in XP, with a C++ project.
You can try to activate Toggle Mark Occurrences with icon on Toolbar:
Preferences --> Java --> Editor --> Mark Occurrences
In General > Editors > Text Editors > Annotations
Check out options that are checked in Preferences -> Java -> Editor -> Mark occurrences. Then restart Eclipse.
Find the Preferences under Window,
In General > Editors > Text Editors > Annotations(1)
(5) is to select the color and press apply.
The standard "Mark Occurrences" functionality included in Eclipse that everyone recommends only highlights identifiers in editors of whatever language. For example, it won't highlight int in C editors, and it won't help at all in the Console pane.
So if you want to highlight ALL occurrences on ANY word in ANY Eclipse pane (kinda like Notepad++ does), try the Glance plug-in for Eclipse.
As of November 2017 Glance works for Eclipse Neon and Oxygen. There was a period of time in which Neon was unsupported, and a fork appeared, but it seems unnecessary now (and abandoned).
There are two ways to highlight all occurences. First is using Eclipse options, which is not very reliable, because in many versions of Eclipse it is not supported.
Second is using a plugin called Glance which is available in Eclipse marketplace. This is supereasy and effective.
First Method
In the toolbar, there is button for Toggling Mark Occurrences. So, once you selected the text/word whose occurences you wish to highlight, then click this toggle button.
Let's say this step doesn't work for you. Then, Follow this step:
Goto: Window ==> Preferences ==> General ==> Editors ==> Text Editors ==> Annotations ==> On right Annotations types box: Occurrences ==> Select all check boxes.
You can also go to Window ==> Preferences ==> Java ==> Editor==> Mark Occurrences ==> Check all the checkboxes.
Restart Eclipse and check if highlighting works.
If still doesn't work, then Go to Second Method
Second Method
From Eclipse marketplace, install Glance. Once installed, restart Eclipse.
Now select any word in your eclipse editor
Move focus to component where you want to search
Open Glance using Ctrl + Cmd + F shortcut on Mac or Ctrl + Alt + F on other platforms
Enter text you want to search
Use Enter or **Shift + Enter** to find next/previous match
Close search box using Esc
You can also customize Glance from Window ==> Preferences ==> Glance
For Eclipse Mars:
Window --> Preferences --> Check (Mark occurrences of the selected element in the current file.)
As shown if figure:
Go
Java> Editor > Mark Occurrences
Uncheck "Keep Marks when the section changes" then click Ok
Restart Eclipse.
This work for me.
If you go into the window-prefrences, select the language you want/are working with. Select the editor under this specific language and then there is a mark occurrences there that has some options. Where it says keep marks when the selection changes, for me this was checked. When I unchecked it the system started highlighting correctly.
For folks who are using a dark background with light font colors, you may want to check out the highlight color in Preferences -> General -> Editors -> Text Editor -> Annotations. Mine was defaulted to black, which does not stand out on a black background.
Glance does not work anymore, but in current Eclipse Versions (Eclipse 2020) you can
highlight any word by selecting the word and pressing CTRL+F. The word is now highlighted. In the small search input, you can toggle 'match whole word' and case sensitivity.
I'd like to complement the other answers - which work in Java editor only or require plugins - with a way to highlight all occurrences of any text (not just a word or identifier) in any editor of text files (e.g. SQL, CSV, HTML, TXT, Java, etc ...).
There is a standard/built in command called Find Text in File (under Window -> Preferences -> Keys)
By default it has no keyboard shortcut assigned. Simply give it a shortcut (e.g. Ctrl+Alt+S) select some text (not necessarily a word) and it will find and highlight all occurrences of that selected text.
It can also be invoked from the menu as Search -> Text -> File.
Enjoy 🙂
Click the word and hold until a popup appears as shown in the figure.
On the popup, there is a little right arrow, after clicking it, a new icon shows up.
Click that link to open preferences.
Once in preferences, select C/C++ Occurrences (it will be language specific) and select Include in next/previous navigation with Text as Highlighted.
This should enable the feature of highlighting all occurences of the selected word in the opened file.
Is there anyway to make Eclipse activate autocomplete after I type 2 characters without a space, sort of like Flash Develop?
Also is there a way to turn off variable name suggestions?
Thanks
What type of code are you autocompleting? If you go to Window -> Preferences in Eclipse and filter by Content Assist, you can get to the preferences that you can change for your autocompletion. The options available depend on which Eclipse editor you're using though. Also, hitting Ctrl + Space at any time should activate autocompletion.
How do you disable content assist in Eclipse?
I do not mind allowing it to come up when I press ctrl & space, but I do not like how it automatically comes up as I am typing. It just messes me up. For instance it, I would end up scrolling through the options when I just want to go up a line. It is getting tedious having to press escape whenever it decides to pop up.
I have found the page in the preferences for it, but I cannot seem to find out how to disable the auto-pop-up.
EDIT: I am using the application for android development. I have already disabled "auto-activation" for both Java and XML, but it does not seem to have an effect. The window will still pop up automatically.
EDIT2: I tried restarting the program after making the changes, but it still had no effect. I made sure that the option changes were still in effect, and they were still in effect.
This Eclipse3.6 Help page on Content assist can help (it is for C++, but the same idea applies for Java on the Java > Editor > Content Assist preference page.):
The idea is to disable what triggers the content assist.
Go to Window → Preferences.
In the filter text search bar, type "typing".
Go to Editor → Typing.
Uncheck all that you don't want.
Don't know if you did get it to disable but I was having the same trouble as you.
I did the following:
Window > Prefrences > Content Assist
Uncheck all and hit apply
Java > Editor > Content assist > Advanced
Uncheck all and hit apply.
Hope this works if you still haven't found an answer.
It's not readily obvious and there doesn't appear to be a global option to turn it off all over the place. This may sound obvious, but it's important to make sure to turn off Auto-Activation on all of the different structured editor types that you do not want it active on.
In Eclipse Mars.1 :-
go to Window then->preferences -> Java -> Editor -> Content Assist ->Advanced -> Restore Default ->Apply and then OK.
Go to Window -> Preferences -> PHP -> Editor -> Content Assist -> Auto Activation
Untick the box "Enable auto activation"
Some days ago my Eclipse was working fine and a +/- appeared in every block that could be collapsed (functions, classes, etc.)... but now it does appear, and I don't know how to activate that feature again.
It's Eclipse Helios, running on a Gentoo Linux box.
Preferences -> C++ -> Editor -> Folding ?
Make a right click in the editor window and go to preferences there, then only the editor-relevant section of the preferences dialog will appear. This works for JDT, CDT etc...
You can do ( Ctrl + Numpad_Divide ) to enable folding.
Also if you Right Click on the area where the + or - was supposed to be, you can see there is a folding option.
Try this option: Preferences > Java > Editor > Folding > Enable folding
To collapse all code blocks
Ctrl + Shift+ /
To expand all code blocks
Ctrl + Shift+ *
pydev:
To collapse all code blocks :
Ctrl + 0
To collapse all code blocks :
Ctrl + 9
Is there a way to collapse all code blocks in Eclipse?
by #partizanos and #bummi
For Python it is as follows:
collapse all 1 level: Ctrl+9
expand all 1 level: Ctrl+0
collapse current: Ctrl+-
expand current: Ctrl++
Hope that helps.
In Preferences, you'll find General > Keys. It's for setting your keyboard shortcuts.
What I use it for more often, though, is to find stuff in Eclipse. You should see an input box labelled "type filter text." It's as close as Eclipse comes to a search feature for every Eclipse command.
I assume you are using Java, but look under the settings for your particular language.
Under the Window menu, select Preferences.
Under Java->Editor->Folding. Select "Enable Folding".
If you want folding an all your editors, I found you can enable Folding in
Preferences > Editors > Structured Text Editors
Enable Folding
For windows eclipse using java: Windows -> Preferences -> Java -> Editor -> Folding
Unfortunately this will not allow for collapsing code, however if it turns off you can re-enable it to get rid of long comments and imports.
Here you go!
Right Click on + button appeared on numbering strip on left most side --> Folding --> Expand All
Right Click on + button appeared on numbering strip on left most side --> Folding --> Collapse All
This way you can expand and collapse all the methods on the file.
Plus Buttons on numbering strip
Context Menu:
Context Menu
In CFEclipse:
Preferences > CFEclipse > Editor > Code Folding > Initially Collapse column, you can uncheck to see all expanded when opening, or check all boxes to close all when opening a file.
I was using salesforce apex classes with Eclipse Neon 3.3 for Java. I found an option "define folding region" on right click in the editor, I selected the block of code i wanted to collapse and selected this property for that code. Now I am seeing + and - symbol to expand and collapse that block of code