Skip to content

Not show module names#732

Merged
yuit merged 6 commits into
masterfrom
notShowModuleNames
Sep 24, 2014
Merged

Not show module names#732
yuit merged 6 commits into
masterfrom
notShowModuleNames

Conversation

@yuit
Copy link
Copy Markdown
Contributor

@yuit yuit commented Sep 24, 2014

Fixes #633

Comment thread tests/cases/fourslash/fourslash.ts Outdated
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.

already defined..
class verify, has a "not" property that is verifyNegatable.

Comment thread src/services/services.ts
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.

Is this really the only way to ask this question? Is there an easier way to do this, just by asking hte the symbol itself? For example, does the symbol have any sort of flag indicating it is an External Module?

Alternatively, check if any of the declarations of the symbol have an identifier whose kind is SyntaxKind.StringLiteral.

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.

SyntaxKind.StringLiteral would also include string-keyed property names, which you do want to show in completion (see the block directly below this).

In terms of asking for whether something is an external module, there is only a function isExternalModule, which takes a SourceFile, so that will not help you here. You could write a similar utility for ambient external modules (with quoted names). In order for it to work on a Symbol, you'd want to ask if an arbitrary declaration is an external module, based on whether it is a module and its name has quotes. Why is it sufficient to just ask one declaration? Well, external modules can merge, but only with other external modules. So if one declaration is an external module, they are all external modules.

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.

@CyrusNajmabadi There is no external module flag in the symbol. Another way to check would be to check if one of the declaration of the symbol has kind of module and its name has kind of string literal with double-quoted name. @JsonFreeman I like the idea of having utility for ambient external module

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.

Turned out the text of declaration name get stripped off its double-quote so the only way to check is through symbol

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.

Fair enough

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Sep 24, 2014

👍

yuit pushed a commit that referenced this pull request Sep 24, 2014
@yuit yuit merged commit db0a223 into master Sep 24, 2014
@yuit yuit deleted the notShowModuleNames branch September 24, 2014 22:23
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 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.

Don't show quoted module names in completion list

4 participants