From 3119839d55d1d4569d001e67f4e4185b3478f73e Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 23 Feb 2015 22:21:03 -0800 Subject: [PATCH] addressed CR feedback --- src/harness/fourslash.ts | 15 +-------------- src/services/formatting/smartIndenter.ts | 7 +++++++ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index c022d4a95b9..d8b7c358a55 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -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 { diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 89bf9e674ee..593e6163e29 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -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;