diff --git a/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInClass.ts b/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInClass.ts deleted file mode 100644 index ed4da7dac91..00000000000 --- a/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInClass.ts +++ /dev/null @@ -1,239 +0,0 @@ -/// - -////class /*1*/c { -//// /*3*/constructor(/*4*/a: /*5*/T) { -//// } -//// /*6*/method(/*8*/a: /*9*/U, /*10*/b: /*11*/T) { -//// return /*12*/a; -//// } -////} -////var /*13*/cInstance = new /*14*/c("Hello"); -////var /*15*/cVal = /*16*/c; -/////*17*/cInstance./*18*/method("hello", "cello"); -////class /*19*/c2> { -//// /*22*/constructor(/*23*/a: /*24*/T) { -//// } -//// /*25*/method>(/*28*/a: /*29*/U, /*30*/b: /*31*/T) { -//// return /*32*/a; -//// } -////} -////var /*33*/cInstance1 = new /*34*/c2(/*35*/cInstance); -////var /*36*/cVal2 = /*37*/c2; -/////*38*/cInstance1./*39*/method(/*40*/cInstance, /*41*/cInstance); - -var marker = 0; -var markerName: string; - -function goToMarker() { - marker++; - markerName = marker.toString(); - goTo.marker(markerName); -} - -function getTypeParameterDisplay(instanceType: ts.SymbolDisplayPart[], - name: string, optionalExtends?: ts.SymbolDisplayPart[]) { - return instanceType || - function () { - var typeParameterDisplay = [{ text: name, kind: "typeParameterName" }]; - if (optionalExtends) { - typeParameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" }, - { text: " ", kind: "space" }); - typeParameterDisplay = typeParameterDisplay.concat(optionalExtends); - } - return typeParameterDisplay - } (); -} - -function getClassDisplay(name: string, optionalInstanceType?: ts.SymbolDisplayPart[], - optionalExtends?: ts.SymbolDisplayPart[]) { - var classDisplay = [{ text: name, kind: "className" }, { text: "<", kind: "punctuation" }]; - classDisplay = classDisplay.concat(getTypeParameterDisplay(optionalInstanceType, "T", optionalExtends)); - classDisplay.push({ text: ">", kind: "punctuation" }); - return classDisplay; -} - -function verifyClassDisplay(name: string, optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - - verify.verifyQuickInfoDisplayParts("class", "", { start: test.markerByName(markerName).position, length: name.length }, - [{ text: "class", kind: "keyword" }, { text: " ", kind: "space" }].concat( - getClassDisplay(name, undefined, optionalExtends)), []); -} - -function verifyTypeParameter(name: string, inDisplay: ts.SymbolDisplayPart[]) { - goToMarker(); - - var typeParameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "type parameter", kind: "text" }, { text: ")", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: name, kind: "typeParameterName" }, - { text: " ", kind: "space" }, { text: "in", kind: "keyword" }, { text: " ", kind: "space" }]; - typeParameterDisplay = typeParameterDisplay.concat(inDisplay); - - verify.verifyQuickInfoDisplayParts("type parameter", "", { start: test.markerByName(markerName).position, length: name.length }, - typeParameterDisplay, []); -} - -function verifyConstructor(name: string, optionalInstanceType?: ts.SymbolDisplayPart[], - optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - var constructorDisplay = [{ text: "constructor", kind: "keyword" }, - { text: " ", kind: "space" }]; - constructorDisplay = constructorDisplay.concat(getClassDisplay(name, optionalInstanceType, optionalExtends)); - - constructorDisplay.push({ text: "(", kind: "punctuation" }, { text: "a", kind: "parameterName" }, - { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }); - - constructorDisplay = constructorDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "T")); - - constructorDisplay.push({ text: ")", kind: "punctuation" }, - { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }); - - constructorDisplay = constructorDisplay.concat(getClassDisplay(name, optionalInstanceType)); - - verify.verifyQuickInfoDisplayParts("constructor", "", { start: test.markerByName(markerName).position, length: optionalInstanceType ? name.length : "constructor".length }, - constructorDisplay, []); -} - -function verifyParameter(name: string, type: string, optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - var parameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "parameter", kind: "text" }, { text: ")", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: name, kind: "parameterName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: type, kind: "typeParameterName" }]; - if (optionalExtends) { - parameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" }, - { text: " ", kind: "space" }); - parameterDisplay = parameterDisplay.concat(optionalExtends); - } - verify.verifyQuickInfoDisplayParts("parameter", "", { start: test.markerByName(markerName).position, length: name.length }, - parameterDisplay, []); -} - -function getMethodDisplay(name: string, className: string, - optionalInstanceType?: ts.SymbolDisplayPart[], optionalExtends?: ts.SymbolDisplayPart[]) { - var functionDisplay = getClassDisplay(className, optionalInstanceType, optionalExtends); - - functionDisplay.push({ text: ".", kind: "punctuation" }, { text: name, kind: "methodName" }, - { text: "<", kind: "punctuation" }); - - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U", optionalExtends)); - - functionDisplay.push({ text: ">", kind: "punctuation" }, { text: "(", kind: "punctuation" }, - { text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }); - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U")); - functionDisplay.push({ text: ",", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: "b", kind: "parameterName" }, - { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }); - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "T")); - - functionDisplay.push({ text: ")", kind: "punctuation" }, - { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }); - - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U")); - - return functionDisplay; -} - -function verifyMethodDisplay(name: string, className: string, - optionalInstanceType?: ts.SymbolDisplayPart[], optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - var functionDisplay = [{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" }, - { text: ")", kind: "punctuation" }, { text: " ", kind: "space" }].concat( - getMethodDisplay(name, className, optionalInstanceType, optionalExtends)); - - verify.verifyQuickInfoDisplayParts("method", "", - { start: test.markerByName(markerName).position, length: name.length }, - functionDisplay, []); -} - -function verifyClassInstance(name: string, typeDisplay: ts.SymbolDisplayPart[]) { - goToMarker(); - verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: name.length }, - [{ text: "var", kind: "keyword" }, - { text: " ", kind: "space" }, { text: name, kind: "localName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }].concat(typeDisplay), - []); -} - -function verifyVarTypeOf(name: string, typeOfSymbol: ts.SymbolDisplayPart) { - goToMarker(); - verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: name.length }, - [{ text: "var", kind: "keyword" }, - { text: " ", kind: "space" }, { text: name, kind: "localName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: "typeof", kind: "keyword" }, - { text: " ", kind: "space" }].concat(typeOfSymbol), - []); -} - -var stringTypeDisplay = [{ text: "string", kind: "keyword" }]; -var extendsTypeDisplay = getClassDisplay("c", stringTypeDisplay); - -// Declaration -verifyClassDisplay("c"); -verifyTypeParameter("T", getClassDisplay("c")); - -// Constructor declaration -verifyConstructor("c"); -verifyParameter("a", "T"); -verifyTypeParameter("T", getClassDisplay("c")); - -// Method declaration -verifyMethodDisplay("method", "c"); -verifyTypeParameter("U", getMethodDisplay("method", "c")); -verifyParameter("a", "U"); -verifyTypeParameter("U", getMethodDisplay("method", "c")); -verifyParameter("b", "T"); -verifyTypeParameter("T", getClassDisplay("c")); -verifyParameter("a", "U"); - -// Instance creation -verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay)); -verifyConstructor("c", stringTypeDisplay); - -// typeof assignment -verifyVarTypeOf("cVal", { text: "c", kind: "className" }); -verifyClassDisplay("c"); - -// Method call -verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay)); -verifyMethodDisplay("method", "c", stringTypeDisplay); - -// With constraint -// Declaration -verifyClassDisplay("c2", getClassDisplay("c", stringTypeDisplay)); -verifyTypeParameter("T", getClassDisplay("c2", /*instanceType*/undefined, extendsTypeDisplay)); -verifyClassDisplay("c"); - -// Constructor declaration -verifyConstructor("c2", /*instanceType*/undefined, extendsTypeDisplay); -verifyParameter("a", "T", extendsTypeDisplay); -verifyTypeParameter("T", getClassDisplay("c2", /*instanceType*/undefined, extendsTypeDisplay)); - -// Method declaration -verifyMethodDisplay("method", "c2", /*instance*/undefined, extendsTypeDisplay); -verifyTypeParameter("U", getMethodDisplay("method", "c2", /*instance*/undefined, extendsTypeDisplay)); -verifyClassDisplay("c"); -verifyParameter("a", "U", extendsTypeDisplay); -verifyTypeParameter("U", getMethodDisplay("method", "c2", /*instance*/undefined, extendsTypeDisplay)); -verifyParameter("b", "T", extendsTypeDisplay); -verifyTypeParameter("T", getClassDisplay("c2", /*instanceType*/undefined, extendsTypeDisplay)); -verifyParameter("a", "U", extendsTypeDisplay); - -// Instance creation -verifyClassInstance("cInstance1", getClassDisplay("c2", extendsTypeDisplay)); -verifyConstructor("c2", extendsTypeDisplay); -verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay)); - -// typeof assignment -verifyVarTypeOf("cVal2", { text: "c2", kind: "className" }); -verifyClassDisplay("c2", getClassDisplay("c", stringTypeDisplay)); - -// Method call -verifyClassInstance("cInstance1", getClassDisplay("c2", extendsTypeDisplay)); -verifyMethodDisplay("method", "c2", extendsTypeDisplay); -verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay)); -verifyClassInstance("cInstance", getClassDisplay("c", stringTypeDisplay)); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInFunction.ts b/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInFunction.ts deleted file mode 100644 index 2cbb50bbea7..00000000000 --- a/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInFunction.ts +++ /dev/null @@ -1,117 +0,0 @@ -/// - - -////function /*1*/foo(/*3*/a: /*4*/U) { -//// return /*5*/a; -////} -/////*6*/foo("Hello"); -////function /*7*/foo2(/*9*/a: /*10*/U) { -//// return /*11*/a; -////} -/////*12*/foo2("hello"); - -var marker = 0; -var markerName: string; - -function goToMarker() { - marker++; - markerName = marker.toString(); - goTo.marker(markerName); -} - -function getTypeParameterDisplay(instanceType: ts.SymbolDisplayPart[], - name: string, optionalExtends?: ts.SymbolDisplayPart[]) { - return instanceType || - function () { - var typeParameterDisplay = [{ text: name, kind: "typeParameterName" }]; - if (optionalExtends) { - typeParameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" }, - { text: " ", kind: "space" }); - typeParameterDisplay = typeParameterDisplay.concat(optionalExtends); - } - return typeParameterDisplay - } (); -} - -function verifyTypeParameter(name: string, inDisplay: ts.SymbolDisplayPart[]) { - goToMarker(); - - var typeParameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "type parameter", kind: "text" }, { text: ")", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: name, kind: "typeParameterName" }, - { text: " ", kind: "space" }, { text: "in", kind: "keyword" }, { text: " ", kind: "space" }]; - typeParameterDisplay = typeParameterDisplay.concat(inDisplay); - - verify.verifyQuickInfoDisplayParts("type parameter", "", { start: test.markerByName(markerName).position, length: name.length }, - typeParameterDisplay, []); -} - -function verifyParameter(name: string, typeParameterName: string, optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - var parameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "parameter", kind: "text" }, { text: ")", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: name, kind: "parameterName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: typeParameterName, kind: "typeParameterName" }]; - if (optionalExtends) { - parameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" }, - { text: " ", kind: "space" }); - parameterDisplay = parameterDisplay.concat(optionalExtends); - } - verify.verifyQuickInfoDisplayParts("parameter", "", { start: test.markerByName(markerName).position, length: name.length }, - parameterDisplay, []); -} - -function getFunctionDisplay(name: string, optionalInstanceType?: ts.SymbolDisplayPart[], - optionalExtends?: ts.SymbolDisplayPart[]) { - var functionDisplay = [{ text: name, kind: "functionName" }, { text: "<", kind: "punctuation" }]; - - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U", optionalExtends)); - - functionDisplay.push({ text: ">", kind: "punctuation" }, { text: "(", kind: "punctuation" }, - { text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }); - - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U")); - - functionDisplay.push({ text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }); - - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U")); - - return functionDisplay; -} - -function verifyFunctionDisplay(name: string, optionalInstanceType?: ts.SymbolDisplayPart[], - optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - var functionDisplay = [{ text: "function", kind: "keyword" }, { text: " ", kind: "space" }].concat( - getFunctionDisplay(name, optionalInstanceType, optionalExtends)); - - verify.verifyQuickInfoDisplayParts("function", "", - { start: test.markerByName(markerName).position, length: name.length }, - functionDisplay, []); -} - -var stringTypeDisplay = [{ text: "string", kind: "keyword" }]; - -// Declaration -verifyFunctionDisplay("foo"); -verifyTypeParameter("U", getFunctionDisplay("foo")); -verifyParameter("a", "U"); -verifyTypeParameter("U", getFunctionDisplay("foo")); -verifyParameter("a", "U"); - -// Call -verifyFunctionDisplay("foo", stringTypeDisplay); - -// With constraint -// Declaration -verifyFunctionDisplay("foo2", /*instance*/ undefined, stringTypeDisplay); -verifyTypeParameter("U", getFunctionDisplay("foo2", /*instance*/ undefined, stringTypeDisplay)); -verifyParameter("a", "U", stringTypeDisplay); -verifyTypeParameter("U", getFunctionDisplay("foo2", /*instance*/ undefined, stringTypeDisplay)); -verifyParameter("a", "U", stringTypeDisplay); - -// Call -verifyFunctionDisplay("foo2", [{ text: "\"hello\"", kind: "stringLiteral" }]); \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInInterface.ts b/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInInterface.ts deleted file mode 100644 index d9ffd3fb922..00000000000 --- a/tests/cases/fourslash/quickInfoDisplayPartsTypeParameterInInterface.ts +++ /dev/null @@ -1,263 +0,0 @@ -/// - -////interface /*1*/I { -//// new (/*4*/a: /*5*/U, /*6*/b: /*7*/T): /*8*/U; -//// (/*10*/a: /*11*/U, /*12*/b: /*13*/T): /*14*/U; -//// /*15*/method(/*17*/a: /*18*/U, /*19*/b: /*20*/T): /*21*/U; -////} -////var /*22*/iVal: /*23*/I; -////new /*24*/iVal("hello", "hello"); -/////*25*/iVal("hello", "hello"); -/////*26*/iVal./*27*/method("hello", "hello"); -////interface /*28*/I1> { -//// new >(/*33*/a: /*34*/U, /*35*/b: /*36*/T): /*37*/U; -//// >(/*40*/a: /*41*/U, /*42*/b: /*43*/T): /*44*/U; -//// /*45*/method>(/*48*/a: /*49*/U, /*50*/b: /*51*/T): /*52*/U; -////} -////var /*53*/iVal1: /*54*/I1>; -////new /*56*/iVal1(/*57*/iVal, /*58*/iVal); -/////*59*/iVal1(/*60*/iVal, /*61*/iVal); -/////*62*/iVal1./*63*/method(/*64*/iVal, /*65*/iVal); - -var marker = 0; -var markerName: string; - -function goToMarker() { - marker++; - markerName = marker.toString(); - goTo.marker(markerName); -} - -function getTypeParameterDisplay(instanceType: ts.SymbolDisplayPart[], - name: string, optionalExtends?: ts.SymbolDisplayPart[]) { - return instanceType || - function () { - var typeParameterDisplay = [{ text: name, kind: "typeParameterName" }]; - if (optionalExtends) { - typeParameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" }, - { text: " ", kind: "space" }); - typeParameterDisplay = typeParameterDisplay.concat(optionalExtends); - } - return typeParameterDisplay - } (); -} - -function getInterfaceDisplay(name: string, optionalInstanceType?: ts.SymbolDisplayPart[], - optionalExtends?: ts.SymbolDisplayPart[]) { - var interfaceDisplay = [{ text: name, kind: "interfaceName" }, { text: "<", kind: "punctuation" }]; - interfaceDisplay = interfaceDisplay.concat(getTypeParameterDisplay(optionalInstanceType, "T", optionalExtends)); - interfaceDisplay.push({ text: ">", kind: "punctuation" }); - return interfaceDisplay; -} - -function verifyInterfaceDisplay(name: string, optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - - verify.verifyQuickInfoDisplayParts("interface", "", { start: test.markerByName(markerName).position, length: name.length }, - [{ text: "interface", kind: "keyword" }, { text: " ", kind: "space" }].concat( - getInterfaceDisplay(name, undefined, optionalExtends)), []); -} - -function verifyTypeParameter(name: string, inDisplay: ts.SymbolDisplayPart[]) { - goToMarker(); - - var typeParameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "type parameter", kind: "text" }, { text: ")", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: name, kind: "typeParameterName" }, - { text: " ", kind: "space" }, { text: "in", kind: "keyword" }, { text: " ", kind: "space" }]; - typeParameterDisplay = typeParameterDisplay.concat(inDisplay); - - verify.verifyQuickInfoDisplayParts("type parameter", "", { start: test.markerByName(markerName).position, length: name.length }, - typeParameterDisplay, []); -} - -function verifyParameter(name: string, typeParameterName: string, optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - var parameterDisplay = [{ text: "(", kind: "punctuation" }, { text: "parameter", kind: "text" }, { text: ")", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: name, kind: "parameterName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: typeParameterName, kind: "typeParameterName" }]; - if (optionalExtends) { - parameterDisplay.push({ text: " ", kind: "space" }, { text: "extends", kind: "keyword" }, - { text: " ", kind: "space" }); - parameterDisplay = parameterDisplay.concat(optionalExtends); - } - verify.verifyQuickInfoDisplayParts("parameter", "", { start: test.markerByName(markerName).position, length: name.length }, - parameterDisplay, []); -} - -function getSignatureDisplay(isArrow: boolean, optionalInstanceType?: ts.SymbolDisplayPart[], - optionalExtends?: ts.SymbolDisplayPart[]) { - var functionDisplay: ts.SymbolDisplayPart[] = []; - - functionDisplay.push({ text: "<", kind: "punctuation" }); - - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U", optionalExtends)); - - functionDisplay.push({ text: ">", kind: "punctuation" }, { text: "(", kind: "punctuation" }, - { text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }); - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U")); - functionDisplay.push({ text: ",", kind: "punctuation" }, - { text: " ", kind: "space" }, { text: "b", kind: "parameterName" }, - { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }); - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "T")); - - functionDisplay.push({ text: ")", kind: "punctuation" }); - if (isArrow) { - functionDisplay.push({ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" }); - } - else { - functionDisplay.push({ text: ":", kind: "punctuation" }); - } - functionDisplay.push({ text: " ", kind: "space" }); - - functionDisplay = functionDisplay.concat( - getTypeParameterDisplay(optionalInstanceType, "U")); - - return functionDisplay; -} - -function getMethodDisplay(name: string, interfaceName: string, optionalInstanceType?: ts.SymbolDisplayPart[], - optionalExtends?: ts.SymbolDisplayPart[]) { - return getInterfaceDisplay(interfaceName, optionalInstanceType, optionalExtends).concat( - { text: ".", kind: "punctuation" }, { text: name, kind: "methodName" }).concat( - getSignatureDisplay(/*isArrow*/ false, optionalInstanceType, optionalExtends)); -} - -function getCallOrNewSignatureDisplay(isNew: boolean, isArrow: boolean, interfaceName?: string, - optionalInstanceType?: ts.SymbolDisplayPart[], optionalExtends?: ts.SymbolDisplayPart[]) { - var result: ts.SymbolDisplayPart[] = []; - if (isNew) { - result.push({ text: "new", kind: "keyword" }, { text: " ", kind: "space" }); - } - if (interfaceName) { - result.push({ text: interfaceName, kind: "interfaceName" }); - } - - return result.concat(getSignatureDisplay(isArrow, optionalInstanceType, optionalExtends)); -} - -function verifyMethodDisplay(name: string, interfaceName: string, - optionalInstanceType?: ts.SymbolDisplayPart[], optionalExtends?: ts.SymbolDisplayPart[]) { - goToMarker(); - var functionDisplay = [{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" }, - { text: ")", kind: "punctuation" }, { text: " ", kind: "space" }].concat( - getMethodDisplay(name, interfaceName, optionalInstanceType, optionalExtends)); - - verify.verifyQuickInfoDisplayParts("method", "", - { start: test.markerByName(markerName).position, length: name.length }, - functionDisplay, []); -} - -function verifyInterfaceVar(name: string, typeDisplay: ts.SymbolDisplayPart[]) { - goToMarker(); - verify.verifyQuickInfoDisplayParts("var", "", { start: test.markerByName(markerName).position, length: name.length }, - [{ text: "var", kind: "keyword" }, - { text: " ", kind: "space" }, { text: name, kind: "localName" }, { text: ":", kind: "punctuation" }, - { text: " ", kind: "space" }].concat(typeDisplay), - []); -} - -var stringTypeDisplay = [{ text: "string", kind: "keyword" }]; -var extendsTypeDisplay = getInterfaceDisplay("I", stringTypeDisplay); - - -// Declaration -verifyInterfaceDisplay("I"); -verifyTypeParameter("T", getInterfaceDisplay("I")); - -// New declaration -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false)); -verifyParameter("a", "U"); -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false)); -verifyParameter("b", "T"); -verifyTypeParameter("T", getInterfaceDisplay("I")); -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false)); - -// Call declaration -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false)); -verifyParameter("a", "U"); -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false)); -verifyParameter("b", "T"); -verifyTypeParameter("T", getInterfaceDisplay("I")); -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false)); - -// Method declaration -verifyMethodDisplay("method", "I"); -verifyTypeParameter("U", getMethodDisplay("method", "I")); -verifyParameter("a", "U"); -verifyTypeParameter("U", getMethodDisplay("method", "I")); -verifyParameter("b", "T"); -verifyTypeParameter("T", getInterfaceDisplay("I")); -verifyTypeParameter("U", getMethodDisplay("method", "I")); - -// Instance -verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay)); -verifyInterfaceDisplay("I"); - -// new -verifyInterfaceVar("iVal", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ true, "I", stringTypeDisplay)); - -// call -verifyInterfaceVar("iVal", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ true, "I", stringTypeDisplay)); - -// Method call -verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay)); -verifyMethodDisplay("method", "I", stringTypeDisplay); - -// With constraint -// Declaration -verifyInterfaceDisplay("I1", extendsTypeDisplay); -verifyTypeParameter("T", getInterfaceDisplay("I1", /*instance*/undefined, extendsTypeDisplay)); -verifyInterfaceDisplay("I"); - -// New declaration -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay)); -verifyInterfaceDisplay("I"); -verifyParameter("a", "U", extendsTypeDisplay); -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay)); -verifyParameter("b", "T", extendsTypeDisplay); -verifyTypeParameter("T", getInterfaceDisplay("I1", /*instance*/undefined, extendsTypeDisplay)); -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay)); - -// Call declaration -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay)); -verifyInterfaceDisplay("I"); -verifyParameter("a", "U", extendsTypeDisplay); -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay)); -verifyParameter("b", "T", extendsTypeDisplay); -verifyTypeParameter("T", getInterfaceDisplay("I1", /*instance*/undefined, extendsTypeDisplay)); -verifyTypeParameter("U", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ false, /*interfaceName*/undefined, /*instance*/undefined, extendsTypeDisplay)); - -// Method declaration -verifyMethodDisplay("method", "I1", /*instance*/ undefined, extendsTypeDisplay); -verifyTypeParameter("U", getMethodDisplay("method", "I1", /*instance*/ undefined, extendsTypeDisplay)); -verifyInterfaceDisplay("I"); -verifyParameter("a", "U", extendsTypeDisplay); -verifyTypeParameter("U", getMethodDisplay("method", "I1", /*instance*/ undefined, extendsTypeDisplay)); -verifyParameter("b", "T", extendsTypeDisplay); -verifyTypeParameter("T", getInterfaceDisplay("I1", /*instance*/undefined, extendsTypeDisplay)); -verifyTypeParameter("U", getMethodDisplay("method", "I1", /*instance*/ undefined, extendsTypeDisplay)); - -// Instance -verifyInterfaceVar("iVal1", getInterfaceDisplay("I1", extendsTypeDisplay)); -verifyInterfaceDisplay("I1", extendsTypeDisplay); -verifyInterfaceDisplay("I"); - -// new -verifyInterfaceVar("iVal1", getCallOrNewSignatureDisplay(/*isNew*/ true, /*isArrow*/ true, "I1", extendsTypeDisplay)); -verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay)); -verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay)); - -// call -verifyInterfaceVar("iVal1", getCallOrNewSignatureDisplay(/*isNew*/ false, /*isArrow*/ true, "I1", extendsTypeDisplay)); -verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay)); -verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay)); - -// Method call -verifyInterfaceVar("iVal1", getInterfaceDisplay("I1", extendsTypeDisplay)); -verifyMethodDisplay("method", "I1", extendsTypeDisplay); -verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay)); -verifyInterfaceVar("iVal", getInterfaceDisplay("I", stringTypeDisplay));