Add tests for preserving comments
This commit is contained in:
parent
01667eff1c
commit
8f18912d28
|
@ -112,7 +112,7 @@ exports.delint = delint;
|
|||
var fileNames = process.argv.slice(2);
|
||||
fileNames.forEach(function (fileName) {
|
||||
// Parse a file
|
||||
var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), 2 /* ES6 */, true);
|
||||
var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), 2 /* ES6 */, /*setParentNodes */ true);
|
||||
// delint it
|
||||
delint(sourceFile);
|
||||
});
|
||||
|
|
|
@ -8,4 +8,5 @@ s.map(// do something
|
|||
//// [commentInMethodCall.js]
|
||||
//commment here
|
||||
var s;
|
||||
s.map(function () { });
|
||||
s.map(// do something
|
||||
function () { });
|
||||
|
|
|
@ -6,5 +6,5 @@ var v = {
|
|||
|
||||
//// [commentsBeforeFunctionExpression1.js]
|
||||
var v = {
|
||||
f: function (a) { return 0; }
|
||||
f: /**own f*/ function (a) { return 0; }
|
||||
};
|
||||
|
|
|
@ -89,7 +89,7 @@ var i2_i_nc_fnfoo = i2_i.nc_fnfoo;
|
|||
var i2_i_nc_fnfoo_r = i2_i.nc_fnfoo(10);
|
||||
var i3_i;
|
||||
i3_i = {
|
||||
f: function (/**i3_i a*/ a) { return "Hello" + a; },
|
||||
f: /**own f*/ function (/**i3_i a*/ a) { return "Hello" + a; },
|
||||
l: this.f,
|
||||
/** own x*/
|
||||
x: this.f(10),
|
||||
|
|
|
@ -20,8 +20,8 @@ function makePoint(x) {
|
|||
};
|
||||
}
|
||||
;
|
||||
var point = makePoint(2);
|
||||
var x = point.x;
|
||||
var /*4*/ point = makePoint(2);
|
||||
var /*2*/ x = point.x;
|
||||
point.x = 30;
|
||||
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ function makePoint(x) {
|
|||
};
|
||||
}
|
||||
;
|
||||
var point = makePoint(2);
|
||||
var x = point.x;
|
||||
var /*4*/ point = makePoint(2);
|
||||
var /*2*/ x = point.x;
|
||||
|
||||
|
||||
//// [declFileObjectLiteralWithOnlyGetter.d.ts]
|
||||
|
|
|
@ -17,7 +17,7 @@ function makePoint(x) {
|
|||
};
|
||||
}
|
||||
;
|
||||
var point = makePoint(2);
|
||||
var /*3*/ point = makePoint(2);
|
||||
point.x = 30;
|
||||
|
||||
|
||||
|
|
|
@ -890,7 +890,7 @@ var Formatting;
|
|||
return result;
|
||||
};
|
||||
Indenter.GetIndentSizeFromIndentText = function (indentText, editorOptions) {
|
||||
return GetIndentSizeFromText(indentText, editorOptions, false);
|
||||
return GetIndentSizeFromText(indentText, editorOptions, /*includeNonIndentChars:*/ false);
|
||||
};
|
||||
Indenter.GetIndentSizeFromText = function (text, editorOptions, includeNonIndentChars) {
|
||||
var indentSize = 0;
|
||||
|
@ -1174,7 +1174,7 @@ var Formatting;
|
|||
return null;
|
||||
var origIndentText = this.snapshot.GetText(new Span(indentEditInfo.OrigIndentPosition, indentEditInfo.OrigIndentLength()));
|
||||
var newIndentText = indentEditInfo.Indentation();
|
||||
var origIndentSize = Indenter.GetIndentSizeFromText(origIndentText, this.editorOptions, true);
|
||||
var origIndentSize = Indenter.GetIndentSizeFromText(origIndentText, this.editorOptions, /*includeNonIndentChars*/ true);
|
||||
var newIndentSize = Indenter.GetIndentSizeFromIndentText(newIndentText, this.editorOptions);
|
||||
// Check the child's position whether it's before the parent position
|
||||
// if so indent the child based on the first token on the line as opposed to the parent position
|
||||
|
|
Loading…
Reference in a new issue