Skip to content

When adding completions for a module, don't get the type of the module if not necessary. #16768

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

Merged
3 commits merged into from
Jul 13, 2017

Conversation

ghost
Copy link

@ghost ghost commented Jun 27, 2017

Previously we would first add completions for all the exports, then convert the module to a type and add completions for all of its properties -- but those are just the exports.
Also, HasExports includes classes, but we don't need to handle classes in that block (since they are handled by addTypeProperties just fine).

if (isValidAccess(symbol)) {
symbols.push(symbol);
// If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods).
if (!isTypeLocation && symbol.declarations.some(d => d.kind !== SyntaxKind.SourceFile && d.kind !== SyntaxKind.ModuleDeclaration && d.kind !== SyntaxKind.EnumDeclaration)) {
Copy link
Member

Choose a reason for hiding this comment

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

It isn't possible to merge enum with anything else right so adding ! might be useful to not enumerate through the declarations?

Copy link
Author

Choose a reason for hiding this comment

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

It's possible to merge enums and namespaces. But we could handle enums separately, and assert that getExportsOfModule is only called for modules.

Copy link
Member

@sheetalkamat sheetalkamat left a comment

Choose a reason for hiding this comment

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

Leave a comment

@ghost ghost merged commit 69d3ca7 into master Jul 13, 2017
@ghost ghost deleted the moduleCompletions branch July 13, 2017 16:20
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This pull request was closed.
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.

2 participants