Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve NavBar experience for JavaScript files #7504

Merged
merged 10 commits into from
Mar 15, 2016
Merged

Improve NavBar experience for JavaScript files #7504

merged 10 commits into from
Mar 15, 2016

Conversation

billti
Copy link
Member

@billti billti commented Mar 14, 2016

See details in #6644 .

Note the test harness is not well suited to NavBar tests currently where the NavBar items are actually hierarchical (which they are with this code), so I'll need to do some additional work here. I've manually tested this quite heavily, and it is JavaScript specific, so won't impact TypeScript NavBar operation.

Getting this out for code review now, as VSCode wants this ASAP to start locking down their next release.

/// <reference path='services.ts' />

/* @internal */
namespace ts.NavigationBar {
export function getJsNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): NavigationBarItem[] {
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this below getNavigationBarItems? Generally we have helper functions cascading below the entry point.

declarationNameToString((node as (Declaration)).name);

const elementKind =
Copy link
Member

Choose a reason for hiding this comment

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

Refactor this into a function with a switch

Copy link
Member Author

Choose a reason for hiding this comment

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

Anders says it fine, so like... whatever :-p

Copy link
Member Author

Choose a reason for hiding this comment

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

No

@RyanCavanaugh
Copy link
Member

👍

case SyntaxKind.SetAccessor:
// "export default function().." looks just like a regular function/class declaration, except with the 'default' flag set
const name = node.flags && (node.flags & NodeFlags.Default) ? "default" :
Copy link
Member

Choose a reason for hiding this comment

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

I think you only want to do this if the function/class declaration doesn't have a name - otherwise, you're more likely to be concerned with its local name.

@billti
Copy link
Member Author

billti commented Mar 14, 2016

All right, you guys win :-p Latest commit should address nearly all the feedback. Thanks!

billti added a commit that referenced this pull request Mar 15, 2016
Improve NavBar experience for JavaScript files
@billti billti merged commit 6a706cf into release-1.8 Mar 15, 2016
billti added a commit that referenced this pull request Mar 15, 2016
Port of #7504 (improve NavBar for JS files)
@billti billti deleted the jsNavBar branch March 15, 2016 18:06
@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.

4 participants