-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Add isDefinition to references #9148
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5a7f746
Add isDefinition to ReferenceEntry
sandersn ac9e617
Test isDefinition
sandersn 792b23e
Make isDefinition required.
sandersn 7bf40c4
Add more isDefinition tests and fix computed property bug
sandersn 102a890
Use `isLiteralComputedPropertyDeclarationName`
sandersn 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
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
8 changes: 8 additions & 0 deletions
8
tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts
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,8 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////var [|{| "isDefinition": true |}f|] = x => x + 1; | ||
////[|{| "isDefinition": false |}f|](12); | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
8 changes: 8 additions & 0 deletions
8
tests/cases/fourslash/getOccurrencesIsDefinitionOfBindingPattern.ts
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,8 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////const { [|{| "isDefinition": true |}x|], y } = { x: 1, y: 2 }; | ||
////const z = [|{| "isDefinition": false |}x|]; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
13 changes: 13 additions & 0 deletions
13
tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts
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,13 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////class [|{| "isDefinition": true |}C|] { | ||
//// n: number; | ||
//// constructor() { | ||
//// this.n = 12; | ||
//// } | ||
////} | ||
////let c = new [|{| "isDefinition": false |}C|](); | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
9 changes: 9 additions & 0 deletions
9
tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts
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,9 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////let o = { ["[|{| "isDefinition": true |}foo|]"]: 12 }; | ||
////let y = o.[|{| "isDefinition": false |}foo|]; | ||
////let z = o['[|{| "isDefinition": false |}foo|]']; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
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,11 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////enum [|{| "isDefinition": true |}E|] { | ||
//// First, | ||
//// Second | ||
////} | ||
////let first = [|{| "isDefinition": false |}E|].First; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
11 changes: 11 additions & 0 deletions
11
tests/cases/fourslash/getOccurrencesIsDefinitionOfExport.ts
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,11 @@ | ||
/// <reference path='fourslash.ts' /> | ||
// @Filename: m.ts | ||
////export var [|{| "isDefinition": true |}x|] = 12; | ||
// @Filename: main.ts | ||
////import { [|{| "isDefinition": true |}x|] } from "./m"; | ||
////const y = [|{| "isDefinition": false |}x|]; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
9 changes: 9 additions & 0 deletions
9
tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts
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,9 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////function [|{| "isDefinition": true |}func|](x: number) { | ||
////} | ||
////[|{| "isDefinition": false |}func|](x) | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
10 changes: 10 additions & 0 deletions
10
tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts
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,10 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////interface [|{| "isDefinition": true |}I|] { | ||
//// p: number; | ||
////} | ||
////let i: [|{| "isDefinition": false |}I|] = { p: 12 }; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
19 changes: 19 additions & 0 deletions
19
tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts
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,19 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////interface [|{| "isDefinition": true |}Numbers|] { | ||
//// p: number; | ||
////} | ||
////interface [|{| "isDefinition": true |}Numbers|] { | ||
//// m: number; | ||
////} | ||
////class [|{| "isDefinition": true |}Numbers|] { | ||
//// f(n: number) { | ||
//// return this.p + this.m + n; | ||
//// } | ||
////} | ||
////let i: [|{| "isDefinition": false |}Numbers|] = new [|{| "isDefinition": false |}Numbers|](); | ||
////let x = i.f(i.p + i.m); | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
10 changes: 10 additions & 0 deletions
10
tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts
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,10 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////namespace [|{| "isDefinition": true |}Numbers|] { | ||
//// export var n = 12; | ||
////} | ||
////let x = [|{| "isDefinition": false |}Numbers|].n + 1; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
8 changes: 8 additions & 0 deletions
8
tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts
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,8 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////let o = { [|{| "isDefinition": true |}1|]: 12 }; | ||
////let y = o[[|{| "isDefinition": false |}1|]]; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
9 changes: 9 additions & 0 deletions
9
tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts
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,9 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////function f([|{| "isDefinition": true |}x|]: number) { | ||
//// return [|{| "isDefinition": false |}x|] + 1 | ||
////} | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
8 changes: 8 additions & 0 deletions
8
tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts
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,8 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////let o = { "[|{| "isDefinition": true |}x|]": 12 }; | ||
////let y = o.[|{| "isDefinition": false |}x|]; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
8 changes: 8 additions & 0 deletions
8
tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts
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,8 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////type [|{| "isDefinition": true |}Alias|]= number; | ||
////let n: [|{| "isDefinition": false |}Alias|] = 12; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
23 changes: 23 additions & 0 deletions
23
tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts
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,23 @@ | ||
/// <reference path='fourslash.ts' /> | ||
////var [|{| "isDefinition": true |}x|] = 0; | ||
////var assignmentRightHandSide = [|{| "isDefinition": false |}x|]; | ||
////var assignmentRightHandSide2 = 1 + [|{| "isDefinition": false |}x|]; | ||
//// | ||
////[|{| "isDefinition": false |}x|] = 1; | ||
////[|{| "isDefinition": false |}x|] = [|{| "isDefinition": false |}x|] + [|{| "isDefinition": false |}x|]; | ||
//// | ||
////[|{| "isDefinition": false |}x|] == 1; | ||
////[|{| "isDefinition": false |}x|] <= 1; | ||
//// | ||
////var preIncrement = ++[|{| "isDefinition": false |}x|]; | ||
////var postIncrement = [|{| "isDefinition": false |}x|]++; | ||
////var preDecrement = --[|{| "isDefinition": false |}x|]; | ||
////var postDecrement = [|{| "isDefinition": false |}x|]--; | ||
//// | ||
////[|{| "isDefinition": false |}x|] += 1; | ||
////[|{| "isDefinition": false |}x|] <<= 1; | ||
var firstRange = test.ranges()[0]; | ||
goTo.position(firstRange.start, firstRange.fileName); | ||
test.ranges().forEach(range => { | ||
verify.referencesAtPositionContains(range, undefined, range.marker.data.isDefinition); | ||
}); |
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.
undefined
otherwise?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.
sorry looking at the code below, it is always set, so why make it optional?
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.
I thought it was necessary for API additions. I'll make it required if that's not the case.