20

I have problem with folding when I'm writing code in XML. Actually, when I'm writing Java code there is no problem and I can expand/collapse my codes.

However, in XML there is no folding icon although it is active. In side bar (line number), I right click then I select Folding > Enable Folding the width of bar becomes wider but I can't see folding icon. My background of screen is black is it possible this color covers folding icon? I don't think it because of this because when I click those area nothing happens.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Hesam
  • 52,260
  • 74
  • 224
  • 365

4 Answers4

3

Eclipse Mars (4.5.1)

  1. XML file having the .xml extension

    Just edit / open the file and the folding option will be available:

    enter image description here

    But if you disable and then enable the folding from right click on the left side bar:

    enter image description here

    there is a bug: folding won't be available.

    Workaround: change the tab to another file and then come again to the previous tab. The icons will be back.

    enter image description here

  2. XML file having a different extension (E.g.: .xaml)

    You can try to open the file using the XML Editor from the right click:

    enter image description here

    enter image description here

    and if it fails, just add the file extension to the XML (Illformed) from Window > Preferences > General > Content Types:

    enter image description here

    enter image description here

    enter image description here

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
  • @ROMAINIA_engineer - thanks for including the "ill formed" reference, that was the missing piece for me, as I had added the file extension under the basic "XML" category instead. By removing it from "XML" and adding it to "XML (IllFormed)" I then reopened the xml file and behold...all the syntax colors and folding options were now showing. Thx for posting! – Hatley Sep 01 '19 at 15:09
0

I use Eclipse-Java EE Juno. XML folding is enabled by default and icons can be seen. But after disable and enabling the "Enable Folding" option, folding icons are not seen. Seems to be a bug in Eclipse. Workaround could be after enabling the option, try to add a new tag (may be dummy one). Then folding icons can be seen.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Omkar Shetkar
  • 3,488
  • 5
  • 35
  • 50
0

Answering 3 years too late but google brings me here, I guess my answer can still be useful :)

The native xml editor from eclipse is able to fold/unfold xml. Neat. This is not the case for the android xml editor (coming with the ADT plugin I guess).

If you need folding for an android xml file, just right-clic on it, open with, XML Editor. This will use eclipse's xml editor, with folding functionality.

johan d
  • 2,798
  • 18
  • 26
-1

Use WST. WST main project It comes with XML editor that supports formatting and code folding etc.

Ravi
  • 545
  • 3
  • 5