Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367696

Summary: [formatting] Cannot auto-format XML document on Ubuntu
Product: [WebTools] WTP Source Editing Reporter: Karl Ostmo <kostmo>
Component: wst.xmlAssignee: wst.xml <wst.xml-inbox>
Status: CLOSED DUPLICATE QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: jesper.eskilson, nsand.dev, remy.suen
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Karl Ostmo CLA 2012-01-01 23:16:17 EST
Build Identifier: 

With the cursor in an XML document (badly formatted), when I bring up the keybinings list using CTRL+SHIFT+L, the "Format Source" keyboard shortcut is listed there.  However, pressing CTRL+SHIFT+F does nothing, nor does selecting the "Format Source" command with the arrow keys and hitting Enter.

Activating other commands from the CTRL+SHIFT+L menu in this way works correctly (e.g. saving the current file).

Also, the CTRL+SHIFT+F shortcut correctly formats a Java source code file.

Reproducible: Always

Steps to Reproduce:
1 Open XML document in Eclipse Indigo on Ubuntu 11.10 (Linux Mint 12)
2 Mess up the formatting (e.g., put two sibling elements on different lines at different indentation levels
3 Press CTRL+SHIFT+F

Expected behavior: sibling elements should be brought to the same indentation level

Actual behavior: nothing
Comment 1 Karl Ostmo CLA 2012-01-01 23:24:23 EST
I have verified that the "Eclipse XML Editors and Tools" plugin (version 3.3.1) is already installed.
Comment 2 Nitin Dahyabhai CLA 2012-01-05 10:49:04 EST
(In reply to comment #1)
> I have verified that the "Eclipse XML Editors and Tools" plugin (version 3.3.1)
> is already installed.

Have you also verified that you're opening the file with the XML Editor (using the file's Open With context menu)?
Comment 3 Karl Ostmo CLA 2012-01-05 13:13:28 EST
I was editing a "plugin.xml" file from an Eclipse plugin project. As it turns out, the default editor is the "Plug-in Manifest Editor", not the "XML Editor".

When i right-click -> Open with... on the plugin.xml file and select "XML Editor", I get a dialog box that says "Unsupported content type in editor [...]". If I then dismiss that dialog, the "plugin.xml" file is opened in an editor without syntax highlighting and CTRL+SHIFT+F doesn't work.
Comment 4 Nick Sandonato CLA 2012-02-22 17:14:01 EST
(In reply to comment #3)
> I was editing a "plugin.xml" file from an Eclipse plugin project. As it turns
> out, the default editor is the "Plug-in Manifest Editor", not the "XML Editor".
> 
> When i right-click -> Open with... on the plugin.xml file and select "XML
> Editor", I get a dialog box that says "Unsupported content type in editor
> [...]". If I then dismiss that dialog, the "plugin.xml" file is opened in an
> editor without syntax highlighting and CTRL+SHIFT+F doesn't work.

Hi Karl,

Unfortunately, the plugin.xml has its own content type, and the XML editor does not work with that content type. There is hope that we'll be able to force loading with a particular content model in Bug 320996.

*** This bug has been marked as a duplicate of bug 320996 ***
Comment 5 Jesper Eskilson CLA 2013-02-15 04:14:19 EST
What's the latest status of this? I'm sorely missing formatting functionality in the plugin.xml manifest editor, and since the XML editor cannot open plugin.xml files, I'm stuck.
Comment 6 Nitin Dahyabhai CLA 2013-02-15 12:07:19 EST
(In reply to comment #5)
> What's the latest status of this? I'm sorely missing formatting
> functionality in the plugin.xml manifest editor, and since the XML editor
> cannot open plugin.xml files, I'm stuck.

As I said in bug 320996 comment 12, it's a matter of passing all of the tests with our implementation, and we're still not there yet.  As a workaround, you can copy the content into a file not named "plugin.xml", format it, and copy it back.