Skip to content

Commit

Permalink
fix(tsfmt): replace line delimiter to formatOptions.NewLineCharacter f…
Browse files Browse the repository at this point in the history
…ixes #26
  • Loading branch information
vvakame committed Oct 14, 2015
1 parent ae3369f commit 8d84ddb
Show file tree
Hide file tree
Showing 14 changed files with 824 additions and 825 deletions.
6 changes: 4 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,16 @@ export function processString(fileName: string, content: string, opts: Options):
let formattedCode = formatter(fileName, content, formatOptions);
if ((<any>formattedCode).trimRight) {
formattedCode = (<any>formattedCode).trimRight();
formattedCode += "\n";
formattedCode += formatOptions.NewLineCharacter;
}

postProcesses.forEach(postProcess => {
formattedCode = postProcess(fileName, formattedCode, opts, formatOptions) || formattedCode;
});

// TODO replace newline code. NewLineCharacter params affect to only "new" newline. maybe.
// replace newline code. maybe NewLineCharacter params affect to only "new" newline by language service.
formattedCode = formattedCode.replace(/\r?\n/g, formatOptions.NewLineCharacter);

let message: string;
let error = false;
if (opts && opts.verify) {
Expand Down
Loading

0 comments on commit 8d84ddb

Please sign in to comment.