-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Conversation
/// <reference path='services.ts' /> | ||
|
||
/* @internal */ | ||
namespace ts.NavigationBar { | ||
export function getJsNavigationBarItems(sourceFile: SourceFile, compilerOptions: CompilerOptions): NavigationBarItem[] { |
There was a problem hiding this comment.
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 = |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No
👍 |
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" : |
There was a problem hiding this comment.
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.
All right, you guys win :-p Latest commit should address nearly all the feedback. Thanks! |
Improve NavBar experience for JavaScript files
Port of #7504 (improve NavBar for JS files)
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.