Merge pull request #186 from DotJoshJohnson/release-2.3.0
Release v2.3.0
This commit is contained in:
		
						commit
						0a17f59e67
					
				
					 10 changed files with 75 additions and 4 deletions
				
			
		
							
								
								
									
										2
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
out
 | 
			
		||||
node_modules
 | 
			
		||||
.vscode-test/
 | 
			
		||||
.vsix
 | 
			
		||||
/*.vsix
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
    "name": "xml",
 | 
			
		||||
    "displayName": "XML Tools",
 | 
			
		||||
    "description": "XML Formatting, XQuery, and XPath Tools for Visual Studio Code",
 | 
			
		||||
    "version": "2.2.0",
 | 
			
		||||
    "version": "2.3.0",
 | 
			
		||||
    "preview": false,
 | 
			
		||||
    "publisher": "DotJoshJohnson",
 | 
			
		||||
    "author": {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,6 +32,7 @@ export class V2XmlFormatter implements XmlFormatter {
 | 
			
		|||
        let indentLevel = 0;
 | 
			
		||||
        let location = Location.Text;
 | 
			
		||||
        let lastNonTextLocation = Location.Text; // hah
 | 
			
		||||
        let attributeQuote = "";
 | 
			
		||||
 | 
			
		||||
        // NOTE: all "exiting" checks should appear after their associated "entering" checks
 | 
			
		||||
        for (let i = 0; i < xml.length; i++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -126,13 +127,17 @@ export class V2XmlFormatter implements XmlFormatter {
 | 
			
		|||
                output += cc;
 | 
			
		||||
                lastNonTextLocation = location;
 | 
			
		||||
                location = Location.AttributeValue;
 | 
			
		||||
 | 
			
		||||
                attributeQuote = cc;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // exiting StartTag.Attribute.AttributeValue, entering StartTag
 | 
			
		||||
            else if (location === Location.AttributeValue && (cc === "\"" || cc === "'")) {
 | 
			
		||||
            else if (location === Location.AttributeValue && cc === attributeQuote) {
 | 
			
		||||
                output += cc;
 | 
			
		||||
                lastNonTextLocation = location;
 | 
			
		||||
                location = Location.StartTag;
 | 
			
		||||
 | 
			
		||||
                attributeQuote = undefined;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // approaching the end of a self-closing tag where there was no whitespace (issue #149)
 | 
			
		||||
| 
						 | 
				
			
			@ -169,7 +174,7 @@ export class V2XmlFormatter implements XmlFormatter {
 | 
			
		|||
                indentLevel--;
 | 
			
		||||
 | 
			
		||||
                // if the end tag immediately follows a line break, just add an indentation
 | 
			
		||||
                // if the end tag immediately follows another end tag, add a line break and indent
 | 
			
		||||
                // if the end tag immediately follows another end tag or a self-closing tag (issue #185), add a line break and indent
 | 
			
		||||
                // otherwise, this should be treated as a same-line end tag(ex. <element>text</element>)
 | 
			
		||||
                if (pc === "\n") {
 | 
			
		||||
                    output += `${this._getIndent(options, indentLevel)}<`;
 | 
			
		||||
| 
						 | 
				
			
			@ -179,6 +184,10 @@ export class V2XmlFormatter implements XmlFormatter {
 | 
			
		|||
                    output += `${options.newLine}${this._getIndent(options, indentLevel)}<`;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                else if (pc === ">" && ppc === "/") {
 | 
			
		||||
                    output += `${this._getIndent(options, indentLevel)}<`;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                else {
 | 
			
		||||
                    output += "<";
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,6 +68,18 @@ describe("V2XmlFormatter", () => {
 | 
			
		|||
            options.enforcePrettySelfClosingTagOnFormat = false;
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("should properly format closing tag after self-closing tag", () => {
 | 
			
		||||
            testFormatter(xmlFormatter, options, "issue-185");
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("should support single quotes within double-quoptes attributes and vice-versa", () => {
 | 
			
		||||
            testFormatter(xmlFormatter, options, "issue-187");
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        it("should not ruin attributes with unusual characters", () => {
 | 
			
		||||
            testFormatter(xmlFormatter, options, "issue-189");
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								src/test/test-data/issue-185.formatted.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/test/test-data/issue-185.formatted.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
<test>
 | 
			
		||||
    <example>
 | 
			
		||||
        <one/>
 | 
			
		||||
    </example>
 | 
			
		||||
</test>
 | 
			
		||||
							
								
								
									
										1
									
								
								src/test/test-data/issue-185.unformatted.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/test/test-data/issue-185.unformatted.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
<test><example><one/></example></test>
 | 
			
		||||
							
								
								
									
										17
									
								
								src/test/test-data/issue-187.formatted.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/test/test-data/issue-187.formatted.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
<Project>
 | 
			
		||||
    <PropertyGroup>
 | 
			
		||||
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
 | 
			
		||||
        <LangVersion>latest</LangVersion>
 | 
			
		||||
    </PropertyGroup>
 | 
			
		||||
    <PropertyGroup Condition=" '$(Configuration)'=='Release' ">
 | 
			
		||||
        <DebugSymbols>false</DebugSymbols>
 | 
			
		||||
        <DebugType>None</DebugType>
 | 
			
		||||
        <Optimize>true</Optimize>
 | 
			
		||||
    </PropertyGroup>
 | 
			
		||||
    <ItemGroup Condition=" '$(Configuration)'=='Release' ">
 | 
			
		||||
        <Content Remove="appsettings.Development.json" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
    <ItemGroup Condition=" '$(Configuration)'=='Debug' ">
 | 
			
		||||
        <Content Remove="appsettings.Production.json" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
</Project>
 | 
			
		||||
							
								
								
									
										17
									
								
								src/test/test-data/issue-187.unformatted.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/test/test-data/issue-187.unformatted.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
<Project>
 | 
			
		||||
    <PropertyGroup>
 | 
			
		||||
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
 | 
			
		||||
        <LangVersion>latest</LangVersion>
 | 
			
		||||
    </PropertyGroup>
 | 
			
		||||
    <PropertyGroup Condition=" '$(Configuration)'=='Release' ">
 | 
			
		||||
        <DebugSymbols>false</DebugSymbols>
 | 
			
		||||
        <DebugType>None</DebugType>
 | 
			
		||||
        <Optimize>true</Optimize>
 | 
			
		||||
    </PropertyGroup>
 | 
			
		||||
    <ItemGroup Condition=" '$(Configuration)'=='Release' ">
 | 
			
		||||
        <Content Remove="appsettings.Development.json" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
    <ItemGroup Condition=" '$(Configuration)'=='Debug' ">
 | 
			
		||||
        <Content Remove="appsettings.Production.json" />
 | 
			
		||||
    </ItemGroup>
 | 
			
		||||
</Project>
 | 
			
		||||
							
								
								
									
										5
									
								
								src/test/test-data/issue-189.formatted.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/test/test-data/issue-189.formatted.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
<!DOCTYPE xml>
 | 
			
		||||
<core:FragmentDefinition xmlns="sap.m" 
 | 
			
		||||
    xmlns:core="sap.ui.core">
 | 
			
		||||
    <Text text="{parts: ['i18n>dialog.countdown.text','view>/Countdown'],formatter: 'jQuery.sap.formatMessage'}" />
 | 
			
		||||
</core:FragmentDefinition>
 | 
			
		||||
							
								
								
									
										5
									
								
								src/test/test-data/issue-189.unformatted.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/test/test-data/issue-189.unformatted.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
<!DOCTYPE xml>
 | 
			
		||||
<core:FragmentDefinition xmlns="sap.m"
 | 
			
		||||
    xmlns:core="sap.ui.core">
 | 
			
		||||
    <Text text="{parts: ['i18n>dialog.countdown.text','view>/Countdown'],formatter: 'jQuery.sap.formatMessage'}" />
 | 
			
		||||
</core:FragmentDefinition>
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue