diff --git a/extensions/mssql/src/config.json b/extensions/mssql/src/config.json index 2a9843ecdf..71882e01c5 100644 --- a/extensions/mssql/src/config.json +++ b/extensions/mssql/src/config.json @@ -1,6 +1,6 @@ { "downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}", - "version": "1.5.0-alpha.91", + "version": "1.5.0-alpha.93", "downloadFileNames": { "Windows_86": "win-x86-netcoreapp2.2.zip", "Windows_64": "win-x64-netcoreapp2.2.zip", diff --git a/extensions/schema-compare/src/schemaCompareResult.ts b/extensions/schema-compare/src/schemaCompareResult.ts index 72a1da5a75..604abb99ef 100644 --- a/extensions/schema-compare/src/schemaCompareResult.ts +++ b/extensions/schema-compare/src/schemaCompareResult.ts @@ -237,8 +237,8 @@ export class SchemaCompareResult { this.differencesTable.onRowSelected(() => { let difference = this.comparisonResult.differences[this.differencesTable.selectedRows[0]]; if (difference !== undefined) { - sourceText = difference.sourceScript === null ? '\n' : this.getAggregatedScript(difference, true); - targetText = difference.targetScript === null ? '\n' : this.getAggregatedScript(difference, false); + sourceText = this.getFormattedScript(difference, true); + targetText = this.getFormattedScript(difference, false); this.diffEditor.updateProperties({ contentLeft: sourceText, @@ -264,15 +264,29 @@ export class SchemaCompareResult { return data; } + private getFormattedScript(diffEntry: azdata.DiffEntry, getSourceScript: boolean): string { + // if there is no entry, the script has to be \n because an empty string shows up as a difference but \n doesn't + if ((getSourceScript && diffEntry.sourceScript === null) + || (!getSourceScript && diffEntry.targetScript === null)) { + return '\n'; + } + + let script = this.getAggregatedScript(diffEntry, getSourceScript); + return script; + } + private getAggregatedScript(diffEntry: azdata.DiffEntry, getSourceScript: boolean): string { let script = ''; if (diffEntry !== null) { - script += getSourceScript ? diffEntry.sourceScript : diffEntry.targetScript; + let diffEntryScript = getSourceScript ? diffEntry.sourceScript : diffEntry.targetScript; + if (diffEntryScript) { + // add a blank line between each statement + script += diffEntryScript + '\n\n'; + } + diffEntry.children.forEach(child => { let childScript = this.getAggregatedScript(child, getSourceScript); - if (childScript !== 'null') { - script += childScript; - } + script += childScript; }); } return script;