Support quick info at function and => locations (#19669)

* Support quick info at `function` and `=>` locations

* Fixes
This commit is contained in:
Andy 2017-11-02 14:47:23 -07:00 committed by GitHub
parent 85285bcae1
commit 01ad4f7dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 15 deletions

View File

@ -23638,6 +23638,8 @@ namespace ts {
return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores((node as StringLiteral | NumericLiteral).text));
case SyntaxKind.DefaultKeyword:
case SyntaxKind.FunctionKeyword:
case SyntaxKind.EqualsGreaterThanToken:
return getSymbolOfNode(node.parent);
default:

View File

@ -489,8 +489,10 @@ namespace ts.SymbolDisplay {
addNewLineIfDisplayPartsExist();
if (symbolKind) {
pushTypePart(symbolKind);
displayParts.push(spacePart());
addFullSymbolName(symbol);
if (!some(symbol.declarations, d => isArrowFunction(d) || (isFunctionExpression(d) || isClassExpression(d)) && !d.name)) {
displayParts.push(spacePart());
addFullSymbolName(symbol);
}
}
}

View File

@ -0,0 +1,7 @@
/// <reference path='fourslash.ts'/>
////[1].forEach(fu/*1*/nction() {});
////[1].map(x =/*2*/> x + 1);
verify.quickInfoAt("1", "(local function)(): void");
verify.quickInfoAt("2", "function(x: number): number");

View File

@ -1,35 +1,35 @@
/// <reference path='fourslash.ts' />
////inter/*invlaid1*/face IFoo {
////inter/*invalid1*/face IFoo {
//// new(): IFoo;
//// [indexer: string]: number;
//// method(value: number): string;
//// property: string;
/////*invlaid2*/}
/////*invalid2*/}
////
////cl/*invlaid3*/ass bar imple/*invlaid4*/ments IFoo {
//// constructor( /*invlaid5*/ ) {
////cl/*invalid3*/ass bar imple/*invalid4*/ments IFoo {
//// constructor( /*invalid5*/ ) {
////
//// }
////
//// pu/*invlaid6*/blic method(value: string): string {
//// retu/*invlaid7*/rn null;
//// pu/*invalid6*/blic method(value: string): string {
//// retu/*invalid7*/rn null;
//// }
////
//// public property: string /*invlaid8*/= "string";
//// public property: string /*invalid8*/= "string";
////
//// public ge/*invlaid9*/t value() {
//// public ge/*invalid9*/t value() {
//// return 0;
//// }
////}
////
////
////mod/*invlaid10*/ule m1 {
//// va/*invlaid11*/r varibale = 0;
////mod/*invalid10*/ule m1 {
//// va/*invalid11*/r varibale = 0;
////
//// func/*invlaid12*/tion foo(arg1: number) {
//// ret/*invlaid13*/urn string;
//// function foo(arg1: number) {
//// ret/*invalid13*/urn string;
//// }
////
//// class foo {
@ -40,7 +40,7 @@
//// value1: "string",
//// value2: {
//// value21: number
//// /*invlaid14*/}
//// /*invalid14*/}
//// };
////}