@@ -2749,15 +2749,11 @@ module ts {
27492749 var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( symbol , symbolFlags ) ;
27502750 var hasAddedSymbolInfo : boolean ;
27512751 // Class at constructor site need to be shown as constructor apart from property,method, vars
2752- if ( symbolKind !== ScriptElementKind . unknown || symbolFlags & SymbolFlags . Signature || symbolFlags & SymbolFlags . Class ) {
2752+ if ( symbolKind !== ScriptElementKind . unknown || symbolFlags & SymbolFlags . Class || symbolFlags & SymbolFlags . Import ) {
27532753 // If it is accessor they are allowed only if location is at name of the accessor
27542754 if ( symbolKind === ScriptElementKind . memberGetAccessorElement || symbolKind === ScriptElementKind . memberSetAccessorElement ) {
27552755 symbolKind = ScriptElementKind . memberVariableElement ;
27562756 }
2757- else if ( symbol . name === "undefined" ) {
2758- // undefined is symbol and not property
2759- symbolKind = ScriptElementKind . variableElement ;
2760- }
27612757
27622758 var type = typeResolver . getTypeOfSymbol ( symbol ) ;
27632759 if ( type ) {
@@ -2790,6 +2786,18 @@ module ts {
27902786 symbolKind = ScriptElementKind . constructorImplementationElement ;
27912787 addPrefixForAnyFunctionOrVar ( type . symbol , symbolKind ) ;
27922788 }
2789+ else if ( symbolFlags & SymbolFlags . Import ) {
2790+ symbolKind = ScriptElementKind . alias ;
2791+ displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
2792+ displayParts . push ( textPart ( symbolKind ) ) ;
2793+ displayParts . push ( punctuationPart ( SyntaxKind . CloseParenToken ) ) ;
2794+ displayParts . push ( spacePart ( ) ) ;
2795+ if ( useConstructSignatures ) {
2796+ displayParts . push ( keywordPart ( SyntaxKind . NewKeyword ) ) ;
2797+ displayParts . push ( spacePart ( ) ) ;
2798+ }
2799+ addFullSymbolName ( symbol ) ;
2800+ }
27932801 else {
27942802 addPrefixForAnyFunctionOrVar ( symbol , symbolKind ) ;
27952803 }
@@ -2851,41 +2859,41 @@ module ts {
28512859 if ( symbolFlags & SymbolFlags . Class && ! hasAddedSymbolInfo ) {
28522860 displayParts . push ( keywordPart ( SyntaxKind . ClassKeyword ) ) ;
28532861 displayParts . push ( spacePart ( ) ) ;
2854- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile , /*meaning*/ undefined , SymbolFormatFlags . WriteTypeParametersOrArguments ) ) ;
2862+ addFullSymbolName ( symbol ) ;
28552863 writeTypeParametersOfSymbol ( symbol , sourceFile ) ;
28562864 }
28572865 if ( symbolFlags & SymbolFlags . Interface ) {
28582866 addNewLineIfDisplayPartsExist ( ) ;
28592867 displayParts . push ( keywordPart ( SyntaxKind . InterfaceKeyword ) ) ;
28602868 displayParts . push ( spacePart ( ) ) ;
2861- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile , /*meaning*/ undefined , SymbolFormatFlags . WriteTypeParametersOrArguments ) ) ;
2869+ addFullSymbolName ( symbol ) ;
28622870 writeTypeParametersOfSymbol ( symbol , sourceFile ) ;
28632871 }
28642872 if ( symbolFlags & SymbolFlags . Enum ) {
28652873 addNewLineIfDisplayPartsExist ( ) ;
28662874 displayParts . push ( keywordPart ( SyntaxKind . EnumKeyword ) ) ;
28672875 displayParts . push ( spacePart ( ) ) ;
2868- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile ) ) ;
2876+ addFullSymbolName ( symbol ) ;
28692877 }
28702878 if ( symbolFlags & SymbolFlags . Module ) {
28712879 addNewLineIfDisplayPartsExist ( ) ;
28722880 displayParts . push ( keywordPart ( SyntaxKind . ModuleKeyword ) ) ;
28732881 displayParts . push ( spacePart ( ) ) ;
2874- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile ) ) ;
2882+ addFullSymbolName ( symbol ) ;
28752883 }
28762884 if ( symbolFlags & SymbolFlags . TypeParameter ) {
28772885 addNewLineIfDisplayPartsExist ( ) ;
28782886 displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
28792887 displayParts . push ( textPart ( "type parameter" ) ) ;
28802888 displayParts . push ( punctuationPart ( SyntaxKind . CloseParenToken ) ) ;
28812889 displayParts . push ( spacePart ( ) ) ;
2882- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , enclosingDeclaration ) ) ;
2890+ addFullSymbolName ( symbol ) ;
28832891 displayParts . push ( spacePart ( ) ) ;
28842892 displayParts . push ( keywordPart ( SyntaxKind . InKeyword ) ) ;
28852893 displayParts . push ( spacePart ( ) ) ;
28862894 if ( symbol . parent ) {
28872895 // Class/Interface type parameter
2888- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol . parent , enclosingDeclaration , /*meaning*/ undefined , SymbolFormatFlags . WriteTypeParametersOrArguments ) )
2896+ addFullSymbolName ( symbol . parent , enclosingDeclaration ) ;
28892897 writeTypeParametersOfSymbol ( symbol . parent , enclosingDeclaration ) ;
28902898 }
28912899 else {
@@ -2897,7 +2905,7 @@ module ts {
28972905 displayParts . push ( spacePart ( ) ) ;
28982906 }
28992907 else if ( signatureDeclaration . kind !== SyntaxKind . CallSignature && signatureDeclaration . name ) {
2900- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , signatureDeclaration . symbol , sourceFile , /*meaning*/ undefined , SymbolFormatFlags . WriteTypeParametersOrArguments ) )
2908+ addFullSymbolName ( signatureDeclaration . symbol ) ;
29012909 }
29022910 displayParts . push . apply ( displayParts , signatureToDisplayParts ( typeResolver , signature , sourceFile , TypeFormatFlags . WriteTypeArgumentsOfSignature ) ) ;
29032911 }
@@ -2917,11 +2925,28 @@ module ts {
29172925 }
29182926 if ( symbolFlags & SymbolFlags . Import ) {
29192927 addNewLineIfDisplayPartsExist ( ) ;
2920- displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
2921- displayParts . push ( textPart ( "alias" ) ) ;
2922- displayParts . push ( punctuationPart ( SyntaxKind . CloseParenToken ) ) ;
2928+ displayParts . push ( keywordPart ( SyntaxKind . ImportKeyword ) ) ;
2929+ displayParts . push ( spacePart ( ) ) ;
2930+ addFullSymbolName ( symbol ) ;
2931+ displayParts . push ( spacePart ( ) ) ;
2932+ displayParts . push ( punctuationPart ( SyntaxKind . EqualsToken ) ) ;
29232933 displayParts . push ( spacePart ( ) ) ;
2924- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile ) ) ;
2934+ ts . forEach ( symbol . declarations , declaration => {
2935+ if ( declaration . kind === SyntaxKind . ImportDeclaration ) {
2936+ var importDeclaration = < ImportDeclaration > declaration ;
2937+ if ( importDeclaration . externalModuleName ) {
2938+ displayParts . push ( keywordPart ( SyntaxKind . RequireKeyword ) ) ;
2939+ displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
2940+ displayParts . push ( displayPart ( getTextOfNode ( importDeclaration . externalModuleName ) , SymbolDisplayPartKind . stringLiteral ) ) ;
2941+ displayParts . push ( punctuationPart ( SyntaxKind . CloseParenToken ) ) ;
2942+ }
2943+ else {
2944+ var internalAliasSymbol = typeResolver . getSymbolInfo ( importDeclaration . entityName ) ;
2945+ addFullSymbolName ( internalAliasSymbol , enclosingDeclaration ) ;
2946+ }
2947+ return true ;
2948+ }
2949+ } ) ;
29252950 }
29262951 if ( ! hasAddedSymbolInfo ) {
29272952 if ( symbolKind !== ScriptElementKind . unknown ) {
@@ -2969,15 +2994,20 @@ module ts {
29692994 }
29702995 }
29712996
2997+ function addFullSymbolName ( symbol : Symbol , enclosingDeclaration ?: Node ) {
2998+ var fullSymbolDisplayParts = symbolToDisplayParts ( typeResolver , symbol , enclosingDeclaration || sourceFile , /*meaning*/ undefined ,
2999+ SymbolFormatFlags . WriteTypeParametersOrArguments | SymbolFormatFlags . UseOnlyExternalAliasing ) ;
3000+ displayParts . push . apply ( displayParts , fullSymbolDisplayParts ) ;
3001+ }
3002+
29723003 function addPrefixForAnyFunctionOrVar ( symbol : Symbol , symbolKind : string ) {
29733004 addNewLineIfDisplayPartsExist ( ) ;
29743005 if ( symbolKind ) {
29753006 displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
29763007 displayParts . push ( textPart ( symbolKind ) ) ;
29773008 displayParts . push ( punctuationPart ( SyntaxKind . CloseParenToken ) ) ;
29783009 displayParts . push ( spacePart ( ) ) ;
2979- // Write type parameters of class/Interface if it is property/method of the generic class/interface
2980- displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile , /*meaning*/ undefined , SymbolFormatFlags . WriteTypeParametersOrArguments ) ) ;
3010+ addFullSymbolName ( symbol ) ;
29813011 }
29823012 }
29833013
@@ -3023,7 +3053,7 @@ module ts {
30233053 case SyntaxKind . QualifiedName :
30243054 case SyntaxKind . ThisKeyword :
30253055 case SyntaxKind . SuperKeyword :
3026- // For the identifiers/this/usper etc get the type at position
3056+ // For the identifiers/this/super etc get the type at position
30273057 var type = typeInfoResolver . getTypeOfNode ( node ) ;
30283058 if ( type ) {
30293059 return {
0 commit comments