From 2ce6c5635dc41fd1c098830071b65ca16cdaf5c5 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Tue, 13 Jan 2015 19:11:21 -0800 Subject: [PATCH] do not apply format on enter for the first line --- src/services/formatting/formatting.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 13c423e9813..787c6fe3f46 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -68,7 +68,9 @@ module ts.formatting { export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { var line = sourceFile.getLineAndCharacterFromPosition(position).line; - Debug.assert(line >= 2); + if (line === 1) { + return []; + } // get the span for the previous\current line var span = { // get start position for the previous line