@@ -418,7 +418,10 @@ module ts {
418418
419419 function pushDocCommentLineText ( docComments : SymbolDisplayPart [ ] , text : string , blankLineCount : number ) {
420420 // Add the empty lines in between texts
421- while ( blankLineCount -- ) docComments . push ( textPart ( "" ) ) ;
421+ while ( blankLineCount -- ) {
422+ docComments . push ( textPart ( "" ) ) ;
423+ }
424+
422425 docComments . push ( textPart ( text ) ) ;
423426 }
424427
@@ -3069,12 +3072,14 @@ module ts {
30693072 typeResolver : TypeChecker , location : Node ,
30703073 // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location
30713074 semanticMeaning = getMeaningFromLocation ( location ) ) {
3075+
30723076 let displayParts : SymbolDisplayPart [ ] = [ ] ;
30733077 let documentation : SymbolDisplayPart [ ] ;
30743078 let symbolFlags = symbol . flags ;
30753079 let symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( symbol , symbolFlags , typeResolver , location ) ;
30763080 let hasAddedSymbolInfo : boolean ;
30773081 let type : Type ;
3082+
30783083 // Class at constructor site need to be shown as constructor apart from property,method, vars
30793084 if ( symbolKind !== ScriptElementKind . unknown || symbolFlags & SymbolFlags . Class || symbolFlags & SymbolFlags . Alias ) {
30803085 // If it is accessor they are allowed only if location is at name of the accessor
@@ -3126,9 +3131,7 @@ module ts {
31263131 }
31273132 else if ( symbolFlags & SymbolFlags . Alias ) {
31283133 symbolKind = ScriptElementKind . alias ;
3129- displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
3130- displayParts . push ( textPart ( symbolKind ) ) ;
3131- displayParts . push ( punctuationPart ( SyntaxKind . CloseParenToken ) ) ;
3134+ pushTypePart ( symbolKind ) ;
31323135 displayParts . push ( spacePart ( ) ) ;
31333136 if ( useConstructSignatures ) {
31343137 displayParts . push ( keywordPart ( SyntaxKind . NewKeyword ) ) ;
@@ -3364,14 +3367,27 @@ module ts {
33643367 function addPrefixForAnyFunctionOrVar ( symbol : Symbol , symbolKind : string ) {
33653368 addNewLineIfDisplayPartsExist ( ) ;
33663369 if ( symbolKind ) {
3367- displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
3368- displayParts . push ( textPart ( symbolKind ) ) ;
3369- displayParts . push ( punctuationPart ( SyntaxKind . CloseParenToken ) ) ;
3370+ pushTypePart ( symbolKind ) ;
33703371 displayParts . push ( spacePart ( ) ) ;
33713372 addFullSymbolName ( symbol ) ;
33723373 }
33733374 }
33743375
3376+ function pushTypePart ( symbolKind : string ) {
3377+ if ( symbolKind === ScriptElementKind . variableElement ||
3378+ symbolKind === ScriptElementKind . functionElement ||
3379+ symbolKind === ScriptElementKind . letElement ||
3380+ symbolKind === ScriptElementKind . constElement ||
3381+ symbolKind === ScriptElementKind . constructorImplementationElement ) {
3382+ displayParts . push ( textOrKeywordPart ( symbolKind ) ) ;
3383+ }
3384+ else {
3385+ displayParts . push ( punctuationPart ( SyntaxKind . OpenParenToken ) ) ;
3386+ displayParts . push ( textOrKeywordPart ( symbolKind ) ) ;
3387+ displayParts . push ( punctuationPart ( SyntaxKind . CloseParenToken ) ) ;
3388+ }
3389+ }
3390+
33753391 function addSignatureDisplayParts ( signature : Signature , allSignatures : Signature [ ] , flags ?: TypeFormatFlags ) {
33763392 displayParts . push . apply ( displayParts , signatureToDisplayParts ( typeResolver , signature , enclosingDeclaration , flags | TypeFormatFlags . WriteTypeArgumentsOfSignature ) ) ;
33773393 if ( allSignatures . length > 1 ) {
0 commit comments