-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Get occurrences for 'super' keywords #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DanielRosenwasser
merged 5 commits into
getOccurrences
from
getOccurrencesSuperThanksForAsking
Sep 9, 2014
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1121e11
Basic implementation without tests for findAllRefs/getOccs for 'super…
DanielRosenwasser 1cd0b30
Added tests for getOccurrences on super.
DanielRosenwasser 131ac2f
Disabled findAllRefs for 'this'/'super'.
DanielRosenwasser 0e93d28
Separated 'super'/'this' keyword searching to simplify logic.
DanielRosenwasser 83c35ad
Addressed CR feedback.
DanielRosenwasser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
|
|
||
| ////class SuperType { | ||
| //// superMethod() { | ||
| //// } | ||
| //// | ||
| //// static superStaticMethod() { | ||
| //// return 10; | ||
| //// } | ||
| ////} | ||
| //// | ||
| ////class SubType extends SuperType { | ||
| //// public prop1 = [|s/**/uper|].superMethod; | ||
| //// private prop2 = [|super|].superMethod; | ||
| //// | ||
| //// constructor() { | ||
| //// [|super|](); | ||
| //// } | ||
| //// | ||
| //// public method1() { | ||
| //// return [|super|].superMethod(); | ||
| //// } | ||
| //// | ||
| //// private method2() { | ||
| //// return [|super|].superMethod(); | ||
| //// } | ||
| //// | ||
| //// public method3() { | ||
| //// var x = () => [|super|].superMethod(); | ||
| //// | ||
| //// // Bad but still gets highlighted | ||
| //// function f() { | ||
| //// [|super|].superMethod(); | ||
| //// } | ||
| //// } | ||
| //// | ||
| //// // Bad but still gets highlighted. | ||
| //// public static statProp1 = super.superStaticMethod; | ||
| //// | ||
| //// public static staticMethod1() { | ||
| //// return super.superStaticMethod(); | ||
| //// } | ||
| //// | ||
| //// private static staticMethod2() { | ||
| //// return super.superStaticMethod(); | ||
| //// } | ||
| //// | ||
| //// // Are not actually 'super' keywords. | ||
| //// super = 10; | ||
| //// static super = 20; | ||
| ////} | ||
|
|
||
| test.ranges().forEach(r => { | ||
| goTo.position(r.start); | ||
|
|
||
| test.ranges().forEach(range => { | ||
| verify.occurrencesAtPositionContains(range, false); | ||
| }); | ||
| }); | ||
|
|
||
| goTo.marker(); | ||
| test.ranges().forEach(range => { | ||
| verify.occurrencesAtPositionContains(range, false); | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
|
|
||
| ////class SuperType { | ||
| //// superMethod() { | ||
| //// } | ||
| //// | ||
| //// static superStaticMethod() { | ||
| //// return 10; | ||
| //// } | ||
| ////} | ||
| //// | ||
| ////class SubType extends SuperType { | ||
| //// public prop1 = super.superMethod; | ||
| //// private prop2 = super.superMethod; | ||
| //// | ||
| //// constructor() { | ||
| //// super(); | ||
| //// } | ||
| //// | ||
| //// public method1() { | ||
| //// return super.superMethod(); | ||
| //// } | ||
| //// | ||
| //// private method2() { | ||
| //// return super.superMethod(); | ||
| //// } | ||
| //// | ||
| //// public method3() { | ||
| //// var x = () => super.superMethod(); | ||
| //// | ||
| //// // Bad but still gets highlighted | ||
| //// function f() { | ||
| //// super.superMethod(); | ||
| //// } | ||
| //// } | ||
| //// | ||
| //// // Bad but still gets highlighted. | ||
| //// public static statProp1 = [|super|].superStaticMethod; | ||
| //// | ||
| //// public static staticMethod1() { | ||
| //// return [|super|].superStaticMethod(); | ||
| //// } | ||
| //// | ||
| //// private static staticMethod2() { | ||
| //// return [|supe/**/r|].superStaticMethod(); | ||
| //// } | ||
| //// | ||
| //// // Are not actually 'super' keywords. | ||
| //// super = 10; | ||
| //// static super = 20; | ||
| ////} | ||
|
|
||
| test.ranges().forEach(r => { | ||
| goTo.position(r.start); | ||
|
|
||
| test.ranges().forEach(range => { | ||
| verify.occurrencesAtPositionContains(range, false); | ||
| }); | ||
| }); | ||
|
|
||
| goTo.marker(); | ||
| test.ranges().forEach(range => { | ||
| verify.occurrencesAtPositionContains(range, false); | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /// <reference path='fourslash.ts' /> | ||
|
|
||
| ////function f(x = [|super|]) { | ||
| //// [|super|]; | ||
| ////} | ||
| //// | ||
| ////module M { | ||
| //// [|super|]; | ||
| //// function f(x = [|super|]) { | ||
| //// [|super|]; | ||
| //// } | ||
| //// | ||
| //// class A { | ||
| //// } | ||
| //// | ||
| //// class B extends A { | ||
| //// constructor() { | ||
| //// super(); | ||
| //// } | ||
| //// } | ||
| ////} | ||
|
|
||
| test.ranges().forEach(r => { | ||
| goTo.position(r.start); | ||
|
|
||
| verify.occurrencesAtPositionCount(0); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still return undefined :)
you can also make this simpler with just:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for the undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The people have spoken, the
undefinedhas prevailed 😉.