quickInfo: Display info for signature on a separate line from variable info (#18698)
This commit is contained in:
parent
ef6f9351b5
commit
1a0ec81488
6 changed files with 66 additions and 41 deletions
|
@ -191,13 +191,14 @@ namespace ts.SymbolDisplay {
|
||||||
// If it is call or construct signature of lambda's write type name
|
// If it is call or construct signature of lambda's write type name
|
||||||
displayParts.push(punctuationPart(SyntaxKind.ColonToken));
|
displayParts.push(punctuationPart(SyntaxKind.ColonToken));
|
||||||
displayParts.push(spacePart());
|
displayParts.push(spacePart());
|
||||||
|
if (!(type.flags & TypeFlags.Object && (<ObjectType>type).objectFlags & ObjectFlags.Anonymous) && type.symbol) {
|
||||||
|
addRange(displayParts, symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments));
|
||||||
|
displayParts.push(lineBreakPart());
|
||||||
|
}
|
||||||
if (useConstructSignatures) {
|
if (useConstructSignatures) {
|
||||||
displayParts.push(keywordPart(SyntaxKind.NewKeyword));
|
displayParts.push(keywordPart(SyntaxKind.NewKeyword));
|
||||||
displayParts.push(spacePart());
|
displayParts.push(spacePart());
|
||||||
}
|
}
|
||||||
if (!(type.flags & TypeFlags.Object && (<ObjectType>type).objectFlags & ObjectFlags.Anonymous) && type.symbol) {
|
|
||||||
addRange(displayParts, symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, SymbolFormatFlags.WriteTypeParametersOrArguments));
|
|
||||||
}
|
|
||||||
addSignatureDisplayParts(signature, allSignatures, TypeFormatFlags.WriteArrowStyleSignature);
|
addSignatureDisplayParts(signature, allSignatures, TypeFormatFlags.WriteArrowStyleSignature);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -368,6 +368,10 @@
|
||||||
"text": "I",
|
"text": "I",
|
||||||
"kind": "interfaceName"
|
"kind": "interfaceName"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"text": "\n",
|
||||||
|
"kind": "lineBreak"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"text": "(",
|
"text": "(",
|
||||||
"kind": "punctuation"
|
"kind": "punctuation"
|
||||||
|
@ -472,6 +476,14 @@
|
||||||
"text": " ",
|
"text": " ",
|
||||||
"kind": "space"
|
"kind": "space"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"text": "I",
|
||||||
|
"kind": "interfaceName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "\n",
|
||||||
|
"kind": "lineBreak"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"text": "new",
|
"text": "new",
|
||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
|
@ -480,10 +492,6 @@
|
||||||
"text": " ",
|
"text": " ",
|
||||||
"kind": "space"
|
"kind": "space"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"text": "I",
|
|
||||||
"kind": "interfaceName"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"text": "(",
|
"text": "(",
|
||||||
"kind": "punctuation"
|
"kind": "punctuation"
|
||||||
|
|
|
@ -2058,6 +2058,14 @@
|
||||||
"text": " ",
|
"text": " ",
|
||||||
"kind": "space"
|
"kind": "space"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"text": "I",
|
||||||
|
"kind": "interfaceName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "\n",
|
||||||
|
"kind": "lineBreak"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"text": "new",
|
"text": "new",
|
||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
|
@ -2066,10 +2074,6 @@
|
||||||
"text": " ",
|
"text": " ",
|
||||||
"kind": "space"
|
"kind": "space"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"text": "I",
|
|
||||||
"kind": "interfaceName"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"text": "<",
|
"text": "<",
|
||||||
"kind": "punctuation"
|
"kind": "punctuation"
|
||||||
|
@ -2188,6 +2192,10 @@
|
||||||
"text": "I",
|
"text": "I",
|
||||||
"kind": "interfaceName"
|
"kind": "interfaceName"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"text": "\n",
|
||||||
|
"kind": "lineBreak"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"text": "<",
|
"text": "<",
|
||||||
"kind": "punctuation"
|
"kind": "punctuation"
|
||||||
|
@ -5462,6 +5470,14 @@
|
||||||
"text": " ",
|
"text": " ",
|
||||||
"kind": "space"
|
"kind": "space"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"text": "I1",
|
||||||
|
"kind": "interfaceName"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "\n",
|
||||||
|
"kind": "lineBreak"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"text": "new",
|
"text": "new",
|
||||||
"kind": "keyword"
|
"kind": "keyword"
|
||||||
|
@ -5470,10 +5486,6 @@
|
||||||
"text": " ",
|
"text": " ",
|
||||||
"kind": "space"
|
"kind": "space"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"text": "I1",
|
|
||||||
"kind": "interfaceName"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"text": "<",
|
"text": "<",
|
||||||
"kind": "punctuation"
|
"kind": "punctuation"
|
||||||
|
@ -5748,6 +5760,10 @@
|
||||||
"text": "I1",
|
"text": "I1",
|
||||||
"kind": "interfaceName"
|
"kind": "interfaceName"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"text": "\n",
|
||||||
|
"kind": "lineBreak"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"text": "<",
|
"text": "<",
|
||||||
"kind": "punctuation"
|
"kind": "punctuation"
|
||||||
|
|
|
@ -113,7 +113,7 @@ goTo.marker('16');
|
||||||
verify.currentSignatureHelpDocCommentIs("new method");
|
verify.currentSignatureHelpDocCommentIs("new method");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("param");
|
verify.currentParameterHelpArgumentDocCommentIs("param");
|
||||||
verify.quickInfos({
|
verify.quickInfos({
|
||||||
"16q": ["var i2_i: new i2(i: i1) => any", "new method"],
|
"16q": ["var i2_i: i2\nnew (i: i1) => any", "new method"],
|
||||||
|
|
||||||
17: "var i2_i_nc_x: number",
|
17: "var i2_i_nc_x: number",
|
||||||
18: "(property) i2.nc_x: number",
|
18: "(property) i2.nc_x: number",
|
||||||
|
@ -133,7 +133,7 @@ verify.quickInfos({
|
||||||
goTo.marker('24');
|
goTo.marker('24');
|
||||||
verify.currentSignatureHelpDocCommentIs("this is call signature");
|
verify.currentSignatureHelpDocCommentIs("this is call signature");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("paramhelp a");
|
verify.currentParameterHelpArgumentDocCommentIs("paramhelp a");
|
||||||
verify.quickInfoAt("24q", "var i2_i: i2(a: number, b: number) => number", "this is call signature");
|
verify.quickInfoAt("24q", "var i2_i: i2\n(a: number, b: number) => number", "this is call signature");
|
||||||
|
|
||||||
goTo.marker('25');
|
goTo.marker('25');
|
||||||
verify.currentSignatureHelpDocCommentIs("this is call signature");
|
verify.currentSignatureHelpDocCommentIs("this is call signature");
|
||||||
|
|
|
@ -296,34 +296,34 @@ verify.completionListContains('f4', 'function f4(a: number): number (+1 overload
|
||||||
|
|
||||||
goTo.marker('18');
|
goTo.marker('18');
|
||||||
verify.not.completionListContains('i1', 'interface i1', '');
|
verify.not.completionListContains('i1', 'interface i1', '');
|
||||||
verify.completionListContains('i1_i', 'var i1_i: new i1(b: number) => any (+1 overload)', '');
|
verify.completionListContains('i1_i', 'var i1_i: i1\nnew (b: number) => any (+1 overload)', '');
|
||||||
verify.not.completionListContains('i2', 'interface i2', '');
|
verify.not.completionListContains('i2', 'interface i2', '');
|
||||||
verify.completionListContains('i2_i', 'var i2_i: new i2(a: string) => any (+1 overload)', '');
|
verify.completionListContains('i2_i', 'var i2_i: i2\nnew (a: string) => any (+1 overload)', '');
|
||||||
verify.not.completionListContains('i3', 'interface i3', '');
|
verify.not.completionListContains('i3', 'interface i3', '');
|
||||||
verify.completionListContains('i3_i', 'var i3_i: new i3(a: string) => any (+1 overload)', 'new 1');
|
verify.completionListContains('i3_i', 'var i3_i: i3\nnew (a: string) => any (+1 overload)', 'new 1');
|
||||||
verify.not.completionListContains('i4', 'interface i4', '');
|
verify.not.completionListContains('i4', 'interface i4', '');
|
||||||
verify.completionListContains('i4_i', 'var i4_i: new i4(a: string) => any (+1 overload)', '');
|
verify.completionListContains('i4_i', 'var i4_i: i4\nnew (a: string) => any (+1 overload)', '');
|
||||||
|
|
||||||
goTo.marker('19');
|
goTo.marker('19');
|
||||||
verify.currentSignatureHelpDocCommentIs("");
|
verify.currentSignatureHelpDocCommentIs("");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("19q", "var i1_i: new i1(b: number) => any (+1 overload)");
|
verify.quickInfoAt("19q", "var i1_i: i1\nnew (b: number) => any (+1 overload)");
|
||||||
|
|
||||||
goTo.marker('20');
|
goTo.marker('20');
|
||||||
verify.currentSignatureHelpDocCommentIs("new 1");
|
verify.currentSignatureHelpDocCommentIs("new 1");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("20q", "var i1_i: new i1(a: string) => any (+1 overload)", "new 1");
|
verify.quickInfoAt("20q", "var i1_i: i1\nnew (a: string) => any (+1 overload)", "new 1");
|
||||||
|
|
||||||
goTo.marker('21');
|
goTo.marker('21');
|
||||||
verify.currentSignatureHelpDocCommentIs("this signature 1");
|
verify.currentSignatureHelpDocCommentIs("this signature 1");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("param a");
|
verify.currentParameterHelpArgumentDocCommentIs("param a");
|
||||||
verify.quickInfoAt("21q", "var i1_i: i1(a: number) => number (+1 overload)", "this signature 1");
|
verify.quickInfoAt("21q", "var i1_i: i1\n(a: number) => number (+1 overload)", "this signature 1");
|
||||||
|
|
||||||
goTo.marker('22');
|
goTo.marker('22');
|
||||||
verify.currentSignatureHelpDocCommentIs("this is signature 2");
|
verify.currentSignatureHelpDocCommentIs("this is signature 2");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
goTo.marker('22q');
|
goTo.marker('22q');
|
||||||
verify.quickInfoAt("22q", "var i1_i: i1(b: string) => number (+1 overload)", "this is signature 2");
|
verify.quickInfoAt("22q", "var i1_i: i1\n(b: string) => number (+1 overload)", "this is signature 2");
|
||||||
|
|
||||||
goTo.marker('23');
|
goTo.marker('23');
|
||||||
verify.completionListContains('foo', '(method) i1.foo(a: number): number (+1 overload)', 'foo 1');
|
verify.completionListContains('foo', '(method) i1.foo(a: number): number (+1 overload)', 'foo 1');
|
||||||
|
@ -374,62 +374,62 @@ verify.quickInfoAt("31q", "(method) i1.foo4(b: string): number (+1 overload)");
|
||||||
goTo.marker('32');
|
goTo.marker('32');
|
||||||
verify.currentSignatureHelpDocCommentIs("new 2");
|
verify.currentSignatureHelpDocCommentIs("new 2");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("32q", "var i2_i: new i2(b: number) => any (+1 overload)", "new 2");
|
verify.quickInfoAt("32q", "var i2_i: i2\nnew (b: number) => any (+1 overload)", "new 2");
|
||||||
|
|
||||||
goTo.marker('33');
|
goTo.marker('33');
|
||||||
verify.currentSignatureHelpDocCommentIs("");
|
verify.currentSignatureHelpDocCommentIs("");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("33q", "var i2_i: new i2(a: string) => any (+1 overload)");
|
verify.quickInfoAt("33q", "var i2_i: i2\nnew (a: string) => any (+1 overload)");
|
||||||
|
|
||||||
goTo.marker('34');
|
goTo.marker('34');
|
||||||
verify.currentSignatureHelpDocCommentIs("");
|
verify.currentSignatureHelpDocCommentIs("");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("34q", "var i2_i: i2(a: number) => number (+1 overload)");
|
verify.quickInfoAt("34q", "var i2_i: i2\n(a: number) => number (+1 overload)");
|
||||||
|
|
||||||
goTo.marker('35');
|
goTo.marker('35');
|
||||||
verify.currentSignatureHelpDocCommentIs("this is signature 2");
|
verify.currentSignatureHelpDocCommentIs("this is signature 2");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("35q", "var i2_i: i2(b: string) => number (+1 overload)", "this is signature 2");
|
verify.quickInfoAt("35q", "var i2_i: i2\n(b: string) => number (+1 overload)", "this is signature 2");
|
||||||
|
|
||||||
goTo.marker('36');
|
goTo.marker('36');
|
||||||
verify.currentSignatureHelpDocCommentIs("new 2");
|
verify.currentSignatureHelpDocCommentIs("new 2");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("36q", "var i3_i: new i3(b: number) => any (+1 overload)", "new 2");
|
verify.quickInfoAt("36q", "var i3_i: i3\nnew (b: number) => any (+1 overload)", "new 2");
|
||||||
|
|
||||||
goTo.marker('37');
|
goTo.marker('37');
|
||||||
verify.currentSignatureHelpDocCommentIs("new 1");
|
verify.currentSignatureHelpDocCommentIs("new 1");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("37q", "var i3_i: new i3(a: string) => any (+1 overload)", "new 1");
|
verify.quickInfoAt("37q", "var i3_i: i3\nnew (a: string) => any (+1 overload)", "new 1");
|
||||||
|
|
||||||
goTo.marker('38');
|
goTo.marker('38');
|
||||||
verify.currentSignatureHelpDocCommentIs("this is signature 1");
|
verify.currentSignatureHelpDocCommentIs("this is signature 1");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("38q", "var i3_i: i3(a: number) => number (+1 overload)", "this is signature 1");
|
verify.quickInfoAt("38q", "var i3_i: i3\n(a: number) => number (+1 overload)", "this is signature 1");
|
||||||
|
|
||||||
goTo.marker('39');
|
goTo.marker('39');
|
||||||
verify.currentSignatureHelpDocCommentIs("");
|
verify.currentSignatureHelpDocCommentIs("");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("39q", "var i3_i: i3(b: string) => number (+1 overload)");
|
verify.quickInfoAt("39q", "var i3_i: i3\n(b: string) => number (+1 overload)");
|
||||||
|
|
||||||
goTo.marker('40');
|
goTo.marker('40');
|
||||||
verify.currentSignatureHelpDocCommentIs("");
|
verify.currentSignatureHelpDocCommentIs("");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("40q", "var i4_i: new i4(b: number) => any (+1 overload)");
|
verify.quickInfoAt("40q", "var i4_i: i4\nnew (b: number) => any (+1 overload)");
|
||||||
|
|
||||||
goTo.marker('41');
|
goTo.marker('41');
|
||||||
verify.currentSignatureHelpDocCommentIs("");
|
verify.currentSignatureHelpDocCommentIs("");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("41q", "var i4_i: new i4(a: string) => any (+1 overload)");
|
verify.quickInfoAt("41q", "var i4_i: i4\nnew (a: string) => any (+1 overload)");
|
||||||
|
|
||||||
goTo.marker('42');
|
goTo.marker('42');
|
||||||
verify.currentSignatureHelpDocCommentIs("");
|
verify.currentSignatureHelpDocCommentIs("");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("42q", "var i4_i: i4(a: number) => number (+1 overload)");
|
verify.quickInfoAt("42q", "var i4_i: i4\n(a: number) => number (+1 overload)");
|
||||||
|
|
||||||
goTo.marker('43');
|
goTo.marker('43');
|
||||||
verify.currentSignatureHelpDocCommentIs("");
|
verify.currentSignatureHelpDocCommentIs("");
|
||||||
verify.currentParameterHelpArgumentDocCommentIs("");
|
verify.currentParameterHelpArgumentDocCommentIs("");
|
||||||
verify.quickInfoAt("43q", "var i4_i: i4(b: string) => number (+1 overload)");
|
verify.quickInfoAt("43q", "var i4_i: i4\n(b: string) => number (+1 overload)");
|
||||||
|
|
||||||
goTo.marker('44');
|
goTo.marker('44');
|
||||||
verify.completionListContains('prop1', '(method) c.prop1(a: number): number (+1 overload)', '');
|
verify.completionListContains('prop1', '(method) c.prop1(a: number): number (+1 overload)', '');
|
||||||
|
|
|
@ -33,8 +33,8 @@ verify.quickInfoAt("1", 'import a1 = require("./externalModuleWithExportAssignme
|
||||||
verify.quickInfoAt("2", "var a: {\n (): a1.connectExport;\n test1: a1.connectModule;\n test2(): a1.connectModule;\n}", undefined);
|
verify.quickInfoAt("2", "var a: {\n (): a1.connectExport;\n test1: a1.connectModule;\n test2(): a1.connectModule;\n}", undefined);
|
||||||
|
|
||||||
goTo.marker('3');
|
goTo.marker('3');
|
||||||
verify.quickInfoIs("(property) test1: a1.connectModule(res: any, req: any, next: any) => void", undefined);
|
verify.quickInfoIs("(property) test1: a1.connectModule\n(res: any, req: any, next: any) => void", undefined);
|
||||||
verify.completionListContains("test1", "(property) test1: a1.connectModule(res: any, req: any, next: any) => void", undefined);
|
verify.completionListContains("test1", "(property) test1: a1.connectModule\n(res: any, req: any, next: any) => void", undefined);
|
||||||
verify.completionListContains("test2", "(method) test2(): a1.connectModule", undefined);
|
verify.completionListContains("test2", "(method) test2(): a1.connectModule", undefined);
|
||||||
verify.not.completionListContains("connectModule");
|
verify.not.completionListContains("connectModule");
|
||||||
verify.not.completionListContains("connectExport");
|
verify.not.completionListContains("connectExport");
|
||||||
|
@ -53,8 +53,8 @@ verify.currentSignatureHelpIs("a(): a1.connectExport");
|
||||||
verify.quickInfoAt("8", "var r2: a1.connectExport", undefined);
|
verify.quickInfoAt("8", "var r2: a1.connectExport", undefined);
|
||||||
|
|
||||||
goTo.marker('9');
|
goTo.marker('9');
|
||||||
verify.quickInfoIs("(property) test1: a1.connectModule(res: any, req: any, next: any) => void", undefined);
|
verify.quickInfoIs("(property) test1: a1.connectModule\n(res: any, req: any, next: any) => void", undefined);
|
||||||
verify.completionListContains("test1", "(property) test1: a1.connectModule(res: any, req: any, next: any) => void", undefined);
|
verify.completionListContains("test1", "(property) test1: a1.connectModule\n(res: any, req: any, next: any) => void", undefined);
|
||||||
verify.completionListContains("test2", "(method) test2(): a1.connectModule", undefined);
|
verify.completionListContains("test2", "(method) test2(): a1.connectModule", undefined);
|
||||||
verify.not.completionListContains("connectModule");
|
verify.not.completionListContains("connectModule");
|
||||||
verify.not.completionListContains("connectExport");
|
verify.not.completionListContains("connectExport");
|
||||||
|
|
Loading…
Reference in a new issue