added completion for exports in named imports section

This commit is contained in:
Vladimir Matveev
2015-02-24 15:37:13 -08:00
parent 6055dea93e
commit caabb7d99b
3 changed files with 68 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ module ts {
isImplementationOfOverload,
getAliasedSymbol: resolveImport,
getEmitResolver,
getExportsOfExternalModule,
};
var undefinedSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "undefined");
@@ -2754,6 +2755,19 @@ module ts {
return result;
}
function getExportsOfExternalModule(node: ImportDeclaration): Symbol[]{
if (!node.moduleSpecifier) {
return emptyArray;
}
var module = resolveExternalModuleName(node, node.moduleSpecifier);
if (!module || !module.exports) {
return emptyArray;
}
return mapToArray(module.exports)
}
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
var links = getNodeLinks(declaration);
if (!links.resolvedSignature) {

View File

@@ -1100,6 +1100,7 @@ module ts {
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
getAliasedSymbol(symbol: Symbol): Symbol;
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
// Should not be called directly. Should only be accessed through the Program instance.
/* @internal */ getDiagnostics(sourceFile?: SourceFile): Diagnostic[];