From e76d8f36b673bad65878bef636c3acfad70e8773 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 14 Aug 2014 14:43:28 -0700 Subject: [PATCH] Align the multiline comments in the generated outputs by retaining its position relative to the first line in the comment --- src/compiler/emitter.ts | 145 +++++++++++- src/compiler/parser.ts | 8 + src/compiler/scanner.ts | 8 +- src/compiler/types.ts | 1 + src/services/services.ts | 1 + .../reference/arrayAssignmentTest1.js | 20 +- .../reference/arrayAssignmentTest2.js | 20 +- .../reference/arrayAssignmentTest4.js | 20 +- .../reference/commentBeforeStaticMethod1.js | 6 +- .../reference/commentOnClassMethod1.js | 4 +- tests/baselines/reference/commentsClass.js | 8 +- .../reference/commentsClassMembers.js | 12 +- .../reference/commentsCommentParsing.js | 112 ++++----- .../reference/commentsExternalModules.js | 10 +- .../reference/commentsExternalModules2.js | 10 +- .../baselines/reference/commentsFormatting.js | 220 ++++++++++++++++++ tests/baselines/reference/commentsFunction.js | 8 +- .../reference/commentsInheritance.js | 4 +- tests/baselines/reference/commentsModules.js | 12 +- .../reference/commentsOnObjectLiteral2.js | 10 +- .../reference/commentsOnStaticMembers.js | 8 +- tests/baselines/reference/commentsVarDecl.js | 4 +- tests/baselines/reference/concatError.js | 10 +- .../baselines/reference/escapedIdentifiers.js | 18 +- tests/baselines/reference/genericArray1.js | 20 +- .../reference/interfaceImplementation1.js | 4 +- .../reference/matchReturnTypeInAllBranches.js | 10 +- .../reference/parser15.4.4.14-9-2.js | 6 +- .../baselines/reference/parserS7.3_A1.1_T2.js | 10 +- .../baselines/reference/parserS7.6_A4.2_T1.js | 10 +- .../baselines/reference/parserS7.9_A5.7_T1.js | 14 +- .../reference/scannerS7.3_A1.1_T2.js | 10 +- .../reference/scannerS7.6_A4.2_T1.js | 10 +- .../reference/sourceMap-FileWithComments.js | 4 +- .../sourceMap-FileWithComments.sourcemap.txt | 6 +- tests/baselines/reference/stradac.js | 4 +- tests/cases/compiler/commentsFormatting.ts | 72 ++++++ 37 files changed, 650 insertions(+), 209 deletions(-) create mode 100644 tests/baselines/reference/commentsFormatting.js create mode 100644 tests/cases/compiler/commentsFormatting.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index c904a9e8f5f..ef3c970e7e6 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -10,12 +10,18 @@ module ts { getLine(): number; getColumn(): number; getIndent(): number; - isLineStart(): boolean; } - var indentStrings: string[] = []; + var indentStrings: string[] = ["", " "]; function getIndentString(level: number) { - return indentStrings[level] || (indentStrings[level] = level === 0 ? "" : getIndentString(level - 1) + " "); + if (indentStrings[level] === undefined) { + indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; + } + return indentStrings[level]; + } + + function getIndentSize() { + return indentStrings[1].length; } export function emitFiles(resolver: EmitResolver): EmitResult { @@ -148,7 +154,6 @@ module ts { getLine: () => lineCount + 1, getColumn: () => lineStart ? indent * 4 + 1 : output.length - linePos + 1, getText: () => output, - isLineStart: () => lineStart }; } @@ -179,7 +184,137 @@ module ts { } function writeCommentRange(comment: Comment, writer: EmitTextWriter) { - writer.writeLiteral(currentSourceFile.text.substring(comment.pos, comment.end)); + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { + var firstCommentLineAndCharacter = currentSourceFile.getLineAndCharacterFromPosition(comment.pos); + var firstCommentLineIndent: number; + var writeNewLine: boolean; + for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { + var nextLineStart = currentSourceFile.getPositionFromLineAndCharacter(currentLine + 1, /*character*/1); + + if (pos !== comment.pos) { + // If we are not emitting first line, we need to adjust the indent + if (writeNewLine) { + writer.writeLine(); + } + + if (firstCommentLineIndent === undefined) { + firstCommentLineIndent = calculateIndent(currentSourceFile.getPositionFromLineAndCharacter(firstCommentLineAndCharacter.line, /*character*/1), + comment.pos); + } + var deltaIndent = calculateIndent(pos, nextLineStart) - firstCommentLineIndent; + if (deltaIndent < 0) { + // we need to decrease indent to get the desired effect + // Comment is left indented to first line + // eg + // module m { + // /* this is line 1 + // * line + // More left indented comment */ + // class c { } + // } + + // Spaces to emit = indentSize - (numberof spaces in lastDeltaIndent) (in above eg (4 - 5%4) = 3) + var spacesToEmit = (deltaIndent % getIndentSize()); // This is negative of spaces to emit = -1 in above case + if (spacesToEmit) { + spacesToEmit += getIndentSize(); // Adjust the delta with the indentSize (4 - 1) = 3 + } + + // Change in delta indent = deltaIndent / indentSize, we will change the delta to upper integer value + // In above eg. 5/4 = 1.75 so change the indent two times + var changeInIndent = (-deltaIndent / getIndentSize()); + + // If we cant go back as much as we want to, go to left most position + if (changeInIndent > writer.getIndent()) { + changeInIndent = writer.getIndent(); + spacesToEmit = 0; + } + + // Decrease the chaneInIndent number of times + for (var i = 0; i < changeInIndent; i++) { + writer.decreaseIndent(); + } + + // Emit either delta spaces or indentSizeSpaces + emitSpaces(spacesToEmit, writeNewLine); + + // Write the comment line text + writeNewLine = writeTrimmedCurrentLine(pos, nextLineStart); + + // Revert the indent + for (var i = 0; i < changeInIndent; i++) { + writer.increaseIndent(); + } + } else { + // Comment is right indented to first line + // eg + // module m { + // /* this is line 1 + // * line + // More right indented comment */ + // class c { } + // } + // In above eg for line 2 in the comment, the delta is single space and hence emit that and emit the trimmed line + // but the third line has delta of 7 spaces and hence emit those spaces before emitting the trimmed line + emitSpaces(deltaIndent, writeNewLine); + writeNewLine = writeTrimmedCurrentLine(pos, nextLineStart); + } + } + else { + // First comment line, emit as it is + writeNewLine = writeTrimmedCurrentLine(pos, nextLineStart); + } + + pos = nextLineStart; + } + } + else { + // Single line comment of styly //.... + writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); + } + + function emitSpaces(count: number, writeNewLine: boolean) { + if (!writeNewLine) { + // If we didnot use WriteLine but instead used writeLiteral to writeNewLine, then we need to make sure we emit indent correctly + writer.write(getIndentString(writer.getIndent())); + } + + // Write spaces + while (count) { + writer.write(" "); + count--; + } + } + + // Returns true if writer should write new line before emitting next line of comment + function writeTrimmedCurrentLine(pos: number, nextLineStart: number) { + var currentLineText = currentSourceFile.text.substring(pos, Math.min(comment.end, nextLineStart - 1)).replace(/^\s+|\s+$/g, ''); + if (currentLineText) { + // trimmed forward and ending spaces text + writer.write(currentLineText); + return true; + } + else { + // Empty string - make sure we write empty line + writer.writeLiteral(sys.newLine); + } + } + + function calculateIndent(pos: number, end: number) { + var currentLineIndent = 0; + while (pos < end && isWhiteSpace(currentSourceFile.text.charCodeAt(pos))) { + pos++; + if (currentSourceFile.text.charCodeAt(pos) === CharacterCodes.tab) { + // Tabs = size of the indent + currentLineIndent += getIndentSize(); + } + else { + // Single space + currentLineIndent++; + } + } + + return currentLineIndent; + } } function emitJavaScript(jsFilePath: string, root?: SourceFile) { diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 550a411faec..1649145495f 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -575,6 +575,13 @@ module ts { return getLineAndCharacterOfPosition(lineStarts, position); } + function getPositionFromSourceLineAndCharacter(line: number, character: number): number { + if (!lineStarts) { + lineStarts = getLineStarts(sourceText); + } + return getPositionFromLineAndCharacter(lineStarts, line, character); + } + function error(message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): void { var start = scanner.getTokenPos(); var length = scanner.getTextPos() - start; @@ -3575,6 +3582,7 @@ module ts { file.filename = normalizePath(filename); file.text = sourceText; file.getLineAndCharacterFromPosition = getLineAndCharacterlFromSourcePosition; + file.getPositionFromLineAndCharacter = getPositionFromSourceLineAndCharacter; file.syntacticErrors = []; file.semanticErrors = []; var referenceComments = processReferenceComments(); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index a53333b3c5f..68a22e98d25 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -264,6 +264,10 @@ module ts { return result; } + export function getPositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number { + return lineStarts[line - 1] + character - 1; + } + export function getLineAndCharacterOfPosition(lineStarts: number[], position: number) { var lineNumber = binarySearch(lineStarts, position); if (lineNumber < 0) { @@ -286,13 +290,13 @@ module ts { var hasOwnProperty = Object.prototype.hasOwnProperty; - function isWhiteSpace(ch: number): boolean { + export function isWhiteSpace(ch: number): boolean { return ch === CharacterCodes.space || ch === CharacterCodes.tab || ch === CharacterCodes.verticalTab || ch === CharacterCodes.formFeed || ch === CharacterCodes.nonBreakingSpace || ch === CharacterCodes.ogham || ch >= CharacterCodes.enQuad && ch <= CharacterCodes.zeroWidthSpace || ch === CharacterCodes.narrowNoBreakSpace || ch === CharacterCodes.mathematicalSpace || ch === CharacterCodes.ideographicSpace || ch === CharacterCodes.byteOrderMark; } - function isLineBreak(ch: number): boolean { + export function isLineBreak(ch: number): boolean { return ch === CharacterCodes.lineFeed || ch === CharacterCodes.carriageReturn || ch === CharacterCodes.lineSeparator || ch === CharacterCodes.paragraphSeparator; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 2c7cdd27d9f..860cbf8aaf4 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -520,6 +520,7 @@ module ts { filename: string; text: string; getLineAndCharacterFromPosition(position: number): { line: number; character: number }; + getPositionFromLineAndCharacter(line: number, character: number): number; amdDependencies: string[]; referencedFiles: FileReference[]; syntacticErrors: Diagnostic[]; diff --git a/src/services/services.ts b/src/services/services.ts index 9ff6266d54e..d03f7ae47c6 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -310,6 +310,7 @@ module ts { public filename: string; public text: string; public getLineAndCharacterFromPosition(position: number): { line: number; character: number } { return null; } + public getPositionFromLineAndCharacter(line: number, character: number): number { return -1; } public amdDependencies: string[]; public referencedFiles: FileReference[]; public syntacticErrors: Diagnostic[]; diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index d876f78309e..e515d7d3532 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -121,16 +121,16 @@ var C3 = (function () { }; return C3; })(); -/* - -This behaves unexpectedly with the following types: - -Type 1 of any[]: - -* Type 2 of the following throws an error but shouldn't: () => void[], SomeClass[], and {one: 1}[]. - -* Type 2 of the following doesn't throw an error but should: {one: 1}, new() => SomeClass, SomeClass. - +/* + +This behaves unexpectedly with the following types: + +Type 1 of any[]: + +* Type 2 of the following throws an error but shouldn't: () => void[], SomeClass[], and {one: 1}[]. + +* Type 2 of the following doesn't throw an error but should: {one: 1}, new() => SomeClass, SomeClass. + */ var a1 = null; var c1 = new C1(); diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index 2f6d610ee1a..1a9c0096172 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -95,16 +95,16 @@ var C3 = (function () { }; return C3; })(); -/* - -This behaves unexpectedly with the following types: - -Type 1 of any[]: - -* Type 2 of the following throws an error but shouldn't: () => void[], SomeClass[], and {one: 1}[]. - -* Type 2 of the following doesn't throw an error but should: {one: 1}, new() => SomeClass, SomeClass. - +/* + +This behaves unexpectedly with the following types: + +Type 1 of any[]: + +* Type 2 of the following throws an error but shouldn't: () => void[], SomeClass[], and {one: 1}[]. + +* Type 2 of the following doesn't throw an error but should: {one: 1}, new() => SomeClass, SomeClass. + */ var a1 = null; var c1 = new C1(); diff --git a/tests/baselines/reference/arrayAssignmentTest4.js b/tests/baselines/reference/arrayAssignmentTest4.js index 6a391264399..4274d150e82 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.js +++ b/tests/baselines/reference/arrayAssignmentTest4.js @@ -35,16 +35,16 @@ var C3 = (function () { }; return C3; })(); -/* - -This behaves unexpectedly with teh following types: - -Type 1 of any[]: - -* Type 2 of the following throws an error but shouldn't: () => void[], SomeClass[], and {one: 1}[]. - -* Type 2 of the following doesn't throw an error but should: {one: 1}, new() => SomeClass, SomeClass. - +/* + +This behaves unexpectedly with teh following types: + +Type 1 of any[]: + +* Type 2 of the following throws an error but shouldn't: () => void[], SomeClass[], and {one: 1}[]. + +* Type 2 of the following doesn't throw an error but should: {one: 1}, new() => SomeClass, SomeClass. + */ var c3 = new C3(); var o1 = { one: 1 }; diff --git a/tests/baselines/reference/commentBeforeStaticMethod1.js b/tests/baselines/reference/commentBeforeStaticMethod1.js index c72e6fed0e3..5c45f6a8cba 100644 --- a/tests/baselines/reference/commentBeforeStaticMethod1.js +++ b/tests/baselines/reference/commentBeforeStaticMethod1.js @@ -12,9 +12,9 @@ class C { var C = (function () { function C() { } - /** - * Returns bar - */ + /** + * Returns bar + */ C.foo = function () { return "bar"; }; diff --git a/tests/baselines/reference/commentOnClassMethod1.js b/tests/baselines/reference/commentOnClassMethod1.js index 1c67e999c43..1f924ba233f 100644 --- a/tests/baselines/reference/commentOnClassMethod1.js +++ b/tests/baselines/reference/commentOnClassMethod1.js @@ -11,8 +11,8 @@ class WebControls { var WebControls = (function () { function WebControls() { } - /** - * Render a control + /** + * Render a control */ WebControls.prototype.createControl = function () { }; diff --git a/tests/baselines/reference/commentsClass.js b/tests/baselines/reference/commentsClass.js index 8419a68ef3a..9cdd20429af 100644 --- a/tests/baselines/reference/commentsClass.js +++ b/tests/baselines/reference/commentsClass.js @@ -117,10 +117,10 @@ var c7 = (function () { })(); var i7 = new c7(); var i7_c = c7; -/** class with statics and constructor +/** class with statics and constructor */ var c8 = (function () { - /** constructor comment + /** constructor comment */ function c8() { } @@ -167,12 +167,12 @@ declare class c7 { } declare var i7: c7; declare var i7_c: typeof c7; -/** class with statics and constructor +/** class with statics and constructor */ declare class c8 { /** s1 comment */ static s1: number; - /** constructor comment + /** constructor comment */ constructor(); } diff --git a/tests/baselines/reference/commentsClassMembers.js b/tests/baselines/reference/commentsClassMembers.js index dd02e967b15..e59690cf7c4 100644 --- a/tests/baselines/reference/commentsClassMembers.js +++ b/tests/baselines/reference/commentsClassMembers.js @@ -393,13 +393,13 @@ var c1 = (function () { return c1.b_s1 + b; }; Object.defineProperty(c1, "b_s3", { - /** static getter property - */ + /** static getter property + */ get: function () { return c1.s2(c1.s1); }, - /** setter property - */ + /** setter property + */ set: function (value) { c1.b_s1 = c1.b_s2(value); }, @@ -532,9 +532,9 @@ declare class c1 { static b_s1: number; /** static sum with property */ static b_s2(b: number): number; - /** static getter property + /** static getter property */ - /** setter property + /** setter property */ static b_s3: number; } diff --git a/tests/baselines/reference/commentsCommentParsing.js b/tests/baselines/reference/commentsCommentParsing.js index 4fb9d802605..de99dfffb41 100644 --- a/tests/baselines/reference/commentsCommentParsing.js +++ b/tests/baselines/reference/commentsCommentParsing.js @@ -169,16 +169,16 @@ multiLine(); function jsDocSingleLine() { } jsDocSingleLine(); -/** this is multiple line jsdoc stule comment -*New line1 +/** this is multiple line jsdoc stule comment +*New line1 *New Line2*/ function jsDocMultiLine() { } jsDocMultiLine(); -/** this is multiple line jsdoc stule comment -*New line1 +/** this is multiple line jsdoc stule comment +*New line1 *New Line2*/ -/** Shoul mege this line as well +/** Shoul mege this line as well * and this too*/ /** Another this one too*/ function jsDocMultiLineMerge() { } @@ -230,9 +230,9 @@ noHelpComment2(); function noHelpComment3() { } noHelpComment3(); -/** Adds two integers and returns the result - * @param {number} a first number - * @param b second number +/** Adds two integers and returns the result + * @param {number} a first number + * @param b second number */ function sum(a, b) { return a + b; @@ -242,7 +242,7 @@ sum(10, 20); /** @param */ /** @param a first number*/ /** @param b */ -/** @param c { +/** @param c { @param d @anotherTag*/ /** @param e LastParam @anotherTag*/ function multiply(a, b, c, d, e) { @@ -251,34 +251,34 @@ function multiply(a, b, c, d, e) { function f1(aOrb, opt) { return aOrb; } -/** This is subtract function -@param { a -*@param { number | } b this is about b -@param { { () => string; } } c this is optional param c -@param { { () => string; } d this is optional param d -@param { { () => string; } } e this is optional param e -@param { { { () => string; } } f this is optional param f +/** This is subtract function +@param { a +*@param { number | } b this is about b +@param { { () => string; } } c this is optional param c +@param { { () => string; } d this is optional param d +@param { { () => string; } } e this is optional param e +@param { { { () => string; } } f this is optional param f */ function subtract(a, b, c, d, e, f) { } -/** this is square function -@paramTag { number } a this is input number of paramTag -@param { number } a this is input number -@returnType { number } it is return type +/** this is square function +@paramTag { number } a this is input number of paramTag +@param { number } a this is input number +@returnType { number } it is return type */ function square(a) { return a * a; } -/** this is divide function -@param { number} a this is a -@paramTag { number } g this is optional param g -@param { number} b this is b +/** this is divide function +@param { number} a this is a +@paramTag { number } g this is optional param g +@param { number} b this is b */ function divide(a, b) { } -/** this is jsdoc style function with param tag as well as inline parameter help -*@param a it is first parameter -*@param c it is third parameter +/** this is jsdoc style function with param tag as well as inline parameter help +*@param a it is first parameter +*@param c it is third parameter */ function jsDocParamTest(a, b, c, d) { return a + b + c + d; @@ -296,14 +296,14 @@ declare function simple(): void; declare function multiLine(): void; /** this is eg of single line jsdoc style comment */ declare function jsDocSingleLine(): void; -/** this is multiple line jsdoc stule comment -*New line1 +/** this is multiple line jsdoc stule comment +*New line1 *New Line2*/ declare function jsDocMultiLine(): void; -/** this is multiple line jsdoc stule comment -*New line1 +/** this is multiple line jsdoc stule comment +*New line1 *New Line2*/ -/** Shoul mege this line as well +/** Shoul mege this line as well * and this too*/ /** Another this one too*/ declare function jsDocMultiLineMerge(): void; /** jsdoc comment */ @@ -322,48 +322,48 @@ declare function jsDocMixedComments6(): void; declare function noHelpComment1(): void; declare function noHelpComment2(): void; declare function noHelpComment3(): void; -/** Adds two integers and returns the result - * @param {number} a first number - * @param b second number +/** Adds two integers and returns the result + * @param {number} a first number + * @param b second number */ declare function sum(a: number, b: number): number; /** This is multiplication function*/ /** @param */ /** @param a first number*/ /** @param b */ -/** @param c { +/** @param c { @param d @anotherTag*/ /** @param e LastParam @anotherTag*/ declare function multiply(a: number, b: number, c?: number, d?: any, e?: any): void; -/** fn f1 with number -* @param { string} b about b +/** fn f1 with number +* @param { string} b about b */ declare function f1(a: number): any; declare function f1(b: string): any; -/** This is subtract function -@param { a -*@param { number | } b this is about b -@param { { () => string; } } c this is optional param c -@param { { () => string; } d this is optional param d -@param { { () => string; } } e this is optional param e -@param { { { () => string; } } f this is optional param f +/** This is subtract function +@param { a +*@param { number | } b this is about b +@param { { () => string; } } c this is optional param c +@param { { () => string; } d this is optional param d +@param { { () => string; } } e this is optional param e +@param { { { () => string; } } f this is optional param f */ declare function subtract(a: number, b: number, c?: () => string, d?: () => string, e?: () => string, f?: () => string): void; -/** this is square function -@paramTag { number } a this is input number of paramTag -@param { number } a this is input number -@returnType { number } it is return type +/** this is square function +@paramTag { number } a this is input number of paramTag +@param { number } a this is input number +@returnType { number } it is return type */ declare function square(a: number): number; -/** this is divide function -@param { number} a this is a -@paramTag { number } g this is optional param g -@param { number} b this is b +/** this is divide function +@param { number} a this is a +@paramTag { number } g this is optional param g +@param { number} b this is b */ declare function divide(a: number, b: number): void; -/** this is jsdoc style function with param tag as well as inline parameter help -*@param a it is first parameter -*@param c it is third parameter +/** this is jsdoc style function with param tag as well as inline parameter help +*@param a it is first parameter +*@param c it is third parameter */ declare function jsDocParamTest(/** this is inline comment for a */ a: number, /** this is inline comment for b*/ b: number, c: number, d: number): number; declare class NoQuickInfoClass { diff --git a/tests/baselines/reference/commentsExternalModules.js b/tests/baselines/reference/commentsExternalModules.js index 33db2669c6f..74920337ab7 100644 --- a/tests/baselines/reference/commentsExternalModules.js +++ b/tests/baselines/reference/commentsExternalModules.js @@ -98,13 +98,13 @@ define(["require", "exports"], function (require, exports) { (function (m4) { /** b's comment */ m4.b; - /** foo's comment - */ + /** foo's comment + */ function foo() { return m4.b; } - /** m2 comments - */ + /** m2 comments + */ (function (m2) { /** class comment; */ var c = (function () { @@ -157,7 +157,7 @@ export declare module m1 { export declare module m4 { /** b's comment */ var b: number; - /** m2 comments + /** m2 comments */ module m2 { /** class comment; */ diff --git a/tests/baselines/reference/commentsExternalModules2.js b/tests/baselines/reference/commentsExternalModules2.js index 41bf2420e3d..350eff08828 100644 --- a/tests/baselines/reference/commentsExternalModules2.js +++ b/tests/baselines/reference/commentsExternalModules2.js @@ -98,13 +98,13 @@ define(["require", "exports"], function (require, exports) { (function (m4) { /** b's comment */ m4.b; - /** foo's comment - */ + /** foo's comment + */ function foo() { return m4.b; } - /** m2 comments - */ + /** m2 comments + */ (function (m2) { /** class comment; */ var c = (function () { @@ -157,7 +157,7 @@ export declare module m1 { export declare module m4 { /** b's comment */ var b: number; - /** m2 comments + /** m2 comments */ module m2 { /** class comment; */ diff --git a/tests/baselines/reference/commentsFormatting.js b/tests/baselines/reference/commentsFormatting.js new file mode 100644 index 00000000000..4ad0d8d6f23 --- /dev/null +++ b/tests/baselines/reference/commentsFormatting.js @@ -0,0 +1,220 @@ +//// [commentsFormatting.ts] + +module m { + /** this is first line - aligned to class declaration +* this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + export class c { + } + + /** this is first line - 4 spaces right aligned to class but in js file should be aligned to class declaration +* this is 8 spaces left aligned + * this is 7 spaces left aligned + * this is 6 spaces left aligned + * this is 5 spaces left aligned + * this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + export class c2 { + } + + /** this is comment with new lines in between + +this is 4 spaces left aligned but above line is empty + + this is 3 spaces left aligned but above line is empty + + this is 2 spaces left aligned but above line is empty + + this is 1 spaces left aligned but above line is empty + + this is at same level as first line but above line is empty + + this is 1 spaces right aligned but above line is empty + + this is 2 spaces right aligned but above line is empty + + this is 3 spaces right aligned but above line is empty + + this is 4 spaces right aligned but above line is empty + + + Above 2 lines are empty + + + + above 3 lines are empty*/ + export class c3 { + } +} + +//// [commentsFormatting.js] +var m; +(function (m) { + /** this is first line - aligned to class declaration +* this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + var c = (function () { + function c() { + } + return c; + })(); + m.c = c; + /** this is first line - 4 spaces right aligned to class but in js file should be aligned to class declaration +* this is 8 spaces left aligned +* this is 7 spaces left aligned +* this is 6 spaces left aligned +* this is 5 spaces left aligned +* this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + var c2 = (function () { + function c2() { + } + return c2; + })(); + m.c2 = c2; + /** this is comment with new lines in between + +this is 4 spaces left aligned but above line is empty + + this is 3 spaces left aligned but above line is empty + + this is 2 spaces left aligned but above line is empty + + this is 1 spaces left aligned but above line is empty + + this is at same level as first line but above line is empty + + this is 1 spaces right aligned but above line is empty + + this is 2 spaces right aligned but above line is empty + + this is 3 spaces right aligned but above line is empty + + this is 4 spaces right aligned but above line is empty + + + Above 2 lines are empty + + + + above 3 lines are empty*/ + var c3 = (function () { + function c3() { + } + return c3; + })(); + m.c3 = c3; +})(m || (m = {})); + + +//// [commentsFormatting.d.ts] +declare module m { + /** this is first line - aligned to class declaration +* this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + class c { + } + /** this is first line - 4 spaces right aligned to class but in js file should be aligned to class declaration +* this is 8 spaces left aligned +* this is 7 spaces left aligned +* this is 6 spaces left aligned +* this is 5 spaces left aligned +* this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + class c2 { + } + /** this is comment with new lines in between + +this is 4 spaces left aligned but above line is empty + + this is 3 spaces left aligned but above line is empty + + this is 2 spaces left aligned but above line is empty + + this is 1 spaces left aligned but above line is empty + + this is at same level as first line but above line is empty + + this is 1 spaces right aligned but above line is empty + + this is 2 spaces right aligned but above line is empty + + this is 3 spaces right aligned but above line is empty + + this is 4 spaces right aligned but above line is empty + + + Above 2 lines are empty + + + + above 3 lines are empty*/ + class c3 { + } +} diff --git a/tests/baselines/reference/commentsFunction.js b/tests/baselines/reference/commentsFunction.js index 8f2bb57679e..bc66210f085 100644 --- a/tests/baselines/reference/commentsFunction.js +++ b/tests/baselines/reference/commentsFunction.js @@ -35,8 +35,8 @@ function fooWithParameters(a, /** this is comment for b*/ var d = a; } fooWithParameters("a", 10); -/** fooFunc - * comment +/** fooFunc + * comment */ var fooFunc = function FooFunctionValue(b) { return b; @@ -54,8 +54,8 @@ declare function foo(): void; /** This is comment for function signature*/ declare function fooWithParameters(/** this is comment about a*/ a: string, /** this is comment for b*/ b: number): void; -/** fooFunc - * comment +/** fooFunc + * comment */ declare var fooFunc: (b: string) => string; declare var lambdaFoo: (a: number, b: number) => number; diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index 5cc18001840..7d0361dea6d 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -370,8 +370,8 @@ interface i2 { interface i3 extends i2 { /** i3 p1 */ p1: number; - /** - * i3 f1 + /** + * i3 f1 */ f1(): void; /** i3 l1*/ diff --git a/tests/baselines/reference/commentsModules.js b/tests/baselines/reference/commentsModules.js index c5fb8fbf115..09ae77b1ae8 100644 --- a/tests/baselines/reference/commentsModules.js +++ b/tests/baselines/reference/commentsModules.js @@ -130,14 +130,14 @@ var m1; function foo2Export(a) { } m1.foo2Export = foo2Export; - /** foo3Export - * comment + /** foo3Export + * comment */ function foo3Export() { } m1.foo3Export = foo3Export; - /** foo4Export - * comment + /** foo4Export + * comment */ function foo4Export() { } @@ -286,8 +286,8 @@ declare module m1 { /** exported function*/ function fooExport(): number; function foo2Export(/**hm*/ a: string): void; - /** foo3Export - * comment + /** foo3Export + * comment */ function foo3Export(): void; } diff --git a/tests/baselines/reference/commentsOnObjectLiteral2.js b/tests/baselines/reference/commentsOnObjectLiteral2.js index 028a17652fa..e44a462de5e 100644 --- a/tests/baselines/reference/commentsOnObjectLiteral2.js +++ b/tests/baselines/reference/commentsOnObjectLiteral2.js @@ -14,11 +14,11 @@ var Person = makeClass( //// [commentsOnObjectLiteral2.js] var Person = makeClass({ - /** - This is just another way to define a constructor. - @constructs - @param {string} name The name of the person. - */ + /** + This is just another way to define a constructor. + @constructs + @param {string} name The name of the person. + */ initialize: function (name) { this.name = name; } diff --git a/tests/baselines/reference/commentsOnStaticMembers.js b/tests/baselines/reference/commentsOnStaticMembers.js index 550509beea7..867c4128940 100644 --- a/tests/baselines/reference/commentsOnStaticMembers.js +++ b/tests/baselines/reference/commentsOnStaticMembers.js @@ -24,12 +24,12 @@ class test { var test = (function () { function test() { } - /** - * p1 comment appears in output + /** + * p1 comment appears in output */ test.p1 = ""; - /** - * p3 comment appears in output + /** + * p3 comment appears in output */ test.p3 = ""; return test; diff --git a/tests/baselines/reference/commentsVarDecl.js b/tests/baselines/reference/commentsVarDecl.js index d01d7e561d3..5fc05eac29e 100644 --- a/tests/baselines/reference/commentsVarDecl.js +++ b/tests/baselines/reference/commentsVarDecl.js @@ -50,7 +50,7 @@ var myVariable = 10; var anotherVariable = 30; // shouldn't appear var aVar = ""; -/** this is multiline comment +/** this is multiline comment * All these variables are of number type */ var anotherAnotherVariable = 70; /** Triple slash multiline comment*/ @@ -79,7 +79,7 @@ declare var myVariable: number; /** This is another variable comment*/ declare var anotherVariable: number; declare var aVar: string; -/** this is multiline comment +/** this is multiline comment * All these variables are of number type */ declare var anotherAnotherVariable: number; /** Triple slash multiline comment*/ diff --git a/tests/baselines/reference/concatError.js b/tests/baselines/reference/concatError.js index 96af4af53a0..e4ae4afdb65 100644 --- a/tests/baselines/reference/concatError.js +++ b/tests/baselines/reference/concatError.js @@ -34,11 +34,11 @@ c = c.m(cc); //// [concatError.js] var n1; -/* -interface Array { - concat(...items: T[][]): T[]; // Note: This overload needs to be picked for arrays of arrays, even though both are applicable - concat(...items: T[]): T[]; -} +/* +interface Array { + concat(...items: T[][]): T[]; // Note: This overload needs to be picked for arrays of arrays, even though both are applicable + concat(...items: T[]): T[]; +} */ var fa; fa = fa.concat([0]); diff --git a/tests/baselines/reference/escapedIdentifiers.js b/tests/baselines/reference/escapedIdentifiers.js index 8e4200f4224..cabeb7f1d5d 100644 --- a/tests/baselines/reference/escapedIdentifiers.js +++ b/tests/baselines/reference/escapedIdentifiers.js @@ -120,15 +120,15 @@ l\u0061bel4: } //// [escapedIdentifiers.js] -/* - 0 .. \u0030 - 9 .. \u0039 - - A .. \u0041 - Z .. \u005a - - a .. \u0061 - z .. \u00za +/* + 0 .. \u0030 + 9 .. \u0039 + + A .. \u0041 + Z .. \u005a + + a .. \u0061 + z .. \u00za */ // var decl var \u0061 = 1; diff --git a/tests/baselines/reference/genericArray1.js b/tests/baselines/reference/genericArray1.js index 68f0d8e1552..74b66515dc9 100644 --- a/tests/baselines/reference/genericArray1.js +++ b/tests/baselines/reference/genericArray1.js @@ -15,16 +15,16 @@ var lengths = ["a", "b", "c"].map(x => x.length); //// [genericArray1.js] -/* -var n: number[]; - -interface Array { -map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; -} - -interface String{ - length: number; -} +/* +var n: number[]; + +interface Array { +map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; +} + +interface String{ + length: number; +} */ var lengths = ["a", "b", "c"].map(function (x) { return x.length; }); diff --git a/tests/baselines/reference/interfaceImplementation1.js b/tests/baselines/reference/interfaceImplementation1.js index 68c6fe5ad7e..ce82a24f63d 100644 --- a/tests/baselines/reference/interfaceImplementation1.js +++ b/tests/baselines/reference/interfaceImplementation1.js @@ -64,8 +64,8 @@ var a = function () { return new C2(); }; new a(); -/*var b:I4 = C2; -new b(); +/*var b:I4 = C2; +new b(); */ var c; c[5]; diff --git a/tests/baselines/reference/matchReturnTypeInAllBranches.js b/tests/baselines/reference/matchReturnTypeInAllBranches.js index 6cc838d4480..5e9b88f61ac 100644 --- a/tests/baselines/reference/matchReturnTypeInAllBranches.js +++ b/tests/baselines/reference/matchReturnTypeInAllBranches.js @@ -45,11 +45,11 @@ var IceCreamMonster = (function () { this.soundsWhenEating = soundsWhenEating; this.name = name; } - /** -* Tells the IceCreamMonster to eat their ice cre am! -* -* @param {number} amount The amount of ice cream to e at. -* @return {boolean} True if ice cream remains, false if there is no more ice cream le ft. + /** +* Tells the IceCreamMonster to eat their ice cre am! +* +* @param {number} amount The amount of ice cream to e at. +* @return {boolean} True if ice cream remains, false if there is no more ice cream le ft. */ IceCreamMonster.prototype.eatIceCream = function (amount) { this.iceCreamRemaining -= amount; diff --git a/tests/baselines/reference/parser15.4.4.14-9-2.js b/tests/baselines/reference/parser15.4.4.14-9-2.js index cb0881a5336..9680dbff36b 100644 --- a/tests/baselines/reference/parser15.4.4.14-9-2.js +++ b/tests/baselines/reference/parser15.4.4.14-9-2.js @@ -32,9 +32,9 @@ runTestCase(testcase); /// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the /// "Use Terms"). Any redistribution of this code must retain the above /// copyright and this notice and otherwise comply with the Use Terms. -/** - * @path ch15/15.4/15.4.4/15.4.4.14/15.4.4.14-9-2.js - * @description Array.prototype.indexOf must return correct index (Number) +/** + * @path ch15/15.4/15.4.4/15.4.4.14/15.4.4.14-9-2.js + * @description Array.prototype.indexOf must return correct index (Number) */ function testcase() { var obj = { toString: function () { diff --git a/tests/baselines/reference/parserS7.3_A1.1_T2.js b/tests/baselines/reference/parserS7.3_A1.1_T2.js index 69a7d22d01a..5e58e74b34e 100644 --- a/tests/baselines/reference/parserS7.3_A1.1_T2.js +++ b/tests/baselines/reference/parserS7.3_A1.1_T2.js @@ -23,11 +23,11 @@ if (x !== 1) { //// [parserS7.3_A1.1_T2.js] // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * LINE FEED (U+000A) may occur between any two tokens - * - * @path ch07/7.3/S7.3_A1.1_T2.js - * @description Insert real LINE FEED between tokens of var x=1 +/** + * LINE FEED (U+000A) may occur between any two tokens + * + * @path ch07/7.3/S7.3_A1.1_T2.js + * @description Insert real LINE FEED between tokens of var x=1 */ //CHECK#1 var x = 1; diff --git a/tests/baselines/reference/parserS7.6_A4.2_T1.js b/tests/baselines/reference/parserS7.6_A4.2_T1.js index 3ce99b68e47..2053e615f7c 100644 --- a/tests/baselines/reference/parserS7.6_A4.2_T1.js +++ b/tests/baselines/reference/parserS7.6_A4.2_T1.js @@ -148,11 +148,11 @@ if (Ё !== 1) { //// [parserS7.6_A4.2_T1.js] // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * Correct interpretation of RUSSIAN ALPHABET - * - * @path ch07/7.6/S7.6_A4.2_T1.js - * @description Check RUSSIAN CAPITAL ALPHABET +/** + * Correct interpretation of RUSSIAN ALPHABET + * + * @path ch07/7.6/S7.6_A4.2_T1.js + * @description Check RUSSIAN CAPITAL ALPHABET */ //CHECK#А-Я var \u0410 = 1; diff --git a/tests/baselines/reference/parserS7.9_A5.7_T1.js b/tests/baselines/reference/parserS7.9_A5.7_T1.js index 8f600665212..ae5896c28e5 100644 --- a/tests/baselines/reference/parserS7.9_A5.7_T1.js +++ b/tests/baselines/reference/parserS7.9_A5.7_T1.js @@ -23,13 +23,13 @@ y //// [parserS7.9_A5.7_T1.js] // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * Since LineTerminator(LT) between Postfix Increment/Decrement Operator(I/DO) and operand is not allowed, two IO(just as two DO and their combination) - * between two references separated by [LT] after automatic semicolon insertion lead to syntax error - * - * @path ch07/7.9/S7.9_A5.7_T1.js - * @description Try use Variable1 \n ++ \n ++ \n Variable2 construction - * @negative +/** + * Since LineTerminator(LT) between Postfix Increment/Decrement Operator(I/DO) and operand is not allowed, two IO(just as two DO and their combination) + * between two references separated by [LT] after automatic semicolon insertion lead to syntax error + * + * @path ch07/7.9/S7.9_A5.7_T1.js + * @description Try use Variable1 \n ++ \n ++ \n Variable2 construction + * @negative */ var x = 0, y = 0; var z = x; diff --git a/tests/baselines/reference/scannerS7.3_A1.1_T2.js b/tests/baselines/reference/scannerS7.3_A1.1_T2.js index b107b5d6695..7c3563abe13 100644 --- a/tests/baselines/reference/scannerS7.3_A1.1_T2.js +++ b/tests/baselines/reference/scannerS7.3_A1.1_T2.js @@ -23,11 +23,11 @@ if (x !== 1) { //// [scannerS7.3_A1.1_T2.js] // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * LINE FEED (U+000A) may occur between any two tokens - * - * @path ch07/7.3/S7.3_A1.1_T2.js - * @description Insert real LINE FEED between tokens of var x=1 +/** + * LINE FEED (U+000A) may occur between any two tokens + * + * @path ch07/7.3/S7.3_A1.1_T2.js + * @description Insert real LINE FEED between tokens of var x=1 */ //CHECK#1 var x = 1; diff --git a/tests/baselines/reference/scannerS7.6_A4.2_T1.js b/tests/baselines/reference/scannerS7.6_A4.2_T1.js index 653265db9db..62936bdc617 100644 --- a/tests/baselines/reference/scannerS7.6_A4.2_T1.js +++ b/tests/baselines/reference/scannerS7.6_A4.2_T1.js @@ -148,11 +148,11 @@ if (Ё !== 1) { //// [scannerS7.6_A4.2_T1.js] // Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. -/** - * Correct interpretation of RUSSIAN ALPHABET - * - * @path ch07/7.6/S7.6_A4.2_T1.js - * @description Check RUSSIAN CAPITAL ALPHABET +/** + * Correct interpretation of RUSSIAN ALPHABET + * + * @path ch07/7.6/S7.6_A4.2_T1.js + * @description Check RUSSIAN CAPITAL ALPHABET */ //CHECK#А-Я var \u0410 = 1; diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js b/tests/baselines/reference/sourceMap-FileWithComments.js index 7e966e06af9..6143ff95fb8 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js +++ b/tests/baselines/reference/sourceMap-FileWithComments.js @@ -61,8 +61,8 @@ var Shapes; function foo() { } Shapes.foo = foo; - /** comment after function - * this is another comment + /** comment after function + * this is another comment */ var b = 10; })(Shapes || (Shapes = {})); diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index acde8cecb90..8dc11688ab0 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -465,7 +465,7 @@ sourceFile:sourceMap-FileWithComments.ts 3 > ^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^-> +6 > ^^^^^^^^^^^-> 1-> 2 > foo 3 > @@ -478,7 +478,7 @@ sourceFile:sourceMap-FileWithComments.ts 4 >Emitted(24, 21) Source(26, 6) + SourceIndex(0) name (Shapes) 5 >Emitted(24, 22) Source(26, 6) + SourceIndex(0) name (Shapes) --- ->>> /** comment after function +>>> /** comment after function 1->^^^^ 2 > 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> @@ -492,7 +492,7 @@ sourceFile:sourceMap-FileWithComments.ts 1->Emitted(25, 5) Source(31, 5) + SourceIndex(0) name (Shapes) 2 >Emitted(25, 5) Source(28, 5) + SourceIndex(0) name (Shapes) --- ->>> * this is another comment +>>> * this is another comment >>> */ 1->^^^^^^ 2 > ^^^^^^^^^^-> diff --git a/tests/baselines/reference/stradac.js b/tests/baselines/reference/stradac.js index b4f7cb8d990..2f7ef1d11c6 100644 --- a/tests/baselines/reference/stradac.js +++ b/tests/baselines/reference/stradac.js @@ -15,8 +15,8 @@ function foo() { //// [stradac.js] var x = 10; // C++-style comment -/* - C-Style comment +/* + C-Style comment */ function foo() { x++; diff --git a/tests/cases/compiler/commentsFormatting.ts b/tests/cases/compiler/commentsFormatting.ts new file mode 100644 index 00000000000..d7e388a9340 --- /dev/null +++ b/tests/cases/compiler/commentsFormatting.ts @@ -0,0 +1,72 @@ +// @target: ES5 +// @declaration: true +// @comments: true + +module m { + /** this is first line - aligned to class declaration +* this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + export class c { + } + + /** this is first line - 4 spaces right aligned to class but in js file should be aligned to class declaration +* this is 8 spaces left aligned + * this is 7 spaces left aligned + * this is 6 spaces left aligned + * this is 5 spaces left aligned + * this is 4 spaces left aligned + * this is 3 spaces left aligned + * this is 2 spaces left aligned + * this is 1 spaces left aligned + * this is at same level as first line + * this is 1 spaces right aligned + * this is 2 spaces right aligned + * this is 3 spaces right aligned + * this is 4 spaces right aligned + * this is 5 spaces right aligned + * this is 6 spaces right aligned + * this is 7 spaces right aligned + * this is 8 spaces right aligned */ + export class c2 { + } + + /** this is comment with new lines in between + +this is 4 spaces left aligned but above line is empty + + this is 3 spaces left aligned but above line is empty + + this is 2 spaces left aligned but above line is empty + + this is 1 spaces left aligned but above line is empty + + this is at same level as first line but above line is empty + + this is 1 spaces right aligned but above line is empty + + this is 2 spaces right aligned but above line is empty + + this is 3 spaces right aligned but above line is empty + + this is 4 spaces right aligned but above line is empty + + + Above 2 lines are empty + + + + above 3 lines are empty*/ + export class c3 { + } +} \ No newline at end of file