@@ -2259,13 +2259,9 @@ module ts {
22592259 return undefined ;
22602260 }
22612261
2262- // TODO(drosen): Right now we just permit *all* semantic meanings when calling 'getSymbolKind'
2263- // which is permissible given that it is backwards compatible; but really we should consider
2264- // passing the meaning for the node so that we don't report that a suggestion for a value is an interface.
2265- // We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration.
22662262 return {
22672263 name : displayName ,
2268- kind : getSymbolKind ( symbol , SemanticMeaning . All ) ,
2264+ kind : getSymbolKind ( symbol ) ,
22692265 kindModifiers : getSymbolModifiers ( symbol )
22702266 } ;
22712267 }
@@ -2617,7 +2613,7 @@ module ts {
26172613 // which is permissible given that it is backwards compatible; but really we should consider
26182614 // passing the meaning for the node so that we don't report that a suggestion for a value is an interface.
26192615 // We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration.
2620- var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol , getSourceFile ( filename ) , session . location , session . typeChecker , session . location , SemanticMeaning . All ) ;
2616+ var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol , getSourceFile ( filename ) , session . location , session . typeChecker , session . location ) ;
26212617 return {
26222618 name : entryName ,
26232619 kind : displayPartsDocumentationsAndSymbolKind . symbolKind ,
@@ -2660,19 +2656,15 @@ module ts {
26602656 }
26612657 }
26622658
2663- function getSymbolKind ( symbol : Symbol , meaningAtLocation : SemanticMeaning ) : string {
2659+ // TODO(drosen): use contextual SemanticMeaning.
2660+ function getSymbolKind ( symbol : Symbol ) : string {
26642661 var flags = typeInfoResolver . getRootSymbol ( symbol ) . getFlags ( ) ;
26652662
26662663 if ( flags & SymbolFlags . Class ) return ScriptElementKind . classElement ;
26672664 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-
2665+ if ( flags & SymbolFlags . Interface ) return ScriptElementKind . interfaceElement ;
2666+ if ( flags & SymbolFlags . TypeParameter ) return ScriptElementKind . typeParameterElement ;
2667+
26762668 var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( symbol , flags ) ;
26772669 if ( result === ScriptElementKind . unknown ) {
26782670 if ( flags & SymbolFlags . TypeParameter ) return ScriptElementKind . typeParameterElement ;
@@ -2745,10 +2737,12 @@ module ts {
27452737 : ScriptElementKindModifier . none ;
27462738 }
27472739
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 ) ) {
2740+ // TODO(drosen): use contextual SemanticMeaning.
2741+ function getSymbolDisplayPartsDocumentationAndSymbolKind ( symbol : Symbol ,
2742+ sourceFile : SourceFile ,
2743+ enclosingDeclaration : Node ,
2744+ typeResolver : TypeChecker ,
2745+ location : Node ) {
27522746 var displayParts : SymbolDisplayPart [ ] = [ ] ;
27532747 var documentation : SymbolDisplayPart [ ] ;
27542748 var symbolFlags = typeResolver . getRootSymbol ( symbol ) . flags ;
@@ -2853,13 +2847,14 @@ module ts {
28532847 }
28542848 }
28552849 }
2850+
28562851 if ( symbolFlags & SymbolFlags . Class && ! hasAddedSymbolInfo ) {
28572852 displayParts . push ( keywordPart ( SyntaxKind . ClassKeyword ) ) ;
28582853 displayParts . push ( spacePart ( ) ) ;
28592854 displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile , /*meaning*/ undefined , SymbolFormatFlags . WriteTypeParametersOrArguments ) ) ;
28602855 writeTypeParametersOfSymbol ( symbol , sourceFile ) ;
28612856 }
2862- if ( ( symbolFlags & SymbolFlags . Interface ) && ( semanticMeaning & SemanticMeaning . Type ) ) {
2857+ if ( symbolFlags & SymbolFlags . Interface ) {
28632858 addNewLineIfDisplayPartsExist ( ) ;
28642859 displayParts . push ( keywordPart ( SyntaxKind . InterfaceKeyword ) ) ;
28652860 displayParts . push ( spacePart ( ) ) ;
@@ -2878,7 +2873,7 @@ module ts {
28782873 displayParts . push ( spacePart ( ) ) ;
28792874 displayParts . push . apply ( displayParts , symbolToDisplayParts ( typeResolver , symbol , sourceFile ) ) ;
28802875 }
2881- if ( ( symbolFlags & SymbolFlags . TypeParameter ) && ( semanticMeaning & SemanticMeaning . Type ) ) {
2876+ if ( symbolFlags & SymbolFlags . TypeParameter ) {
28822877 addNewLineIfDisplayPartsExist ( ) ;
28832878 displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
28842879 displayParts . push ( textPart ( "type parameter" ) ) ;
@@ -2958,7 +2953,7 @@ module ts {
29582953 }
29592954 }
29602955 else {
2961- symbolKind = getSymbolKind ( symbol , semanticMeaning ) ;
2956+ symbolKind = getSymbolKind ( symbol ) ;
29622957 }
29632958 }
29642959
@@ -3159,7 +3154,7 @@ module ts {
31593154
31603155 var declarations = symbol . getDeclarations ( ) ;
31613156 var symbolName = typeInfoResolver . symbolToString ( symbol ) ; // Do not get scoped name, just the name of the symbol
3162- var symbolKind = getSymbolKind ( symbol , getMeaningFromLocation ( node ) ) ;
3157+ var symbolKind = getSymbolKind ( symbol ) ;
31633158 var containerSymbol = symbol . parent ;
31643159 var containerName = containerSymbol ? typeInfoResolver . symbolToString ( containerSymbol , node ) : "" ;
31653160
@@ -4661,19 +4656,18 @@ module ts {
46614656 function classifySymbol ( symbol : Symbol , meaningAtPosition : SemanticMeaning ) {
46624657 var flags = symbol . getFlags ( ) ;
46634658
4659+ // TODO(drosen): use meaningAtPosition.
46644660 if ( flags & SymbolFlags . Class ) {
46654661 return ClassificationTypeNames . className ;
46664662 }
46674663 else if ( flags & SymbolFlags . Enum ) {
46684664 return ClassificationTypeNames . enumName ;
46694665 }
4670- else if ( meaningAtPosition & SemanticMeaning . Type ) {
4671- if ( flags & SymbolFlags . Interface ) {
4672- return ClassificationTypeNames . interfaceName ;
4673- }
4674- else if ( flags & SymbolFlags . TypeParameter ) {
4675- return ClassificationTypeNames . typeParameterName ;
4676- }
4666+ else if ( flags & SymbolFlags . Interface ) {
4667+ return ClassificationTypeNames . interfaceName ;
4668+ }
4669+ else if ( flags & SymbolFlags . TypeParameter ) {
4670+ return ClassificationTypeNames . typeParameterName ;
46774671 }
46784672 else if ( flags & SymbolFlags . Module ) {
46794673 return ClassificationTypeNames . moduleName ;
@@ -5147,7 +5141,7 @@ module ts {
51475141
51485142 // Only allow a symbol to be renamed if it actually has at least one declaration.
51495143 if ( symbol && symbol . getDeclarations ( ) && symbol . getDeclarations ( ) . length > 0 ) {
5150- var kind = getSymbolKind ( symbol , getMeaningFromLocation ( node ) ) ;
5144+ var kind = getSymbolKind ( symbol ) ;
51515145 if ( kind ) {
51525146 return getRenameInfo ( symbol . name , typeInfoResolver . getFullyQualifiedName ( symbol ) , kind ,
51535147 getSymbolModifiers ( symbol ) ,
0 commit comments