-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Refactor navigation bar #8958
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
Refactor navigation bar #8958
Conversation
11b7291
to
89a5d6d
Compare
89a5d6d
to
0774892
Compare
…claration, just use a single switch statement.
*/ | ||
interface NavNode { | ||
node: Node; | ||
additionalNodes: Node[]; // May be missing |
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.
If the comment is true, I'd remove the comment, and write additionalNodes?: Node[];
instead. (This would likely be caught if we could compile the compiler under strict null checks)
function createNavNode(parent: NavNode, node: Node): NavNode { | ||
const navNode: NavNode = { | ||
node, | ||
additionalNodes: undefined, |
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.
Now that this field is optional, you may just omit it from this initializer, unless there's a perf-related reason not to.
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.
probably will have better perf
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.
Probably will have better perf which way?
@Andy-MS, can we get some perf numbers of how the new code fairs? i would pick a couple of files for ts and js, small (tsc.ts/ some small js file) and large (checker.ts / typescriptServices.js), and get how long it took us to generate nav bar items, possibly through the tsserver request duration, before and after the change. i would also like see the memory consumption comparison. |
Closed in favor of #9220 |
Fixes #8779, #5258, #4191, and #8218.
Gets us closer to #7523 (combines TS and JS code paths for navigation bar).