Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Adds support for showing default exports in the navtree#35477

Merged
orta merged 5 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
orta:fix_34601orta/TypeScript:fix_34601Copy head branch name to clipboard
Jan 22, 2020
Merged

Adds support for showing default exports in the navtree#35477
orta merged 5 commits into
microsoft:mastermicrosoft/TypeScript:masterfrom
orta:fix_34601orta/TypeScript:fix_34601Copy head branch name to clipboard

Conversation

@orta

@orta orta commented Dec 3, 2019

Copy link
Copy Markdown
Contributor

Fixes #34601

@mjbvz - I'm not 100% sure on what you want in the output, so I took my closest guess with the existing constants that passed back and forth

@orta orta requested a review from mjbvz December 3, 2019 20:24

@mjbvz mjbvz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Using "default" looks reasonable to me

@orta orta requested a review from sheetalkamat December 5, 2019 22:16
@orta orta self-assigned this Dec 5, 2019
Comment thread src/services/navigationBar.ts
@orta

orta commented Jan 21, 2020

Copy link
Copy Markdown
Contributor Author

This is good for review again, I've made the changes on the text we show 👍

Comment thread src/services/utilities.ts
}
case SyntaxKind.Identifier:
return isImportClause(node.parent) ? ScriptElementKind.alias : ScriptElementKind.unknown;
case SyntaxKind.ExportAssignment:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this needs to handled similar to AssignmentDeclarationKind.ModuleExports so that export default function foo() shows the kind as function and not as const

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, makes sense - I've used isFunctionLikeKind to determine that and you can see some examples in the tests 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need to also handle ClassExpression?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Instead of handling each case, I've switched to recurse in the node.expression

case SyntaxKind.ExportAssignment:
    const scriptKind = getNodeKind((node as ExportAssignment).expression);
    // If the expression didn't come back with something (like it does for an identifiers)
    return scriptKind === ScriptElementKind.unknown ? ScriptElementKind.constElement : scriptKind;

I'm open to this going a bit further and digging into the identifier and finding out out var/let/const, but I don't know how to pull out the declaration of a random identifier to check.

Comment thread src/services/navigationBar.ts Outdated
@orta orta merged commit 5e59eec into microsoft:master Jan 22, 2020
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
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.

navtree does not include entry for export default of an expression

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.