@@ -2663,16 +2663,12 @@ module ts {
2663
2663
function getSymbolKind ( symbol : Symbol , meaningAtLocation : SemanticMeaning ) : string {
2664
2664
var flags = typeInfoResolver . getRootSymbol ( symbol ) . getFlags ( ) ;
2665
2665
2666
+ // TODO(drosen): use meaningAtLocation.
2666
2667
if ( flags & SymbolFlags . Class ) return ScriptElementKind . classElement ;
2667
2668
if ( flags & SymbolFlags . Enum ) return ScriptElementKind . enumElement ;
2668
-
2669
- // The following should only apply if encountered at a type position,
2670
- // and need to have precedence over other meanings if this is the case.
2671
- if ( meaningAtLocation & SemanticMeaning . Type ) {
2672
- if ( flags & SymbolFlags . Interface ) return ScriptElementKind . interfaceElement ;
2673
- if ( flags & SymbolFlags . TypeParameter ) return ScriptElementKind . typeParameterElement ;
2674
- }
2675
-
2669
+ if ( flags & SymbolFlags . Interface ) return ScriptElementKind . interfaceElement ;
2670
+ if ( flags & SymbolFlags . TypeParameter ) return ScriptElementKind . typeParameterElement ;
2671
+
2676
2672
var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( symbol , flags ) ;
2677
2673
if ( result === ScriptElementKind . unknown ) {
2678
2674
if ( flags & SymbolFlags . TypeParameter ) return ScriptElementKind . typeParameterElement ;
@@ -2745,10 +2741,13 @@ module ts {
2745
2741
: ScriptElementKindModifier . none ;
2746
2742
}
2747
2743
2748
- function getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol : Symbol , sourceFile : SourceFile , enclosingDeclaration : Node ,
2749
- typeResolver : TypeChecker , location : Node ,
2750
- // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location
2751
- semanticMeaning = getMeaningFromLocation ( location ) ) {
2744
+ // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location
2745
+ function getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol : Symbol ,
2746
+ sourceFile : SourceFile ,
2747
+ enclosingDeclaration : Node ,
2748
+ typeResolver : TypeChecker ,
2749
+ location : Node ,
2750
+ semanticMeaning : SemanticMeaning ) {
2752
2751
var displayParts : SymbolDisplayPart [ ] = [ ] ;
2753
2752
var documentation : SymbolDisplayPart [ ] ;
2754
2753
var symbolFlags = typeResolver . getRootSymbol ( symbol ) . flags ;
@@ -2853,13 +2852,15 @@ module ts {
2853
2852
}
2854
2853
}
2855
2854
}
2855
+
2856
+ // TODO(drosen): use semanticMeaning.
2856
2857
if ( symbolFlags & SymbolFlags . Class && ! hasAddedSymbolInfo ) {
2857
2858
displayParts . push ( keywordPart ( SyntaxKind . ClassKeyword ) ) ;
2858
2859
displayParts . push ( spacePart ( ) ) ;
2859
2860
displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile , /*meaning*/ undefined , SymbolFormatFlags . WriteTypeParametersOrArguments ) ) ;
2860
2861
writeTypeParametersOfSymbol ( symbol , sourceFile ) ;
2861
2862
}
2862
- if ( ( symbolFlags & SymbolFlags . Interface ) && ( semanticMeaning & SemanticMeaning . Type ) ) {
2863
+ if ( symbolFlags & SymbolFlags . Interface ) {
2863
2864
addNewLineIfDisplayPartsExist ( ) ;
2864
2865
displayParts . push ( keywordPart ( SyntaxKind . InterfaceKeyword ) ) ;
2865
2866
displayParts . push ( spacePart ( ) ) ;
@@ -2878,7 +2879,7 @@ module ts {
2878
2879
displayParts . push ( spacePart ( ) ) ;
2879
2880
displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile ) ) ;
2880
2881
}
2881
- if ( ( symbolFlags & SymbolFlags . TypeParameter ) && ( semanticMeaning & SemanticMeaning . Type ) ) {
2882
+ if ( symbolFlags & SymbolFlags . TypeParameter ) {
2882
2883
addNewLineIfDisplayPartsExist ( ) ;
2883
2884
displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
2884
2885
displayParts . push ( textPart ( "type parameter" ) ) ;
@@ -3049,7 +3050,8 @@ module ts {
3049
3050
return undefined ;
3050
3051
}
3051
3052
3052
- var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol , sourceFile , getContainerNode ( node ) , typeInfoResolver , node ) ;
3053
+ // TODO(drosen): Properly address 'semanticMeaning' parameter here
3054
+ var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol , sourceFile , getContainerNode ( node ) , typeInfoResolver , node , SemanticMeaning . All ) ;
3053
3055
return {
3054
3056
kind : displayPartsDocumentationsAndKind . symbolKind ,
3055
3057
kindModifiers : getSymbolModifiers ( symbol ) ,
@@ -4666,19 +4668,18 @@ module ts {
4666
4668
function classifySymbol ( symbol : Symbol , meaningAtPosition : SemanticMeaning ) {
4667
4669
var flags = symbol . getFlags ( ) ;
4668
4670
4671
+ // TODO(drosen): use meaningAtPosition.
4669
4672
if ( flags & SymbolFlags . Class ) {
4670
4673
return ClassificationTypeNames . className ;
4671
4674
}
4672
4675
else if ( flags & SymbolFlags . Enum ) {
4673
4676
return ClassificationTypeNames . enumName ;
4674
4677
}
4675
- else if ( meaningAtPosition & SemanticMeaning . Type ) {
4676
- if ( flags & SymbolFlags . Interface ) {
4677
- return ClassificationTypeNames . interfaceName ;
4678
- }
4679
- else if ( flags & SymbolFlags . TypeParameter ) {
4680
- return ClassificationTypeNames . typeParameterName ;
4681
- }
4678
+ else if ( flags & SymbolFlags . Interface ) {
4679
+ return ClassificationTypeNames . interfaceName ;
4680
+ }
4681
+ else if ( flags & SymbolFlags . TypeParameter ) {
4682
+ return ClassificationTypeNames . typeParameterName ;
4682
4683
}
4683
4684
else if ( flags & SymbolFlags . Module ) {
4684
4685
return ClassificationTypeNames . moduleName ;
0 commit comments