1. Java settings auto-completion
(1) Set auto-completion
Click Window --> Perferences (option settings) --> Java --> Editor (editing) --> Content Assist (content assistance/code hints) in turn
Then on the "Content Assist" page, you can see that there is an Auto Activation below , and there is an Auto activation triggers for Java
Enter ".qwertyuioplkjhgfdsazxcvbnm" in this input box, and then click "OK" below, so that the code auto-completion has been set
When we write code, just type a letter or "." to automatically call up the auto-completion function
(2) Solve the problem that after automatic code completion is configured, the code is often completed when there is a space
Click window --> show view -->other> to find plug-ins
Find the plug-in org.eclipse.jface.text (each "." is sorted alphabetically)
Right click, select import as --> Source Project
After the import is complete, you can see the project in your workspace ( left side of eclipse )
Modify the code
Open org.eclipse.jface.text/org/eclipse/jface/text/contentassist/CompletionProposalPopup.java file
Find the following code (ctrl+F quick search)
char[] triggers= t.getTriggerCharacters();
if (contains(triggers, key)) {
In the if judgment here, eclipse will judge whether the key is in the triggers. So what we need to do is to exclude the space and the = sign: if(key != 0x20 &&
contains(triggers,key)){
... ......
}
After the code is modified like this, press the space when prompted, the hint will disappear, and it will not be "auto-completed" anymore!
Export the modified org.eclipse.jface.text
Right click on org.eclipse.jface.text in your workspace,
选择export-->Deployable plug-ins and fragments
【next】, destination select archive file, then finish.
You can see the generated jar package in the zip file, and use it to replace the jar package with the same name in eclipse/plugins.
Restart eclipse.
Congratulations you are done!
(3) eclipse auto-completion does not take effect solution
Sometimes eclipse has set auto-completion, but the solution is that the auto-completion has not taken effect. Follow the serial number marked on the picture to enter the Advanced page step by step, check the three options in the fourth step, and it will take effect again. as follows
2. XML file setting auto-completion
Find XML--XML Files--Editor--Content Assist
Change the contents of Prompt when these characters are inserted to:
<=:.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
Then click Apply to apply the configuration
3. HTML code setting auto-completion
Find Web--HTML Files--Editor--Content Assist
Change the content of Prompt when these characters are inserted to:
<=:.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
Then click Apply to apply the configuration
4. JavaScript code setting auto-completion
The configuration of the automatic prompt code is limited by the input character length of the input box. It is necessary to export the configuration file first, then modify it, and then re-import the modified configuration file. The specific operation steps are as follows:
We click File--Export... Click General--Preference on the pop-up interface
Then select any folder of your own computer in the To preference file to export, and name the exported file by the way, and export it
After exporting the epf file, we open it and search for: /instance/org.eclipse.wst.jsdt.ui/content_assist_autoactivation_triggers_java
can be changed as shown in the figure
That is, change the character after the equal sign to:
.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
Then open eclipse, click Import--Preferences, then Next, select the epf file just modified in the From preference file, and click Finish to import.
After the import is successful, we click windows--Preferences, select JavaScript--Editor--Content Assist
You can see that the characters in Auto activation triggers for JavaScript have changed to the ones you just modified:
.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
That's it!
However, when we enter the code, sometimes when we name the variable, it will also automatically prompt, and the code will be automatically completed after pressing the equal sign or space, which is a headache.
How to remove the automatic prompt variable or cancel the automatic completion code of spaces, we can refer to: https://www.cnblogs.com/sangewuxie/p/7477320.html
Only the SDK version of eclipse can find the source code of the corresponding jar package to modify in this way, other versions of eclipse do not support modification
eclipse connect JRE
Open the eclipse software as shown below, Window---preference
Find Java--->Installed JREs