This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | regression in XML formatting | ||
---|---|---|---|
Product: | xml | Reporter: | David Konecny <dkonecny> |
Component: | Text-Edit | Assignee: | Svata Dedic <sdedic> |
Status: | VERIFIED FIXED | ||
Severity: | normal | CC: | mfukala, mmirilovic, pjiricka |
Priority: | P2 | ||
Version: | -S1S- | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: |
screen shot 1
screen shot 2 screenhost |
Description
David Konecny
2010-07-25 22:50:22 UTC
Alex, please take a look. Please, provide the scenario to reproduce this bug. I've tried to reproduce the bug on trunk Product Version: NetBeans IDE Dev (Build 110309-cd836e06a728) Java: 1.6.0_14; Java HotSpot(TM) Client VM 14.0-b16 System: Linux version 2.6.18-8.el5 running on i386; UTF-8; en_US (nb) My steps were: 1. Create a new .xml file with the following content (xml text is placed in one line, see the attached "screenshot_xml_formatting-1.png"): <?xml version="1.0" encoding="UTF-8"?><constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mappinghttp://jboss.org/xml/ns/javax/validation/mapping/validation-mapping-1.0.xsd" xmlns="http://jboss.org/xml/ns/javax/validation/mapping"><bean class="" ignore-annotations=""></bean></constraint-mappings> 2. Click the right mouse button and select the menu item "Format" or press "Alt+Shift+F" Result: xml content has been formatted (see the attached "screenshot_xml_formatting-2.png"): <?xml version="1.0" encoding="UTF-8"?> <constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mappinghttp://jboss.org/xml/ns/javax/validation/mapping/validation-mapping-1.0.xsd" xmlns="http://jboss.org/xml/ns/javax/validation/mapping"> <bean class="" ignore-annotations=""></bean> </constraint-mappings> Created attachment 106875 [details]
screen shot 1
Created attachment 106876 [details]
screen shot 2
Product Version: NetBeans IDE Dev (Build 110308-042ec1205e88) Java: 1.6.0_24; Java HotSpot(TM) 64-Bit Server VM 19.1-b02 System: Linux version 2.6.35-27-generic running on amd64; UTF-8; en_NZ (nb) Userdir: /home/david/.netbeans/_UD4 If I reformat following XML document: <?xml version="1.0" encoding="UTF-8"?> <constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping http://jboss.org/xml/ns/javax/validation/mapping/validation-mapping-1.0.xsd" xmlns="http://jboss.org/xml/ns/javax/validation/mapping"> <bean class="" ignore-annotations=""> </bean> <default-package> xxxxxx </default-package> </constraint-mappings> the result I got is <?xml version="1.0" encoding="UTF-8"?> <constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping http://jboss.org/xml/ns/javax/validation/mapping/validation-mapping-1.0.xsd" xmlns="http://jboss.org/xml/ns/javax/validation/mapping"> <bean class="" ignore-annotations=""> </bean> <default-package> xxxxxx </default-package> </constraint-mappings> I do not knot if this is regression or if it never worked but I would expect following indentation: <?xml version="1.0" encoding="UTF-8"?> <constraint-mappings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping http://jboss.org/xml/ns/javax/validation/mapping/validation-mapping-1.0.xsd" xmlns="http://jboss.org/xml/ns/javax/validation/mapping"> <bean class="" ignore-annotations=""> </bean> <default-package> xxxxxx </default-package> </constraint-mappings> Please, explain what does it mean "reformat"? Which menu item or key combination do you use for reformatting of xml document? Please, describe your scenario (step by step) - I'd like to reproduce this bug. Created attachment 106957 [details]
screenhost
I do not understand what's so complicated in reproducing this issue. #1) create a new XML Document; #2) copy and paste XML from this issue; #3) ALT+SHIFT+F. Do you want me to attach screenshots?? Here it is. Screenshot was taken after XML document was reformatted and I'm arguing that we should do better job than that - tag attributes are not indented properly, tag value is not properly indented and tag's attribute value which span two lines is not indented either.
all lines not started with < are unaffected by format, it may have sense in case if it's CDATA/text node but if line start with attribute name it's good to align this line to corresponding tag indent. will try to fix, or release "lock" after a day or two. If it always worked like this then I would downgrade to P3. But if it is a recent regression then it would be good to investigate what caused the regression and what impact it has, eg. it is limited to formatting case discussed in this issue or ... ok, made small investigation and it works in 6.8 so it's a regression but unfortunately quite old regression now. 6.8 also move 'xxxxxx' from sample above, wonder if it was some fix to prevent text nodes reformatting or just plain no-reason regression. I don't see any changes can be considered as related in "xml.text" between 20100404 (6.8) and report date, it may be something in root classes but there are deprecated classes usage in some places. So it has not worked for a while and nobody notice this issue earlier. Means it is not a stopper. It would be nice to improve it if possible but my own experience with indentation/formatting is that it is far from trivial and likelihood of regression pretty high. Let's fix this in next release. Ok, requesting a waiver for NB 7.0. Waiver approved. Requesting a waiver for NetBeans 7.0.1. Approved. Fixed in jet-main #1d211f79d539 Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/1d211f79d539 User: Svata Dedic <sdedic@netbeans.org> Log: #188941: implemented formatting XML attributes, end braces and processing instructions. |