Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maintain format of XML comment section on auto-formatting in Eclipse

In Eclipse (Helios) I have this XML source file:

<?xml version="1.0" encoding="utf-8"?>
<!--
I wanted to 
===========
save this format of the comments.

-->
<x>
</x>

On formatting the file (Ctrl+Shift+F) I got the comment reformatted.

<?xml version="1.0" encoding="utf-8"?>
<!-- I wanted to =========== save this format of the comments. -->
<x>
</x>

Is there an option to switch off pretty-printing comment sections?

like image 272
PeterMmm Avatar asked Jul 12 '12 13:07

PeterMmm


2 Answers

I'm using Eclipse 3.6.0.

In Windows > Preferences > XML > XML Files > Editor:

Uncheck the Join lines option.

like image 147
Aditya Avatar answered Oct 19 '22 19:10

Aditya


You can select only part of your XML file for formatting and leave out the comment part.

like image 29
Wolfgang Fahl Avatar answered Oct 19 '22 18:10

Wolfgang Fahl