Format sqlproj file XML on serialization (#10818)

* Format XML on serialization

* Updating licences

* Adding missing line in package.json

* tabs to spaces

* Updating yarn.lock file
This commit is contained in:
Benjin Dubishar
2020-06-10 19:57:59 -07:00
committed by GitHub
parent 5c6516cbb3
commit 5ab6d3d07e
5 changed files with 74 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import * as path from 'path';
import * as xmldom from 'xmldom';
import * as constants from '../common/constants';
import * as utils from '../common/utils';
import * as xmlFormat from 'xml-formatter';
import { Uri } from 'vscode';
import { promises as fs } from 'fs';
@@ -305,7 +306,8 @@ export class Project {
}
private async serializeToProjFile(projFileContents: any) {
const xml = new xmldom.XMLSerializer().serializeToString(projFileContents); // TODO: how to get this to serialize with "pretty" formatting
let xml = new xmldom.XMLSerializer().serializeToString(projFileContents);
xml = xmlFormat(xml, { collapseContent: true, indentation: ' ' });
await fs.writeFile(this.projectFilePath, xml);
}