@@ -2557,13 +2557,13 @@ module ts {
2557
2557
var type = session . typeChecker . getTypeOfSymbol ( symbol ) ;
2558
2558
Debug . assert ( type , "Could not find type for symbol" ) ;
2559
2559
var completionEntry = createCompletionEntry ( symbol ) ;
2560
- var displayPartsAndDocumentations = getSymbolDisplayPartsAndDocumentationOfSymbol ( symbol , getSourceFile ( filename ) , session . location , session . typeChecker , session . location ) ;
2560
+ var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol , getSourceFile ( filename ) , session . location , session . typeChecker , session . location ) ;
2561
2561
return {
2562
2562
name : entryName ,
2563
- kind : completionEntry . kind ,
2563
+ kind : displayPartsDocumentationsAndSymbolKind . symbolKind ,
2564
2564
kindModifiers : completionEntry . kindModifiers ,
2565
- displayParts : displayPartsAndDocumentations . displayParts ,
2566
- documentation : displayPartsAndDocumentations . documentation
2565
+ displayParts : displayPartsDocumentationsAndSymbolKind . displayParts ,
2566
+ documentation : displayPartsDocumentationsAndSymbolKind . documentation
2567
2567
} ;
2568
2568
}
2569
2569
else {
@@ -2692,7 +2692,7 @@ module ts {
2692
2692
return result . length > 0 ? result . join ( ',' ) : ScriptElementKindModifier . none ;
2693
2693
}
2694
2694
2695
- function getSymbolDisplayPartsAndDocumentationOfSymbol ( symbol : Symbol , sourceFile : SourceFile , enclosingDeclaration : Node , typeResolver : TypeChecker , location : Node ) {
2695
+ function getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol : Symbol , sourceFile : SourceFile , enclosingDeclaration : Node , typeResolver : TypeChecker , location : Node ) {
2696
2696
var displayParts : SymbolDisplayPart [ ] = [ ] ;
2697
2697
var documentation : SymbolDisplayPart [ ] ;
2698
2698
var symbolFlags = typeResolver . getRootSymbol ( symbol ) . flags ;
@@ -2863,40 +2863,45 @@ module ts {
2863
2863
displayParts . push ( spacePart ( ) ) ;
2864
2864
displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile ) ) ;
2865
2865
}
2866
- else if ( ! hasAddedSymbolInfo && symbolKind !== ScriptElementKind . unknown ) {
2867
- if ( type ) {
2868
- addPrefixForAnyFunctionOrVar ( symbol , symbolKind ) ;
2869
- if ( symbolKind === ScriptElementKind . memberVariableElement ||
2870
- symbolFlags & SymbolFlags . Variable ) {
2871
- displayParts . push ( punctuationPart ( SyntaxKind . ColonToken ) ) ;
2872
- displayParts . push ( spacePart ( ) ) ;
2873
- // If the type is type parameter, format it specially
2874
- if ( type . symbol && type . symbol . flags & SymbolFlags . TypeParameter ) {
2875
- var typeParameterParts = mapToDisplayParts ( writer => {
2876
- typeResolver . writeTypeParameter ( < TypeParameter > type , writer , enclosingDeclaration , TypeFormatFlags . NoTruncation ) ;
2877
- } ) ;
2878
- displayParts . push . apply ( displayParts , typeParameterParts ) ;
2866
+ if ( ! hasAddedSymbolInfo ) {
2867
+ if ( symbolKind !== ScriptElementKind . unknown ) {
2868
+ if ( type ) {
2869
+ addPrefixForAnyFunctionOrVar ( symbol , symbolKind ) ;
2870
+ if ( symbolKind === ScriptElementKind . memberVariableElement ||
2871
+ symbolFlags & SymbolFlags . Variable ) {
2872
+ displayParts . push ( punctuationPart ( SyntaxKind . ColonToken ) ) ;
2873
+ displayParts . push ( spacePart ( ) ) ;
2874
+ // If the type is type parameter, format it specially
2875
+ if ( type . symbol && type . symbol . flags & SymbolFlags . TypeParameter ) {
2876
+ var typeParameterParts = mapToDisplayParts ( writer => {
2877
+ typeResolver . writeTypeParameter ( < TypeParameter > type , writer , enclosingDeclaration , TypeFormatFlags . NoTruncation ) ;
2878
+ } ) ;
2879
+ displayParts . push . apply ( displayParts , typeParameterParts ) ;
2880
+ }
2881
+ else {
2882
+ displayParts . push . apply ( displayParts , typeToDisplayParts ( typeResolver , type , enclosingDeclaration , TypeFormatFlags . NoTruncation ) ) ;
2883
+ }
2879
2884
}
2880
- else {
2881
- displayParts . push . apply ( displayParts , typeToDisplayParts ( typeResolver , type , enclosingDeclaration , TypeFormatFlags . NoTruncation ) ) ;
2885
+ else if ( symbolFlags & SymbolFlags . Function ||
2886
+ symbolFlags & SymbolFlags . Method ||
2887
+ symbolFlags & SymbolFlags . Constructor ||
2888
+ symbolFlags & SymbolFlags . Signature ||
2889
+ symbolFlags & SymbolFlags . Accessor ) {
2890
+ var allSignatures = type . getCallSignatures ( ) ;
2891
+ addSignatureDisplayParts ( allSignatures [ 0 ] , allSignatures ) ;
2882
2892
}
2883
2893
}
2884
- else if ( symbolFlags & SymbolFlags . Function ||
2885
- symbolFlags & SymbolFlags . Method ||
2886
- symbolFlags & SymbolFlags . Constructor ||
2887
- symbolFlags & SymbolFlags . Signature ||
2888
- symbolFlags & SymbolFlags . Accessor ) {
2889
- var allSignatures = type . getCallSignatures ( ) ;
2890
- addSignatureDisplayParts ( allSignatures [ 0 ] , allSignatures ) ;
2891
- }
2894
+ }
2895
+ else {
2896
+ symbolKind = getSymbolKind ( symbol ) ;
2892
2897
}
2893
2898
}
2894
2899
2895
2900
if ( ! documentation ) {
2896
2901
documentation = symbol . getDocumentationComment ( ) ;
2897
2902
}
2898
2903
2899
- return { displayParts : displayParts , documentation : documentation } ;
2904
+ return { displayParts : displayParts , documentation : documentation , symbolKind : symbolKind } ;
2900
2905
2901
2906
function addNewLineIfDisplayPartsExist ( ) {
2902
2907
if ( displayParts . length ) {
@@ -2980,13 +2985,13 @@ module ts {
2980
2985
return undefined ;
2981
2986
}
2982
2987
2983
- var displayPartsAndDocumentations = getSymbolDisplayPartsAndDocumentationOfSymbol ( symbol , sourceFile , getContainerNode ( node ) , typeInfoResolver , node ) ;
2988
+ var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol , sourceFile , getContainerNode ( node ) , typeInfoResolver , node ) ;
2984
2989
return {
2985
2990
kind : getSymbolKind ( symbol ) ,
2986
- kindModifiers : getSymbolModifiers ( symbol ) ,
2991
+ kindModifiers : displayPartsDocumentationsAndKind . symbolKind ,
2987
2992
textSpan : new TypeScript . TextSpan ( node . getStart ( ) , node . getWidth ( ) ) ,
2988
- displayParts : displayPartsAndDocumentations . displayParts ,
2989
- documentation : displayPartsAndDocumentations . documentation
2993
+ displayParts : displayPartsDocumentationsAndKind . displayParts ,
2994
+ documentation : displayPartsDocumentationsAndKind . documentation
2990
2995
} ;
2991
2996
}
2992
2997
0 commit comments