From 82e8e4323695ff303b98687712fc0fc3392f280e Mon Sep 17 00:00:00 2001 From: Arthur Ozga Date: Tue, 25 Oct 2016 10:38:41 -0700 Subject: [PATCH] only remove whitespace for expr assignment --- src/services/navigationBar.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 7ebefe7bdbd..f274810a323 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -404,10 +404,10 @@ namespace ts.NavigationBar { if (getModifierFlags(node) & ModifierFlags.Default) { return "default"; } - // We ma get a string with newlines or other whitespace in the case of an object dereference + // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the // navigation bar. - return getFunctionOrClassName(node).replace(whiteSpaceRegex, ""); + return getFunctionOrClassName(node); case SyntaxKind.Constructor: return "constructor"; case SyntaxKind.ConstructSignature: @@ -606,11 +606,11 @@ namespace ts.NavigationBar { // See if it is of the form " = function(){...}". If so, use the text from the left-hand side. else if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken) { - return nodeText((node.parent as BinaryExpression).left); + return nodeText((node.parent as BinaryExpression).left).replace(whiteSpaceRegex, ""); } // See if it is a property assignment, and if so use the property name else if (node.parent.kind === SyntaxKind.PropertyAssignment && (node.parent as PropertyAssignment).name) { - return nodeText((node.parent as PropertyAssignment).name); + return nodeText((node.parent as PropertyAssignment).name).replace(whiteSpaceRegex, "#"); } // Default exports are named "default" else if (getModifierFlags(node) & ModifierFlags.Default) {