Jon Wei
Jon Wei

Reputation: 1481

Eclipse Code is 'disappearing'

Whenever I'm just typing some code in Eclipse, and I click on the Error lightbulb on the gray ribbon area, my code just runs away from me, and I have to close the file and re-open it to see my code again. Can someone help me figure out how to STOP this? Thanks

Upvotes: 4

Views: 2402

Answers (4)

SAN CTI
SAN CTI

Reputation: 36

Under any condition you could just click on the java file under the name of class you created it appers like that Src Default package "Name" .java

Upvotes: 0

Jon Wei
Jon Wei

Reputation: 1481

I may have fixed this issue.

Going to the Eclipse settings, and to

Java > Editor

Uncheck the box "Only show the selected Java element."

This seems to fix the problem. enter image description here

Upvotes: 3

Mahmoud Fayez
Mahmoud Fayez

Reputation: 3459

Please follow these steps (I am running eclipse on MAC) to fix XML problems. You later commented it was a java file but actually java files are okay with me.

  1. Open Eclipse
  2. Open menu eclipse->preference or file->preference (windows version I am guessing)
  3. In the left pane expand the following nodes XML->XML Files->Editor
  4. Please take a look @ the following image and make sure yours has the same settings and hit apply.
  5. The problem is gone but you cannot add blank lines in the XML files any more.

The following image shows the best configurations to fix this issue

Upvotes: 1

Sparky
Sparky

Reputation: 8477

You could be accidentally invoking code folding.

Does your editor show you something like this?

Code folding

The red arrow (added for emphasis) points to a minus sign in a circle. When you hover over the area underneath the minus sign, a vertical bar is drawn from the minus sign to the bottom of the code block, of which the minus sign is next to the top line.

If you (perhaps accidentally) single-click on the minus sign or double-click on the vertical bar, then the whole block of code collapses and only the first line is shown. The minus sign changes to a plus sign. Clicking on the plus sign expands your code again.

Upvotes: 0

Related Questions