Skip to content

Commit 82e8e43

Browse files
committed
only remove whitespace for expr assignment
1 parent cb804df commit 82e8e43

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎src/services/navigationBar.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,10 @@ namespace ts.NavigationBar {
404404
if (getModifierFlags(node) & ModifierFlags.Default) {
405405
return "default";
406406
}
407-
// We ma get a string with newlines or other whitespace in the case of an object dereference
407+
// We may get a string with newlines or other whitespace in the case of an object dereference
408408
// (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the
409409
// navigation bar.
410-
return getFunctionOrClassName(<ArrowFunction | FunctionExpression | ClassExpression>node).replace(whiteSpaceRegex, "");
410+
return getFunctionOrClassName(<ArrowFunction | FunctionExpression | ClassExpression>node);
411411
case SyntaxKind.Constructor:
412412
return "constructor";
413413
case SyntaxKind.ConstructSignature:
@@ -606,11 +606,11 @@ namespace ts.NavigationBar {
606606
// See if it is of the form "<expr> = function(){...}". If so, use the text from the left-hand side.
607607
else if (node.parent.kind === SyntaxKind.BinaryExpression &&
608608
(node.parent as BinaryExpression).operatorToken.kind === SyntaxKind.EqualsToken) {
609-
return nodeText((node.parent as BinaryExpression).left);
609+
return nodeText((node.parent as BinaryExpression).left).replace(whiteSpaceRegex, "");
610610
}
611611
// See if it is a property assignment, and if so use the property name
612612
else if (node.parent.kind === SyntaxKind.PropertyAssignment && (node.parent as PropertyAssignment).name) {
613-
return nodeText((node.parent as PropertyAssignment).name);
613+
return nodeText((node.parent as PropertyAssignment).name).replace(whiteSpaceRegex, "#");
614614
}
615615
// Default exports are named "default"
616616
else if (getModifierFlags(node) & ModifierFlags.Default) {

0 commit comments

Comments
 (0)