|
| 1 | +/// <reference path='fourslash.ts'/> |
| 2 | + |
| 3 | +////class C { |
| 4 | +//// public /*1*/1() { } |
| 5 | +//// private /*2*/Infinity() { } |
| 6 | +//// protected /*3*/NaN() { } |
| 7 | +//// static /*4*/"stringLiteralName"() { } |
| 8 | +//// method() { |
| 9 | +//// this[/*5*/1](); |
| 10 | +//// this[/*6*/"1"](); |
| 11 | +//// this./*7*/Infinity(); |
| 12 | +//// this[/*8*/"Infinity"](); |
| 13 | +//// this./*9*/NaN(); |
| 14 | +//// C./*10*/stringLiteralName(); |
| 15 | +//// } |
| 16 | + |
| 17 | +verifyClassMethodWithElementAccessDisplay("1", "public", "1", "methodName", /*spanLength*/ "1".length); |
| 18 | +verifyClassMethodWithPropertyAccessDisplay("2", "private", "Infinity", /*spanLength*/ "Infinity".length); |
| 19 | +verifyClassMethodWithPropertyAccessDisplay("3", "protected", "NaN", /*spanLength*/ "NaN".length); |
| 20 | +verifyClassMethodWithElementAccessDisplay("4", "static", '"stringLiteralName"', "stringLiteral", /*spanLength*/ '"stringLiteralName"'.length); |
| 21 | +verifyClassMethodWithElementAccessDisplay("5", "public", "1", "methodName", /*spanLength*/ "1".length); |
| 22 | +verifyClassMethodWithElementAccessDisplay("6", "public", "1", "methodName", /*spanLength*/ "1".length + 2); |
| 23 | +verifyClassMethodWithPropertyAccessDisplay("7", "private", "Infinity", /*spanLength*/ "Infinity".length); |
| 24 | +verifyClassMethodWithPropertyAccessDisplay("8", "private", "Infinity", /*spanLength*/ "Infinity".length + 2); |
| 25 | +verifyClassMethodWithPropertyAccessDisplay("9", "protected", "NaN", /*spanLength*/ "NaN".length); |
| 26 | +verifyClassMethodWithElementAccessDisplay("10", "static", '"stringLiteralName"', "stringLiteral", /*spanLength*/ "stringLiteralName".length); |
| 27 | + |
| 28 | + |
| 29 | +function verifyClassMethodWithPropertyAccessDisplay(markerName: string, kindModifiers: string, methodName: string, spanLength: number) { |
| 30 | + goTo.marker(markerName); |
| 31 | + verify.verifyQuickInfoDisplayParts("method", kindModifiers, { start: test.markerByName(markerName).position, length: spanLength }, |
| 32 | + [{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" }, { text: ")", kind: "punctuation" }, |
| 33 | + { text: " ", kind: "space" }, |
| 34 | + { text: "C", kind: "className" }, { text: ".", kind: "punctuation" }, { text: methodName, kind: "methodName" }, |
| 35 | + { text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, |
| 36 | + { text: " ", kind: "space" }, { text: "void", kind: "keyword" }], |
| 37 | + []); |
| 38 | +} |
| 39 | + |
| 40 | +function verifyClassMethodWithElementAccessDisplay(markerName: string, kindModifiers: string, methodName: string, methodDisplay: "methodName" | "stringLiteral", spanLength: number) { |
| 41 | + goTo.marker(markerName); |
| 42 | + verify.verifyQuickInfoDisplayParts("method", kindModifiers, { start: test.markerByName(markerName).position, length: spanLength }, |
| 43 | + [{ text: "(", kind: "punctuation" }, { text: "method", kind: "text" }, { text: ")", kind: "punctuation" }, |
| 44 | + { text: " ", kind: "space" }, |
| 45 | + { text: "C", kind: "className" }, { text: "[", kind: "punctuation" }, { text: methodName, kind: methodDisplay }, { text: "]", kind: "punctuation" }, |
| 46 | + { text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, { text: ":", kind: "punctuation" }, |
| 47 | + { text: " ", kind: "space" }, { text: "void", kind: "keyword" }], |
| 48 | + []); |
| 49 | +} |
0 commit comments