Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Eclipse IDE quick fix display suggestions?

Tags:

java

eclipse

I'm interested in how the eclipse ide can display suggestions to you and display the results so quickly. I work with a huge codebase with 1000's and 1000's of classes and I thought there would be some lag in suggesting misspelt class names for example.

How does it search for possible suggestions? Why is it so quick? Does it index all possibly situations to it can be quickly accessed?

Just something thats interests me because I use eclipse everyday :) Cheers

like image 369
Decrypter Avatar asked Nov 28 '11 13:11

Decrypter


People also ask

How do I get Eclipse to show suggestions?

Step 1: Open your Eclipse or Spring Tool Suite, then go to the Window > Preferences as shown in the below image. Step 2: In the next screen go to the Java > Editor > Content Assist > Auto activation triggers for Java as shown in the below image.

What is a quick fix in Eclipse?

The quick fix dialog provides a list of possible corrections. The quick fix dialog can be invoked by − Placing the mouse pointer on a squiggly line. Clicking on the light bulb. Placing the cursor in the highlighted text and selecting Quick fix from the Edit menu or clicking shortcut Ctrl + 1 .

How do I get quick fixes in Eclipse?

The marker can be selected with the left mouse to activate the Quick Fix pop-up, indicating actions that can be undertaken to repair the error. Alternatively, pressing Ctrl+1 will activate Quick Fix from the keyboard. Quick Fixes can be used to make typing much faster.


2 Answers

Same way Google can search in billions of entries, or a text-indexing system like Lucene works. These systems first index the text to be searched, and it can be quite lengthy; you can see it when you first import a project in Eclipse, it takes a lot of time in the background to index everything.

Once the data is indexed, however, it can be searched at an incredible speed. I believe the complexity of such search is O(log n), meaning it will take 1 unit of time to search among 10 items, 2 for 100 items, 3 for 1000 items, 6 for one million, 9 for one billion, etc...

For such an efficient algorithm, data size is almost of little relevance.

like image 52
solendil Avatar answered Sep 28 '22 03:09

solendil


Here's an excerpt from the JDT Core (Java development tools) page:

JDT Core is the Java infrastructure of the Java IDE. It includes:

...

  • An indexed based search infrastructure that is used for searching, code assist, type hierarchy computation, and refactoring. The Java search engine can accurately find precise matches either in sources or binaries.
like image 21
Thomas Avatar answered Sep 28 '22 02:09

Thomas