-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support completions contextual types in more places
- Loading branch information
Andy Hanson
committed
Dec 21, 2017
1 parent
60bd262
commit a71011d
Showing
9 changed files
with
167 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////enum E {} | ||
////declare const e: E; | ||
////e === /**/ | ||
////enum Enu {} | ||
////declare const e: Enu; | ||
////e === /*a*/; | ||
////e === E/*b*/ | ||
|
||
goTo.marker(); | ||
verify.completionListContains("E", "enum E", "", "enum", undefined, undefined, { isRecommended: true }); | ||
goTo.eachMarker(["a", "b"], () => { | ||
verify.completionListContains("Enu", "enum Enu", "", "enum", undefined, undefined, { isRecommended: true }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,37 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////enum E {} | ||
////class C {} | ||
////abstract class A {} | ||
////const e: E = /*e*/ | ||
////const c: C = new /*c*/ | ||
////const a: A = new /*a*/ | ||
////enum Enu {} | ||
////class Cls {} | ||
////abstract class Abs {} | ||
////const e: Enu = E/*e0*/; | ||
////const e: Enu = /*e1*/; | ||
////const c: Cls = new C/*c0*/; | ||
////const c: Cls = new /*c1*/; | ||
////const a: Abs = new A/*a0*/; | ||
////const a: Abs = new /*a1*/; | ||
|
||
goTo.marker("e"); | ||
verify.completionListContains("E", "enum E", "", "enum", undefined, undefined, { isRecommended: true }); | ||
// Also works on mutations | ||
////let enu: Enu; | ||
////enu = E/*let0*/; | ||
////enu = E/*let1*/; | ||
|
||
goTo.marker("c"); | ||
verify.completionListContains("C", "class C", "", "class", undefined, undefined, { isRecommended: true }); | ||
goTo.eachMarker(["e0"], () => {//, "e1", "let0", "let1" | ||
verify.completionListContains("Enu", "enum Enu", "", "enum", undefined, undefined, { isRecommended: true }); | ||
}); | ||
|
||
goTo.marker("a"); | ||
// Not recommended, because it's an abstract class | ||
verify.completionListContains("A", "class A", "", "class"); | ||
goTo.eachMarker(["c0", "c1"], (_, idx) => { | ||
verify.completionListContains( | ||
"Cls", | ||
idx === 0 ? "constructor Cls(): Cls" : "class Cls", | ||
"", | ||
"class", | ||
undefined, | ||
undefined, { | ||
isRecommended: true, | ||
}); | ||
}); | ||
|
||
goTo.eachMarker(["a0", "a1"], (_, idx) => { | ||
// Not recommended, because it's an abstract class | ||
verify.completionListContains("Abs", idx == 0 ? "constructor Abs(): Abs" : "class Abs", "", "class"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.