Don't normalize whitespace in fourslash tests (#18447)

* Don't normalize whitespace in fourslash tests

* Only render whitespace when the diff is text-only
This commit is contained in:
Andy
2017-09-14 08:23:50 -07:00
committed by GitHub
parent cf53743bd6
commit d96dfeb708
16 changed files with 82 additions and 83 deletions

View File

@@ -2019,7 +2019,7 @@ namespace ts {
startPosition,
endPosition,
program: getProgram(),
newLineCharacter: host.getNewLine(),
newLineCharacter: formatOptions ? formatOptions.newLineCharacter : host.getNewLine(),
rulesProvider: getRuleProvider(formatOptions),
cancellationToken
};

View File

@@ -184,16 +184,12 @@ namespace ts.textChanges {
return s;
}
function getNewlineKind(context: { newLineCharacter: string }) {
return context.newLineCharacter === "\n" ? NewLineKind.LineFeed : NewLineKind.CarriageReturnLineFeed;
}
export class ChangeTracker {
private changes: Change[] = [];
private readonly newLineCharacter: string;
public static fromContext(context: RefactorContext | CodeFixContext) {
return new ChangeTracker(getNewlineKind(context), context.rulesProvider);
return new ChangeTracker(context.newLineCharacter === "\n" ? NewLineKind.LineFeed : NewLineKind.CarriageReturnLineFeed, context.rulesProvider);
}
constructor(