Merge pull request #8487 from ziacik/fix-space-tab-indentation

Fix space tab indentation
This commit is contained in:
Mohamed Hegazy
2016-05-06 15:43:14 -07:00
3 changed files with 69 additions and 3 deletions

View File

@@ -866,13 +866,17 @@ namespace ts.formatting {
}
else {
let tokenStart = sourceFile.getLineAndCharacterOfPosition(pos);
if (indentation !== tokenStart.character) {
let startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile);
let startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile);
if (indentation !== tokenStart.character || indentationIsDifferent(indentationString, startLinePosition)) {
recordReplace(startLinePosition, tokenStart.character, indentationString);
}
}
}
function indentationIsDifferent(indentationString: string, startLinePosition: number): boolean {
return indentationString !== sourceFile.text.substr(startLinePosition , indentationString.length);
}
function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) {
// split comment in lines
let startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line;
@@ -1152,4 +1156,4 @@ namespace ts.formatting {
return s;
}
}
}
}