Not show module names#732
Conversation
There was a problem hiding this comment.
already defined..
class verify, has a "not" property that is verifyNegatable.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
@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
There was a problem hiding this comment.
Turned out the text of declaration name get stripped off its double-quote so the only way to check is through symbol
|
👍 |
Fixes #633