Community
Participate
Working Groups
When I select a part of an XML file, and the selection starts directly at the first selected element (i.e. it does not include any whitespace before the first element), hitting CTRL+SHIFT+F formats the selection with an incorrect indentation. Steps to reproduce: 1) Create a simple XML file with at least three levels of nesting, e.g. <?xml version="1.0" encoding="UTF-8"?> <root> <selected> <inner></inner> <inner></inner> </selected> </root> 2) Select an element below the root element completely, e.g. by placing the cursor inside the element and pressing SHIFT+ALT+UP-ARROW one or more times. In the example, the following shall be selected (and ^ and $ mark beginning and end of the selection): <?xml version="1.0" encoding="UTF-8"?> <root> ^<selected> <inner></inner> <inner></inner> </selected>$ </root> 3) Format the selection (CTRL+SHIFT+F). From the second line, the indentation is incorrect: <?xml version="1.0" encoding="UTF-8"?> <root> <selected> <inner></inner> <inner></inner> </selected> </root> The result should be the same as if the whole file was formatted, i.e. <?xml version="1.0" encoding="UTF-8"?> <root> <selected> <inner></inner> <inner></inner> </selected> </root>
In my case the selected has result indent always one tab (4 spaces in my case) <dependencies> ^<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency>$ ctrl+shift+F An the result is: <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency>