I've been looking for a method to disable automatic comment-generation in Eclipse (Mars Edition), and I found out that users could go into Window -> Preferences -> Java -> Code Style -> Code Templates and change the commenting templates as they wished, but Eclipse still automatically check-marks the "Generate comments" checkbox when creating a new file. Is there a way to disable the automatic checkmark? Thank you!
Turns out users don't have to edit all the code templates to get rid of automatic commenting!
Once navigating to the Code Templates Panel from the path described in the question, there's an option at the bottom of the panel to "Automatically add comments for new methods and types." Once you uncheck this box, Eclipse will no longer check the box to generate comments automatically when creating new files.
I got to InteliJ from Eclipse. So, I am programming in Java (for Android) in InteliJ now.
I have problems with FOLDING (collapse/expand) style in IntelliJ.
This is a sample of code folding in Eclipse (and I love it) :
and This is code folding in Intellij (or Android Studio) and I hate it :
Is it possible to convert code folding style in InteliJ to Eclipse? (Eclipse folding is my target)
I want to hide #Override or any annotations from all methods in IntelliJ
I want to hide folded symbol {...} or move it in method name line in IntelliJ
Like this :
(in following picture, I removed #Override manually. so,I've moved to manually bracket { to the method name line.
)
Update 1 :
I tried to solve my problem in (Intellij) File -> Settings... -> Editor -> Code Folding , but I could not solve.
For Android Studio:
File --> Settings --> Editor --> General --> Code Folding
From that section you can select the way you want to fold your methods and inner classes etc.
Hope this helps.
You can change it by changing code formatter style.
For Mac :
Eclipse -> Preference -> Java -> Code Style -> Formatter -> Edit
For Window :
Window -> Preference -> Java -> Code Style -> Formatter -> Edit
Please check below links for more details.
http://www.wikihow.com/Change-the-Default-Format-Settings-in-Eclipse
Open Eclipse.
Click on the top tool bar and then click on Preferences.
On the left side of the box, expand Java option, expand Code Style, and click Formatter.
The active profile must be set to Eclipse[built-in], you cannot edit this setting, so make a new one by clicking the New... button.
Enter your new profile name and click OK.
You will now be presented with the "Profile 'name you set'"box.
There are 8 tabs: Indentation, Braces, White Space, Blank Line, New lines, Control statements, Line wrapping, Comments.
Click on each tab and make the changes. Dont forget to click Apply.
Now to format the current document, click on Source from the menu bar, click Format or press Ctrl+Shift+F.
Job well done. =)
Update
This was fixed in Eclipse 2018-12. This behaviour is still default, but can be configured off - see the accepted answer for how
I'll leave the question as it was for posterity, and for those on earlier versions of Eclipse
In Eclipse, I've enabled intellisense-style suggestions for Java by going to
Window -> Preferences -> Java/Editor/Content Assist
and setting the following
Auto activation delay (ms) -> 0
Auto activation triggers for Java -> .(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
source = Eclipse Intellisense?
This works brilliantly, apart from one annoying problem. When I hit spacebar, the token being typed is autocompleted with whatever is at the top of the suggestions list. Fair enough, except that sometimes I'll type a class/variable name with an exact legal match, but this won't appear as the top suggestion. So when I naturally hit spacebar Eclipse inserts something completely wrong.
E.G. after typing Cookie I'll hit spacebar and get CookieMonster.
This seems like a bug, and happens often enough to be annoying, but even despite this I don't want spacebar to trigger autocomplete in general. I may want to type a variable name which hasn't been declared yet, or something similar. I want to use autocomplete as a helper tool, but my natural typing should always take priority over it.
I'd like to stop spacebar triggering autocomplete, and either fall back to using enter, or better still trigger autocomplete with a custom key not used in ordinary typing. Is any of this possible?
I've played around with all the settings in Content Assist to no avail. Googling the question just returns a bunch of results about disabling the autocomplete feature.
This issue is fixed from Eclipse 2018-12 [4.10] see the accepted answer
It's present in all prior versions, i.e. 2018-09 [4.9], Photon [4.8], Oxygen [4.7], Neon [4.6], etc..
Eclipse 2018-12 was already patched for this!
A patch for Bug 348857 was recently merged to the Eclipse project and was released as part of Eclipse 2018-12. You can download that version here.
You now have a new option to disable all insertion triggers apart from enter, which will prevent spacebar from causing autocompletion.
Simply go to Preferences... -> Java -> Editor -> Content Assist (or Window -> Preferences -> Java -> Editor -> Content Assist on Windows) and select Disable insertion triggers except 'Enter', as shown in the screenshot below:
There is a solution on the issue tracker for this.
Copy the jar in the eclipse/dropins folder. With the next restart space is diabled as autocompletion trigger.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=348857
Eclipse 12-2018 and newer: This is working natively, check Pyves answer.
Use a SDK version of eclipse
1.open Plug-ins View and find org.eclipse.jface.text, right click, choose import as Source Project. After import, you find it in your workspace.
2.In src/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java
char[] triggers = t.getTriggerCharacter();
if(contains(triggers,key))
change to
if(key!='='&&key!=0x20&&contains(triggers,key))
3.Export org.eclipse.jface.text
Right click the project folder of org.eclipse.jface.text, choose export-->Deployable plugins and fragments, next, destination choose archive file, finish. Replace the one in eclipse/plugins with the one you generate.
The spacebar has been a key to select the autocomplete even in Indigo. To my knowledge, this can't be configured.
In fact, that is probably why the delay exists.
I suggest setting the delay to some optimal value that allows you to type things like private void ... comfortably without triggering suggestions for private and void. Then in case you get a suggestion because you waited too long, press Escape to abort Content Assist.
Same configuration as davnicwil, same issue, still on eclipse 4.4.
Solution: Intercept (hook) SHIFT+SPACE (press and hold) on (editor-window) eclipse and replace it with ESC,SPACE (sequence). Now you my decide between
Autocomplete+SPACE: press SPACE when autosuggestion present
just SPACE: press predefined key combination or sequence (e.g. SHIFT+SPACE)
On windows you may use http://www.heise.de/download/activaid.html (you can also use AutoHotkey, java native hook, ...)
HowTo with ActivAid:
Open Ac'tivAid, select "UserHotkeys"
click on "+", set a description
click on "short cut", press e.g. SHIFT+SPACE
Command: "{ESC}{SPACE}" (without quotes)
click "+", select eclipse editor frame, press ENTER
click OK, OK in Ac'tivAid
My config file:activAid/settings/ac'tivAid.ini:[UserHotkeys]
Hotkey11=+Space
Path11=<Send>{ESC}{SPACE}
Description11=Eclipse Shift+Space -> Esc,Space
Category11=
Application11=ahk_class SWT_Window0
You may also remap keys on non-english keyboards with "HotStrings", e.g. ö->{,ä->} etc.
Finally worked it out.
Try download this org.eclipse.jface.text.jar and copy it to your plugin folder(Typically eclipse/plugin). Do not forget to backup your own one.
Works on Eclipse Juno.
If the link doesn't work, comment on this, thanks.
In Eclipse go to Window -> Preferences -> General -> Keys and remove the binding for the command Content Assist.
You could disable Auto activation via the check box in
Window -> Preferences -> Java/Editor/Content Assist
and activate the auto-complete feature on demand. The default hotkey for this is
CTRL+Space
I've downloaded, unzipped and setup Eclipse 3.4.2 with some plugins (noteable, EPIC, Clearcase, QuantumDB, MisterQ).
Now I find when I'm editing Java projects the code completion is not working. If I type String. and press ctrl+space a popup shows "No Default Proposals" and the status bar at the bottom shows "No completions available".
Any ideas?
Try restoring the default options in 'Windows > Preferences > Java > Editor > Content Assist > Advanced'
An example of the kind of data you see in this preference screen, however not necessarily what you currently have.
(From Vadim in this blog post " Content Assist Duplicates in Eclipse (Mylyn)":
if have duplicate Mylyn entries, uncheck the duplicate entries that do not contain "(Mylyn)" in their name)
The Eclipse help page defines the default list to restore:
Select the proposal kinds contained in the 'default' content assist list:
Other Java Proposals,
SWT Template Proposals,
Template Proposals,
Type Proposals
I'm adding an answer here in case someone else finds this on Google. Same symptoms; different problem. For me, the type caches had become corrupt.
From http://mschrag.blogspot.co.nz/2009/01/open-type-cant-find-your-class.html
Quit Eclipse
Go to workspace/.metadata/.plugins/org.eclipse.jdt.core
Remove *.index and savedIndexNames.txt
Restart Eclipse and search Ctrl+T for the offending type. The indexes will be rebuilt.
In case someone comes here and want to activate the autocomplete function, go to
Preferences -> Java -> Editor -> Content Assist.
Then in the Auto Activation section fill in Auto activation triggers for Java:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._
For those running Xfce + having IBus plugin activated, there might be keyboard shortcut conflict.
See more info on my blog: http://peter-butkovic.blogspot.de/2013/05/keyboard-shortcut-ctrlspace-caught-in.html
UPDATE:
as suggested by #nhahtdh's comment, adding the some more info to answer directly: IBus plugin in Xfce uses by default Ctrl+Space shortcut for keyboard layout switching. To change it, go to: Options and change it to whatever else you prefer.
Check the lib of your project. It may be that you have include two such jar files in which same class is available or say one class in code can be refrenced in two jar files. In such case also eclipse stops assisting code as it is totally confused.
Better way to check this is go to the file where assist is not working and comment all imports there, than add imports one by one and check at each import if code-assist is working or not.You can easily find the class with duplicate refrences.
Another solution which worked for me is to go to Java--> Appearence --> Type Filters and do disable all
None of these worked for me.
I was experiencing this issue in only once particular class. What finally worked for me was to delete the offending class and recreate it. Problem solved... mystery not so much!
If you have installed Google Toolbar for IE, may be you can face the same problem. Because, the toolbar capture the shortcut ctrl+Space.
I had this problem and like #Marc, only on a particular class. I discovered that I needed to designate Open With = Java Editor. As a Eclipse newbie I hadn't even realized that I was just using a plain text editor.
In the package explorer, right-click the file and chose "Open With".
I faced this problem, and spent hours trying to figure out the issue. tried to follow the steps mentioned in the different answers above, the solution I found is on the same lines as Mona suggested, but slightly different. Tried to add as a comment to Mona's answer but no option was available.
Issue with my eclipse was, classpath somehow got corrupted and all the jars and dependent projects were missing. after taking the latest .classpath from repository it worked fine.
Check that you did not filter out many options inside the Window > Preferences > Java > Appearance > Type Filters
Items in this list will not be appear in quick fix, be autocompleted, or appear in other various places like the Open Type dialog.
I also face this issue but it is resolved in different way.
Steps that I follow may be helpful for others.
Right click on project (the one you are working on)
Go to Properties > Java Build Path > JRE System Library
Click Edit... on the right
Choose the JRE 7
Once you have you configuration checked and completion is still not working:
make sure you have the right directory structure.
Do you see the right icon beside the file?:
It will tell you how the file will be treated by Eclipse:
I am posting this answer as I had that story with with Maven webapp artifact. By default Maven-WebApp does not create folder for sources and I put my Java into resources, wondering for 5 minutes what was going on... :)
Running STS on Java Spring Boot projects, here's what works for me :
Maybe this helps other people who come across the same issue.
My setup: old Gradle project (version Gradle 2.12) made by someone else, imported using the Gradle Import Wizard into STS (Eclipse Oxygen.2 (4.7.2)).
Code completion did not work either (and I still have hollow Js at the Java files), but at least I got the code completion to work by doing:
right click on the project folder > Properties > Gradle > Configure Workspace Settings > Java > Editor > Content Assist > Advanced
check "Java Proposals in upper window.
2x Apply & Close
I have run into this problem since upgrading to Eclipse 2019-09. Based on some of the suggestions above, this is what worked for me.
I had to go to Eclipse -> Preferences -> Java -> Editor -> Content Assist -> Advanced.
I found out that if I turn on any of the key binding proposals, Java Non-Type, Java, Java (Task-Focused) or Java Type proposal, then I was able to use auto complete. If I turned them all on, then not only did auto complete work, but I got duplicate methods listed. I am guessing, but I will probably used Java Type Proposals. Any clarification of what differs for these four types would be appreciated.
In my case, Intellisense had only disappeared in a few classes in one project. It turned out this was because of a missing library on the build path (although it worked previously).
So definitely check all the errors or problems in Eclipse and try to find if a library may be missing
For those who use the latest 3-19 eclipse build:
It just happened to me when upgrading from Oxygen to 3-19 eclipse version, so I assume the auto-complete feature does not migrated correctly during the upgrade process.
The only solution that worked for me was to create a new eclipse workspace, and import the project/s to it. It might take a few minutes, but it worth it - comparing to the time spent on other solutions...
I ran into this and it ended up being I was opening the file with the text editor and not the java editor.
For me the issue was a conflict between several versions of the same library. The Eclipse assist was using an older version than maven.
I had to go to the .m2 directory and delete the unwanted lib version + restart eclipse.
I experience problems on Eclipse Neon when editing a file which does not belong to the project directory. When I copy the same file to the project root directory, not even to the src directory, the completion starts working.
When the file is opened from a different directory, only completion for JRE works. That is for example: java. completes, but junit. does not.
Just in case anyone got to a desperate point where nothing works... It happened to us that the content assist somehow shrunk so no suggestion was shown, just the "Press Ctrl+Space for non-Java..." could be seen.
So, it was just a matter of dragging the corner of the content assist to enlarge the pop-up.
I know, embarrassing. Hope it helps.
Note: this was an Ubuntu server with Xfce4 using Eclipse Oxygen.
If you're experiencing this in an enum, or when initializing an array with anonymous classes, it's a known bug in Eclipse. See Eclipse content assist not working in enum constant parameter list.
We can change the settings as per our requirement.
Suppose we want to make java proposal as highest priority we need to do changes as shown below.
Windows > Preferences > Java > Editor > Content Assist > Advanced
Choose Java proposal and click on up button
For me in Sep 2021 it was an odd Eclipse bug. I had a multi-line string inside an annotation in my Class. This caused just that particular class to fail when trying to code complete (even though the class compiled just fine).