Skip to content

Conversation

aozgaa
Copy link
Contributor

@aozgaa aozgaa commented Oct 25, 2016

Fixes an issue where nav bar items in Visual Studio wouldn't remove whitespace (esp. newlines), making the nav bar add rows to accomodate the entries and waste screen real-estate.

@aozgaa aozgaa changed the title remove whitespace remove whitespace in nav bar completions Oct 25, 2016
// We ma 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(<ArrowFunction | FunctionExpression | ClassExpression>node).replace(whiteSpaceRegex, "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this in getFunctionOrClassName instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

*
* does not match.
*/
const whiteSpaceRegex = /(\s|\t|\n|\r)+/g;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to list other options except \s.
per this

\s
Matches a single white space character, including space, tab, form feed, line feed and other Unicode spaces. Equivalent to [ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff].

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

@aozgaa aozgaa merged commit 48f947f into master Oct 25, 2016
@aozgaa aozgaa deleted the arozga/RemoveNavBarWhiteSpace branch October 25, 2016 18:56
//// .a = function() { };
//// })();

function navExact(name: string, kind: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this function for?

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants