addressed CR feedback

This commit is contained in:
Vladimir Matveev 2015-02-23 22:21:03 -08:00
parent db5b1b387c
commit 3119839d55
2 changed files with 8 additions and 14 deletions

View File

@ -1481,20 +1481,7 @@ module FourSlash {
}
public copyFormatOptions(): ts.FormatCodeOptions {
return {
ConvertTabsToSpaces: this.formatCodeOptions.ConvertTabsToSpaces,
IndentSize: this.formatCodeOptions.IndentSize,
InsertSpaceAfterCommaDelimiter: this.formatCodeOptions.InsertSpaceAfterCommaDelimiter,
InsertSpaceAfterFunctionKeywordForAnonymousFunctions: this.formatCodeOptions.InsertSpaceAfterFunctionKeywordForAnonymousFunctions,
InsertSpaceAfterKeywordsInControlFlowStatements: this.formatCodeOptions.InsertSpaceAfterKeywordsInControlFlowStatements,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: this.formatCodeOptions.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis,
InsertSpaceAfterSemicolonInForStatements: this.formatCodeOptions.InsertSpaceAfterSemicolonInForStatements,
InsertSpaceBeforeAndAfterBinaryOperators: this.formatCodeOptions.InsertSpaceBeforeAndAfterBinaryOperators,
NewLineCharacter: this.formatCodeOptions.NewLineCharacter,
PlaceOpenBraceOnNewLineForControlBlocks: this.formatCodeOptions.PlaceOpenBraceOnNewLineForControlBlocks,
PlaceOpenBraceOnNewLineForFunctions: this.formatCodeOptions.PlaceOpenBraceOnNewLineForFunctions,
TabSize: this.formatCodeOptions.TabSize
}
return ts.clone(this.formatCodeOptions);
}
public setFormatOptions(formatCodeOptions: ts.FormatCodeOptions): ts.FormatCodeOptions {

View File

@ -306,6 +306,13 @@ module ts.formatting {
return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options);
}
/*
Character is the actual index of the character since the beginning of the line.
Column - position of the character after expanding tabs to spaces
"0\t2$"
value of 'character' for '$' is 3
value of 'column' for '$' is 6 (assuming that tab size is 4)
*/
export function findFirstNonWhitespaceCharacterAndColumn(startPos: number, endPos: number, sourceFile: SourceFile, options: EditorOptions) {
var character = 0;
var column = 0;