forked from external/vscode-xml
		
	Add preserveSpacesBetweenAttributes Setting
This commit is contained in:
		
							parent
							
								
									dc3d28b962
								
							
						
					
					
						commit
						4dab0b5d4e
					
				
					 3 changed files with 14 additions and 3 deletions
				
			
		| 
						 | 
					@ -176,6 +176,12 @@
 | 
				
			||||||
                    "default": "**/*.xml",
 | 
					                    "default": "**/*.xml",
 | 
				
			||||||
                    "description": "The pattern used to search for input XML files when executing XQuery scripts.",
 | 
					                    "description": "The pattern used to search for input XML files when executing XQuery scripts.",
 | 
				
			||||||
                    "scope": "window"
 | 
					                    "scope": "window"
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                "xmlTools.preserveSpacesBetweenAttributes": {
 | 
				
			||||||
 | 
					                    "type": "boolean",
 | 
				
			||||||
 | 
					                    "default": false,
 | 
				
			||||||
 | 
					                    "description": "Preserves any spaces between attributes during formatting.",
 | 
				
			||||||
 | 
					                    "scope": "resource"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,6 +59,10 @@ export class Configuration {
 | 
				
			||||||
        return this._getForResource<boolean>("splitXmlnsOnFormat", resource);
 | 
					        return this._getForResource<boolean>("splitXmlnsOnFormat", resource);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    static preserveSpacesBetweenAttributes(resource: Uri): boolean {
 | 
				
			||||||
 | 
					        return this._getForResource<boolean>("preserveSpacesBetweenAttributes", resource);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static _getForResource<T>(section: string, resource: Uri): T {
 | 
					    private static _getForResource<T>(section: string, resource: Uri): T {
 | 
				
			||||||
        return workspace.getConfiguration(ExtensionTopLevelSection, resource).get<T>(section);
 | 
					        return workspace.getConfiguration(ExtensionTopLevelSection, resource).get<T>(section);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,6 @@
 | 
				
			||||||
import { EndOfLine, FormattingOptions, TextDocument } from "vscode";
 | 
					import { EndOfLine, FormattingOptions, TextDocument } from "vscode";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Configuration } from "../common";
 | 
					import { Configuration } from "../common";
 | 
				
			||||||
import * as constants from "../constants";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface XmlFormattingOptions {
 | 
					export interface XmlFormattingOptions {
 | 
				
			||||||
    editorOptions: FormattingOptions;
 | 
					    editorOptions: FormattingOptions;
 | 
				
			||||||
| 
						 | 
					@ -11,6 +10,7 @@ export interface XmlFormattingOptions {
 | 
				
			||||||
    splitAttributesOnFormat: boolean;
 | 
					    splitAttributesOnFormat: boolean;
 | 
				
			||||||
    splitXmlnsOnFormat: boolean;
 | 
					    splitXmlnsOnFormat: boolean;
 | 
				
			||||||
    initialIndentLevel?: number;
 | 
					    initialIndentLevel?: number;
 | 
				
			||||||
 | 
					    preserveSpacesBetweenAttributes: boolean;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class XmlFormattingOptionsFactory {
 | 
					export class XmlFormattingOptionsFactory {
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,8 @@ export class XmlFormattingOptionsFactory {
 | 
				
			||||||
            removeCommentsOnMinify: Configuration.removeCommentsOnMinify(document.uri),
 | 
					            removeCommentsOnMinify: Configuration.removeCommentsOnMinify(document.uri),
 | 
				
			||||||
            splitAttributesOnFormat: Configuration.splitAttributesOnFormat(document.uri),
 | 
					            splitAttributesOnFormat: Configuration.splitAttributesOnFormat(document.uri),
 | 
				
			||||||
            splitXmlnsOnFormat: Configuration.splitXmlnsOnFormat(document.uri),
 | 
					            splitXmlnsOnFormat: Configuration.splitXmlnsOnFormat(document.uri),
 | 
				
			||||||
            initialIndentLevel: 0
 | 
					            initialIndentLevel: 0,
 | 
				
			||||||
 | 
					            preserveSpacesBetweenAttributes: Configuration.preserveSpacesBetweenAttributes(document.uri)
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue