diff --git a/internal/collections/multimap.go b/internal/collections/multimap.go
index 6da7638181..51029e8c0a 100644
--- a/internal/collections/multimap.go
+++ b/internal/collections/multimap.go
@@ -10,6 +10,14 @@ type MultiMap[K comparable, V comparable] struct {
M map[K][]V
}
+func GroupBy[K comparable, V comparable](items []V, groupId func(V) K) *MultiMap[K, V] {
+ m := &MultiMap[K, V]{}
+ for _, item := range items {
+ m.Add(groupId(item), item)
+ }
+ return m
+}
+
func (s *MultiMap[K, V]) Has(key K) bool {
_, ok := s.M[key]
return ok
diff --git a/internal/fourslash/_scripts/convertFourslash.mts b/internal/fourslash/_scripts/convertFourslash.mts
index 02051e5bd7..bdfcf4c50b 100644
--- a/internal/fourslash/_scripts/convertFourslash.mts
+++ b/internal/fourslash/_scripts/convertFourslash.mts
@@ -137,9 +137,16 @@ function parseFourslashStatement(statement: ts.Statement): Cmd[] | undefined {
console.error(`Expected identifiers for namespace and function, got ${namespace.getText()} and ${func.getText()}`);
return undefined;
}
- // `verify.completions(...)`
- if (namespace.text === "verify" && func.text === "completions") {
- return parseVerifyCompletionsArgs(callExpression.arguments);
+ // `verify.(...)`
+ if (namespace.text === "verify") {
+ switch (func.text) {
+ case "completions":
+ // `verify.completions(...)`
+ return parseVerifyCompletionsArgs(callExpression.arguments);
+ case "baselineFindAllReferences":
+ // `verify.baselineFindAllReferences(...)`
+ return [parseBaselineFindAllReferencesArgs(callExpression.arguments)];
+ }
}
// `goTo.marker(...)`
if (namespace.text === "goTo" && func.text === "marker") {
@@ -405,6 +412,27 @@ function parseExpectedCompletionItem(expr: ts.Expression): string | undefined {
return undefined; // Unsupported expression type
}
+function parseBaselineFindAllReferencesArgs(args: readonly ts.Expression[]): VerifyBaselineFindAllReferencesCmd {
+ const newArgs = [];
+ for (const arg of args) {
+ if (ts.isStringLiteral(arg)) {
+ newArgs.push(getGoStringLiteral(arg.text));
+ }
+ else if (arg.getText() === "...test.ranges()") {
+ return {
+ kind: "verifyBaselineFindAllReferences",
+ markers: [],
+ ranges: true,
+ };
+ }
+ }
+
+ return {
+ kind: "verifyBaselineFindAllReferences",
+ markers: newArgs,
+ };
+}
+
function parseKind(expr: ts.Expression): string | undefined {
if (!ts.isStringLiteral(expr)) {
console.error(`Expected string literal for kind, got ${expr.getText()}`);
@@ -530,12 +558,18 @@ interface VerifyCompletionsArgs {
exact?: string;
}
+interface VerifyBaselineFindAllReferencesCmd {
+ kind: "verifyBaselineFindAllReferences";
+ markers: string[];
+ ranges?: boolean;
+}
+
interface GoToMarkerCmd {
kind: "goToMarker";
marker: string;
}
-type Cmd = VerifyCompletionsCmd | GoToMarkerCmd;
+type Cmd = VerifyCompletionsCmd | GoToMarkerCmd | VerifyBaselineFindAllReferencesCmd;
function generateVerifyCompletions({ marker, args, isNewIdentifierLocation }: VerifyCompletionsCmd): string {
let expectedList = "nil";
@@ -560,6 +594,13 @@ function generateVerifyCompletions({ marker, args, isNewIdentifierLocation }: Ve
return `f.VerifyCompletions(t, ${marker}, ${expectedList})`;
}
+function generateBaselineFindAllReferences({ markers, ranges }: VerifyBaselineFindAllReferencesCmd): string {
+ if (ranges || markers.length === 0) {
+ return `f.VerifyBaselineFindAllReferences(t)`;
+ }
+ return `f.VerifyBaselineFindAllReferences(t, ${markers.join(", ")})`;
+}
+
function generateGoToMarker({ marker }: GoToMarkerCmd): string {
return `f.GoToMarker(t, ${marker})`;
}
@@ -568,6 +609,8 @@ function generateCmd(cmd: Cmd): string {
switch (cmd.kind) {
case "verifyCompletions":
return generateVerifyCompletions(cmd as VerifyCompletionsCmd);
+ case "verifyBaselineFindAllReferences":
+ return generateBaselineFindAllReferences(cmd as VerifyBaselineFindAllReferencesCmd);
case "goToMarker":
return generateGoToMarker(cmd as GoToMarkerCmd);
default:
diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go
index c2a5739e47..13dd640a11 100644
--- a/internal/fourslash/fourslash.go
+++ b/internal/fourslash/fourslash.go
@@ -30,6 +30,7 @@ type FourslashTest struct {
id int32
testData *TestData
+ baseline *baselineFromTest
currentCaretPosition lsproto.Position
currentFilename string
@@ -250,16 +251,28 @@ func (f *FourslashTest) GoToMarker(t *testing.T, markerName string) {
if !ok {
t.Fatalf("Marker %s not found", markerName)
}
- f.ensureActiveFile(t, marker.FileName)
+ f.ensureActiveFile(t, marker.fileName)
f.currentCaretPosition = marker.LSPosition
- f.currentFilename = marker.FileName
+ f.currentFilename = marker.fileName
f.lastKnownMarkerName = marker.Name
}
+func (f *FourslashTest) GoToPosAndFile(t *testing.T, pos lsproto.Position, fileName string) {
+ // GoToRangeStart
+ f.ensureActiveFile(t, fileName)
+ f.currentCaretPosition = pos
+ f.currentFilename = fileName
+ // !!! this.selectionEnd = -1
+}
+
func (f *FourslashTest) Markers() []*Marker {
return f.testData.Markers
}
+func (f *FourslashTest) Ranges() []*RangeMarker {
+ return f.testData.Ranges
+}
+
func (f *FourslashTest) ensureActiveFile(t *testing.T, filename string) {
if f.activeFilename != filename {
file := core.Find(f.testData.Files, func(f *TestFileInfo) bool {
@@ -283,6 +296,15 @@ func (f *FourslashTest) openFile(t *testing.T, file *TestFileInfo) {
})
}
+func (f *FourslashTest) currentTextDocumentPositionParams() lsproto.TextDocumentPositionParams {
+ return lsproto.TextDocumentPositionParams{
+ TextDocument: lsproto.TextDocumentIdentifier{
+ Uri: ls.FileNameToDocumentURI(f.currentFilename),
+ },
+ Position: f.currentCaretPosition,
+ }
+}
+
func getLanguageKind(filename string) lsproto.LanguageKind {
if tspath.FileExtensionIsOneOf(
filename,
@@ -357,13 +379,8 @@ func (f *FourslashTest) verifyCompletionsAtMarker(t *testing.T, markerName strin
func (f *FourslashTest) verifyCompletionsWorker(t *testing.T, expected *VerifyCompletionsExpectedList) {
params := &lsproto.CompletionParams{
- TextDocumentPositionParams: lsproto.TextDocumentPositionParams{
- TextDocument: lsproto.TextDocumentIdentifier{
- Uri: ls.FileNameToDocumentURI(f.currentFilename),
- },
- Position: f.currentCaretPosition,
- },
- Context: &lsproto.CompletionContext{},
+ TextDocumentPositionParams: f.currentTextDocumentPositionParams(),
+ Context: &lsproto.CompletionContext{},
}
resMsg := f.sendRequest(t, lsproto.MethodTextDocumentCompletion, params)
if resMsg == nil {
@@ -503,6 +520,54 @@ func assertDeepEqual(t *testing.T, actual any, expected any, prefix string, opts
}
}
+func (f *FourslashTest) VerifyBaselineFindAllReferences(
+ t *testing.T,
+ markers ...string,
+) {
+ // if there are no markers specified, use all ranges
+ var referenceLocations []MarkerOrRange
+ if len(markers) == 0 {
+ referenceLocations = core.Map(f.testData.Ranges, func(r *RangeMarker) MarkerOrRange { return r })
+ } else {
+ referenceLocations = core.Map(markers, func(markerName string) MarkerOrRange {
+ marker, ok := f.testData.MarkerPositions[markerName]
+ if !ok {
+ t.Fatalf("Marker %s not found", markerName)
+ }
+ return marker
+ })
+ }
+
+ if f.baseline != nil {
+ t.Fatalf("Another baseline is already in progress")
+ } else {
+ f.baseline = &baselineFromTest{
+ baseline: &strings.Builder{},
+ testName: t.Name(),
+ ext: ".baseline.jsonc",
+ }
+ }
+
+ for _, markerOrRange := range referenceLocations {
+ // worker in `baselineEachMarkerOrRange`
+ f.GoToPosAndFile(t, markerOrRange.LSPos(), markerOrRange.FileName())
+ params := &lsproto.ReferenceParams{
+ TextDocumentPositionParams: f.currentTextDocumentPositionParams(),
+ Context: &lsproto.ReferenceContext{},
+ }
+ resMsg := f.sendRequest(t, lsproto.MethodTextDocumentReferences, params)
+ if resMsg == nil {
+ t.Fatalf("Nil response received for completion request at marker %s", f.lastKnownMarkerName)
+ }
+ result := resMsg.AsResponse().Result
+ if result, ok := result.([]*lsproto.Location); ok {
+ // !!! TODO verifyFindAllReferences(t, markerOrRange)
+ } else {
+ t.Fatalf("Unexpected response type at marker %s: %v", f.lastKnownMarkerName, result)
+ }
+ }
+}
+
func ptrTo[T any](v T) *T {
return &v
}
diff --git a/internal/fourslash/test_parser.go b/internal/fourslash/test_parser.go
index 1b84be0181..d23e8dbad9 100644
--- a/internal/fourslash/test_parser.go
+++ b/internal/fourslash/test_parser.go
@@ -27,14 +27,35 @@ type RangeMarker struct {
LSRange lsproto.Range
}
+func (r *RangeMarker) LSPos() lsproto.Position {
+ return r.LSRange.Start
+}
+
+func (r *RangeMarker) FileName() string {
+ return r.fileName
+}
+
type Marker struct {
- FileName string
+ fileName string
Position int
LSPosition lsproto.Position
Name string
Data map[string]interface{}
}
+func (m *Marker) LSPos() lsproto.Position {
+ return m.LSPosition
+}
+
+func (m *Marker) FileName() string {
+ return m.fileName
+}
+
+type MarkerOrRange interface {
+ FileName() string
+ LSPos() lsproto.Position
+}
+
type TestData struct {
Files []*TestFileInfo
MarkerPositions map[string]*Marker
@@ -211,8 +232,10 @@ func parseFileContent(fileName string, content string, fileOptions map[string]st
if rangeStart.marker != nil {
closedRange.Marker = rangeStart.marker
} else {
- // RangeMarker is not added to list of markers
- closedRange.Marker = &Marker{FileName: fileName}
+ // A default RangeMarker is not added to list of markers. If the RangeMarker was created by parsing an actual marker within the range
+ // in the test file, then the marker should have been added to the marker list when the marker was parsed.
+ // Similarly, if the RangeMarker has a name, this means that there was a named marker parsed within the range (and has been already included in the marker list)
+ closedRange.Marker = &Marker{fileName: fileName}
}
rangeMarkers = append(rangeMarkers, closedRange)
@@ -269,7 +292,7 @@ func parseFileContent(fileName string, content string, fileOptions map[string]st
// start + 2 to ignore the */, -1 on the end to ignore the * (/ is next)
markerNameText := strings.TrimSpace(content[openMarker.sourcePosition+2 : i-1])
marker := &Marker{
- FileName: fileName,
+ fileName: fileName,
Position: openMarker.position,
Name: markerNameText,
}
@@ -372,7 +395,7 @@ func getObjectMarker(fileName string, location *locationInformation, text string
}
marker := &Marker{
- FileName: fileName,
+ fileName: fileName,
Position: location.position,
Data: markerValue,
}
diff --git a/internal/fourslash/tests/gen/ambientShorthandFindAllRefs_test.go b/internal/fourslash/tests/gen/ambientShorthandFindAllRefs_test.go
new file mode 100644
index 0000000000..80de763eed
--- /dev/null
+++ b/internal/fourslash/tests/gen/ambientShorthandFindAllRefs_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestAmbientShorthandFindAllRefs(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: declarations.d.ts
+declare module "jquery";
+// @Filename: user.ts
+import {/*1*/x} from "jquery";
+// @Filename: user2.ts
+import {/*2*/x} from "jquery";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/constructorFindAllReferences1_test.go b/internal/fourslash/tests/gen/constructorFindAllReferences1_test.go
new file mode 100644
index 0000000000..79bf77e4da
--- /dev/null
+++ b/internal/fourslash/tests/gen/constructorFindAllReferences1_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestConstructorFindAllReferences1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `export class C {
+ /**/public constructor() { }
+ public foo() { }
+}
+
+new C().foo();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/constructorFindAllReferences2_test.go b/internal/fourslash/tests/gen/constructorFindAllReferences2_test.go
new file mode 100644
index 0000000000..9c98352fd9
--- /dev/null
+++ b/internal/fourslash/tests/gen/constructorFindAllReferences2_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestConstructorFindAllReferences2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `export class C {
+ /**/private constructor() { }
+ public foo() { }
+}
+
+new C().foo();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/constructorFindAllReferences3_test.go b/internal/fourslash/tests/gen/constructorFindAllReferences3_test.go
new file mode 100644
index 0000000000..82d393dde4
--- /dev/null
+++ b/internal/fourslash/tests/gen/constructorFindAllReferences3_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestConstructorFindAllReferences3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `export class C {
+ /**/constructor() { }
+ public foo() { }
+}
+
+new C().foo();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/constructorFindAllReferences4_test.go b/internal/fourslash/tests/gen/constructorFindAllReferences4_test.go
new file mode 100644
index 0000000000..35fecd29e4
--- /dev/null
+++ b/internal/fourslash/tests/gen/constructorFindAllReferences4_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestConstructorFindAllReferences4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `export class C {
+ /**/protected constructor() { }
+ public foo() { }
+}
+
+new C().foo();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/esModuleInteropFindAllReferences2_test.go b/internal/fourslash/tests/gen/esModuleInteropFindAllReferences2_test.go
new file mode 100644
index 0000000000..e46c646d19
--- /dev/null
+++ b/internal/fourslash/tests/gen/esModuleInteropFindAllReferences2_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestEsModuleInteropFindAllReferences2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @esModuleInterop: true
+// @Filename: /a.d.ts
+export as namespace abc;
+/*1*/export const /*2*/x: number;
+// @Filename: /b.ts
+import a from "./a";
+a./*3*/x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/esModuleInteropFindAllReferences_test.go b/internal/fourslash/tests/gen/esModuleInteropFindAllReferences_test.go
new file mode 100644
index 0000000000..439e20c8fa
--- /dev/null
+++ b/internal/fourslash/tests/gen/esModuleInteropFindAllReferences_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestEsModuleInteropFindAllReferences(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @esModuleInterop: true
+// @Filename: /abc.d.ts
+declare module "a" {
+ /*1*/export const /*2*/x: number;
+}
+// @Filename: /b.ts
+import a from "a";
+a./*3*/x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/explainFilesNodeNextWithTypesReference_test.go b/internal/fourslash/tests/gen/explainFilesNodeNextWithTypesReference_test.go
new file mode 100644
index 0000000000..e2824dca1d
--- /dev/null
+++ b/internal/fourslash/tests/gen/explainFilesNodeNextWithTypesReference_test.go
@@ -0,0 +1,52 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestExplainFilesNodeNextWithTypesReference(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /node_modules/react-hook-form/package.json
+{
+ "name": "react-hook-form",
+ "main": "dist/index.cjs.js",
+ "module": "dist/index.esm.js",
+ "types": "dist/index.d.ts",
+ "exports": {
+ "./package.json": "./package.json",
+ ".": {
+ "import": "./dist/index.esm.js",
+ "require": "./dist/index.cjs.js",
+ "types": "./dist/index.d.ts"
+ }
+ }
+}
+// @Filename: /node_modules/react-hook-form/dist/index.cjs.js
+module.exports = {};
+// @Filename: /node_modules/react-hook-form/dist/index.esm.js
+export function useForm() {}
+// @Filename: /node_modules/react-hook-form/dist/index.d.ts
+///
+export type Foo = React.Whatever;
+export function useForm(): any;
+// @Filename: /node_modules/react/index.d.ts
+declare namespace JSX {}
+declare namespace React { export interface Whatever {} }
+// @Filename: /tsconfig.json
+{
+ "compilerOptions": {
+ "module": "nodenext",
+ "explainFiles": true
+ }
+ "files": ["./index.ts"]
+}
+// @Filename: /index.ts
+import { useForm } from "react-hook-form";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferPropertyAccessExpressionHeritageClause_test.go b/internal/fourslash/tests/gen/findAllReferPropertyAccessExpressionHeritageClause_test.go
new file mode 100644
index 0000000000..9a75ab2a91
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferPropertyAccessExpressionHeritageClause_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferPropertyAccessExpressionHeritageClause(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class B {}
+function foo() {
+ return {/*1*/B: B};
+}
+class C extends (foo())./*2*/B {}
+class C1 extends foo()./*3*/B {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesDynamicImport1_test.go b/internal/fourslash/tests/gen/findAllReferencesDynamicImport1_test.go
new file mode 100644
index 0000000000..a6637254e1
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesDynamicImport1_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesDynamicImport1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: foo.ts
+export function foo() { return "foo"; }
+/*1*/import("/*2*/./foo")
+/*3*/var x = import("/*4*/./foo")`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesFilteringMappedTypeProperty_test.go b/internal/fourslash/tests/gen/findAllReferencesFilteringMappedTypeProperty_test.go
new file mode 100644
index 0000000000..49fd167376
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesFilteringMappedTypeProperty_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesFilteringMappedTypeProperty(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `const obj = { /*1*/a: 1, b: 2 };
+const filtered: { [P in keyof typeof obj as P extends 'b' ? never : P]: 0; } = { /*2*/a: 0 };
+filtered./*3*/a;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference1_test.go b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference1_test.go
new file mode 100644
index 0000000000..45066ee2b4
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference1_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesFromLinkTagReference1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `enum E {
+ /** {@link /**/A} */
+ A
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference2_test.go b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference2_test.go
new file mode 100644
index 0000000000..c4360783cc
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference2_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesFromLinkTagReference2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+enum E {
+ /** {@link /**/Foo} */
+ Foo
+}
+interface Foo {
+ foo: E.Foo;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference3_test.go b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference3_test.go
new file mode 100644
index 0000000000..07525dcfb6
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference3_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesFromLinkTagReference3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @filename: a.ts
+interface Foo {
+ foo: E.Foo;
+}
+// @Filename: b.ts
+enum E {
+ /** {@link /**/Foo} */
+ Foo
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference4_test.go b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference4_test.go
new file mode 100644
index 0000000000..e8ed96c98e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference4_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesFromLinkTagReference4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `enum E {
+ /** {@link /**/B} */
+ A,
+ B
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference5_test.go b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference5_test.go
new file mode 100644
index 0000000000..3df4070b1f
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesFromLinkTagReference5_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesFromLinkTagReference5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `enum E {
+ /** {@link E./**/A} */
+ A
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesImportMeta_test.go b/internal/fourslash/tests/gen/findAllReferencesImportMeta_test.go
new file mode 100644
index 0000000000..0158bbc86e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesImportMeta_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesImportMeta(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// Haha that's so meta!
+
+let x = import.meta/**/;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesJSDocFunctionNew_test.go b/internal/fourslash/tests/gen/findAllReferencesJSDocFunctionNew_test.go
new file mode 100644
index 0000000000..8eba9cbff8
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesJSDocFunctionNew_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesJSDocFunctionNew(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: Foo.js
+/** @type {function (/*1*/new: string, string): string} */
+var f;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesJSDocFunctionThis_test.go b/internal/fourslash/tests/gen/findAllReferencesJSDocFunctionThis_test.go
new file mode 100644
index 0000000000..b43075c892
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesJSDocFunctionThis_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesJSDocFunctionThis(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: Foo.js
+/** @type {function (this: string, string): string} */
+var f = function (s) { return /*0*/this + s; }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesJsDocTypeLiteral_test.go b/internal/fourslash/tests/gen/findAllReferencesJsDocTypeLiteral_test.go
new file mode 100644
index 0000000000..87a75b947b
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesJsDocTypeLiteral_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesJsDocTypeLiteral(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @checkJs: true
+// @Filename: foo.js
+/**
+ * @param {object} o - very important!
+ * @param {string} o.x - a thing, its ok
+ * @param {number} o.y - another thing
+ * @param {Object} o.nested - very nested
+ * @param {boolean} o.nested./*1*/great - much greatness
+ * @param {number} o.nested.times - twice? probably!??
+ */
+ function f(o) { return o.nested./*2*/great; }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesJsOverloadedFunctionParameter_test.go b/internal/fourslash/tests/gen/findAllReferencesJsOverloadedFunctionParameter_test.go
new file mode 100644
index 0000000000..d5f3537436
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesJsOverloadedFunctionParameter_test.go
@@ -0,0 +1,34 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesJsOverloadedFunctionParameter(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @checkJs: true
+// @Filename: foo.js
+/**
+ * @overload
+ * @param {number} x
+ * @returns {number}
+ *
+ * @overload
+ * @param {string} x
+ * @returns {string}
+ *
+ * @param {unknown} x
+ * @returns {unknown}
+ */
+function foo(x/*1*/) {
+ return x;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesJsRequireDestructuring1_test.go b/internal/fourslash/tests/gen/findAllReferencesJsRequireDestructuring1_test.go
new file mode 100644
index 0000000000..4003bf2968
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesJsRequireDestructuring1_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesJsRequireDestructuring1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @noEmit: true
+// @checkJs: true
+// @Filename: /X.js
+module.exports = { x: 1 };
+// @Filename: /Y.js
+const { /*1*/x: { y } } = require("./X");`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesJsRequireDestructuring_test.go b/internal/fourslash/tests/gen/findAllReferencesJsRequireDestructuring_test.go
new file mode 100644
index 0000000000..2312d73d17
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesJsRequireDestructuring_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesJsRequireDestructuring(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @noEmit: true
+// @checkJs: true
+// @Filename: foo.js
+module.exports = {
+ foo: '1'
+};
+// @Filename: bar.js
+const { /*1*/foo: bar } = require('./foo');`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesLinkTag1_test.go b/internal/fourslash/tests/gen/findAllReferencesLinkTag1_test.go
new file mode 100644
index 0000000000..4f3d88c462
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesLinkTag1_test.go
@@ -0,0 +1,79 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesLinkTag1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class C/*7*/ {
+ m/*1*/() { }
+ n/*2*/ = 1
+ static s/*3*/() { }
+ /**
+ * {@link m}
+ * @see {m}
+ * {@link C.m}
+ * @see {C.m}
+ * {@link C#m}
+ * @see {C#m}
+ * {@link C.prototype.m}
+ * @see {C.prototype.m}
+ */
+ p() { }
+ /**
+ * {@link n}
+ * @see {n}
+ * {@link C.n}
+ * @see {C.n}
+ * {@link C#n}
+ * @see {C#n}
+ * {@link C.prototype.n}
+ * @see {C.prototype.n}
+ */
+ q() { }
+ /**
+ * {@link s}
+ * @see {s}
+ * {@link C.s}
+ * @see {C.s}
+ */
+ r() { }
+}
+
+interface I/*8*/ {
+ a/*4*/()
+ b/*5*/: 1
+ /**
+ * {@link a}
+ * @see {a}
+ * {@link I.a}
+ * @see {I.a}
+ * {@link I#a}
+ * @see {I#a}
+ */
+ c()
+ /**
+ * {@link b}
+ * @see {b}
+ * {@link I.b}
+ * @see {I.b}
+ */
+ d()
+}
+
+function nestor() {
+ /** {@link r2} */
+ function ref() { }
+ /** @see {r2} */
+ function d3() { }
+ function r2/*6*/() { }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesLinkTag2_test.go b/internal/fourslash/tests/gen/findAllReferencesLinkTag2_test.go
new file mode 100644
index 0000000000..e3ee6afd71
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesLinkTag2_test.go
@@ -0,0 +1,42 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesLinkTag2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `namespace NPR/*5*/ {
+ export class Consider/*4*/ {
+ This/*3*/ = class {
+ show/*2*/() { }
+ }
+ m/*1*/() { }
+ }
+ /**
+ * @see {Consider.prototype.m}
+ * {@link Consider#m}
+ * @see {Consider#This#show}
+ * {@link Consider.This.show}
+ * @see {NPR.Consider#This#show}
+ * {@link NPR.Consider.This#show}
+ * @see {NPR.Consider#This.show} # doesn't parse trailing .
+ * @see {NPR.Consider.This.show}
+ */
+ export function ref() { }
+}
+/**
+ * {@link NPR.Consider#This#show hello hello}
+ * {@link NPR.Consider.This#show}
+ * @see {NPR.Consider#This.show} # doesn't parse trailing .
+ * @see {NPR.Consider.This.show}
+ */
+export function outerref() { }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesLinkTag3_test.go b/internal/fourslash/tests/gen/findAllReferencesLinkTag3_test.go
new file mode 100644
index 0000000000..d3e795dcd3
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesLinkTag3_test.go
@@ -0,0 +1,42 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesLinkTag3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `namespace NPR/*5*/ {
+ export class Consider/*4*/ {
+ This/*3*/ = class {
+ show/*2*/() { }
+ }
+ m/*1*/() { }
+ }
+ /**
+ * {@linkcode Consider.prototype.m}
+ * {@linkplain Consider#m}
+ * {@linkcode Consider#This#show}
+ * {@linkplain Consider.This.show}
+ * {@linkcode NPR.Consider#This#show}
+ * {@linkplain NPR.Consider.This#show}
+ * {@linkcode NPR.Consider#This.show} # doesn't parse trailing .
+ * {@linkcode NPR.Consider.This.show}
+ */
+ export function ref() { }
+}
+/**
+ * {@linkplain NPR.Consider#This#show hello hello}
+ * {@linkplain NPR.Consider.This#show}
+ * {@linkcode NPR.Consider#This.show} # doesn't parse trailing .
+ * {@linkcode NPR.Consider.This.show}
+ */
+export function outerref() { }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesNonExistentExportBinding_test.go b/internal/fourslash/tests/gen/findAllReferencesNonExistentExportBinding_test.go
new file mode 100644
index 0000000000..606970923a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesNonExistentExportBinding_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesNonExistentExportBinding(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /tsconfig.json
+ { "compilerOptions": { "module": "commonjs" } }
+// @filename: /bar.ts
+import { Foo/**/ } from "./foo";
+// @filename: /foo.ts
+export { Foo }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesOfConstructor_badOverload_test.go b/internal/fourslash/tests/gen/findAllReferencesOfConstructor_badOverload_test.go
new file mode 100644
index 0000000000..46c30746ef
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesOfConstructor_badOverload_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesOfConstructor_badOverload(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class C {
+ /*1*/constructor(n: number);
+ /*2*/constructor(){}
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesOfConstructor_test.go b/internal/fourslash/tests/gen/findAllReferencesOfConstructor_test.go
new file mode 100644
index 0000000000..ef27ea7925
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesOfConstructor_test.go
@@ -0,0 +1,48 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesOfConstructor(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: a.ts
+export class C {
+ /*0*/constructor(n: number);
+ /*1*/constructor();
+ /*2*/constructor(n?: number){}
+ static f() {
+ this.f();
+ new this();
+ }
+}
+new C();
+const D = C;
+new D();
+// @Filename: b.ts
+import { C } from "./a";
+new C();
+// @Filename: c.ts
+import { C } from "./a";
+class D extends C {
+ constructor() {
+ super();
+ super.method();
+ }
+ method() { super(); }
+}
+class E implements C {
+ constructor() { super(); }
+}
+// @Filename: d.ts
+import * as a from "./a";
+new a.C();
+class d extends a.C { constructor() { super(); }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesOfJsonModule_test.go b/internal/fourslash/tests/gen/findAllReferencesOfJsonModule_test.go
new file mode 100644
index 0000000000..d0c3158d50
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesOfJsonModule_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesOfJsonModule(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @resolveJsonModule: true
+// @module: commonjs
+// @esModuleInterop: true
+// @Filename: /foo.ts
+/*1*/import /*2*/settings from "./settings.json";
+/*3*/settings;
+// @Filename: /settings.json
+ {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesTripleSlash_test.go b/internal/fourslash/tests/gen/findAllReferencesTripleSlash_test.go
new file mode 100644
index 0000000000..eec32bef82
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesTripleSlash_test.go
@@ -0,0 +1,27 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesTripleSlash(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @checkJs: true
+// @Filename: /node_modules/@types/globals/index.d.ts
+declare const someAmbientGlobal: unknown;
+// @Filename: /a.ts
+///
+///
+// @Filename: /b.ts
+console.log("b.ts");
+// @Filename: /c.js
+require("./b");
+require("globals");`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesUmdModuleAsGlobalConst_test.go b/internal/fourslash/tests/gen/findAllReferencesUmdModuleAsGlobalConst_test.go
new file mode 100644
index 0000000000..c0a0b67b70
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesUmdModuleAsGlobalConst_test.go
@@ -0,0 +1,49 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesUmdModuleAsGlobalConst(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /node_modules/@types/three/three-core.d.ts
+export class Vector3 {
+ constructor(x?: number, y?: number, z?: number);
+ x: number;
+ y: number;
+}
+// @Filename: /node_modules/@types/three/index.d.ts
+export * from "./three-core";
+export as namespace /*0*/THREE;
+// @Filename: /typings/global.d.ts
+import * as _THREE from '/*1*/three';
+declare global {
+ const /*2*/THREE: typeof _THREE;
+}
+// @Filename: /src/index.ts
+export const a = {};
+let v = new /*3*/THREE.Vector2();
+// @Filename: /tsconfig.json
+{
+ "compilerOptions": {
+ "esModuleInterop": true,
+ "outDir": "./build/js/",
+ "noImplicitAny": true,
+ "module": "es6",
+ "target": "es6",
+ "allowJs": true,
+ "skipLibCheck": true,
+ "lib": ["es2016", "dom"],
+ "typeRoots": ["node_modules/@types/"],
+ "types": ["three"]
+ },
+ "files": ["/src/index.ts", "typings/global.d.ts"]
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllReferencesUndefined_test.go b/internal/fourslash/tests/gen/findAllReferencesUndefined_test.go
new file mode 100644
index 0000000000..36cbbb2267
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllReferencesUndefined_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllReferencesUndefined(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+/**/undefined;
+
+void undefined;
+// @Filename: /b.ts
+undefined;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsBadImport_test.go b/internal/fourslash/tests/gen/findAllRefsBadImport_test.go
new file mode 100644
index 0000000000..f66312a477
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsBadImport_test.go
@@ -0,0 +1,17 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsBadImport(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `import { /*0*/ab as /*1*/cd } from "doesNotExist";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsCatchClause_test.go b/internal/fourslash/tests/gen/findAllRefsCatchClause_test.go
new file mode 100644
index 0000000000..ab74baf1b9
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsCatchClause_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsCatchClause(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `try { }
+catch (/*1*/err) {
+ /*2*/err;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsClassExpression0_test.go b/internal/fourslash/tests/gen/findAllRefsClassExpression0_test.go
new file mode 100644
index 0000000000..7fad3791f3
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsClassExpression0_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsClassExpression0(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+export = class /*0*/A {
+ m() { /*1*/A; }
+};
+// @Filename: /b.ts
+import /*2*/A = require("./a");
+/*3*/A;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsClassExpression1_test.go b/internal/fourslash/tests/gen/findAllRefsClassExpression1_test.go
new file mode 100644
index 0000000000..67802cafb0
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsClassExpression1_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsClassExpression1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+module.exports = class /*0*/A {};
+// @Filename: /b.js
+import /*1*/A = require("./a");
+/*2*/A;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsClassExpression2_test.go b/internal/fourslash/tests/gen/findAllRefsClassExpression2_test.go
new file mode 100644
index 0000000000..b77f184846
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsClassExpression2_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsClassExpression2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+exports./*0*/A = class {};
+// @Filename: /b.js
+import { /*1*/A } from "./a";
+/*2*/A;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsClassStaticBlocks_test.go b/internal/fourslash/tests/gen/findAllRefsClassStaticBlocks_test.go
new file mode 100644
index 0000000000..00fb8a2839
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsClassStaticBlocks_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsClassStaticBlocks(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class ClassStaticBocks {
+ static x;
+ [|[|/*classStaticBocks1*/static|] {}|]
+ static y;
+ [|[|/*classStaticBocks2*/static|] {}|]
+ static y;
+ [|[|/*classStaticBocks3*/static|] {}|]
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "classStaticBocks1", "classStaticBocks2", "classStaticBocks3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsCommonJsRequire2_test.go b/internal/fourslash/tests/gen/findAllRefsCommonJsRequire2_test.go
new file mode 100644
index 0000000000..d8cdf2d191
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsCommonJsRequire2_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsCommonJsRequire2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+function f() { }
+module.exports.f = f
+// @Filename: /b.js
+const { f } = require('./a')
+/**/f`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsCommonJsRequire3_test.go b/internal/fourslash/tests/gen/findAllRefsCommonJsRequire3_test.go
new file mode 100644
index 0000000000..5b683392eb
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsCommonJsRequire3_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsCommonJsRequire3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+function f() { }
+module.exports = { f }
+// @Filename: /b.js
+const { f } = require('./a')
+/**/f`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsCommonJsRequire_test.go b/internal/fourslash/tests/gen/findAllRefsCommonJsRequire_test.go
new file mode 100644
index 0000000000..03664fd182
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsCommonJsRequire_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsCommonJsRequire(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+function f() { }
+export { f }
+// @Filename: /b.js
+const { f } = require('./a')
+/**/f`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsConstructorFunctions_test.go b/internal/fourslash/tests/gen/findAllRefsConstructorFunctions_test.go
new file mode 100644
index 0000000000..ddb1dafae3
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsConstructorFunctions_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsConstructorFunctions(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+function f() {
+ /*1*/this./*2*/x = 0;
+}
+f.prototype.setX = function() {
+ /*3*/this./*4*/x = 1;
+}
+f.prototype.useX = function() { this./*5*/x; }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsDeclareClass_test.go b/internal/fourslash/tests/gen/findAllRefsDeclareClass_test.go
new file mode 100644
index 0000000000..56f05b8320
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsDeclareClass_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsDeclareClass(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/declare class /*2*/C {
+ static m(): void;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsDefaultImport_test.go b/internal/fourslash/tests/gen/findAllRefsDefaultImport_test.go
new file mode 100644
index 0000000000..5cf4a6c3b4
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsDefaultImport_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsDefaultImport(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+export default function /*0*/a() {}
+// @Filename: /b.ts
+import /*1*/a, * as ns from "./a";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsDefinition_test.go b/internal/fourslash/tests/gen/findAllRefsDefinition_test.go
new file mode 100644
index 0000000000..7ad8d39066
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsDefinition_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsDefinition(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `const /*1*/x = 0;
+/*2*/x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsDestructureGeneric_test.go b/internal/fourslash/tests/gen/findAllRefsDestructureGeneric_test.go
new file mode 100644
index 0000000000..aef26d1b36
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsDestructureGeneric_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsDestructureGeneric(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ /*0*/x: boolean;
+}
+declare const i: I;
+const { /*1*/x } = i;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsDestructureGetter_test.go b/internal/fourslash/tests/gen/findAllRefsDestructureGetter_test.go
new file mode 100644
index 0000000000..49e6de3ace
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsDestructureGetter_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsDestructureGetter(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Test {
+ get /*x0*/x() { return 0; }
+
+ set /*y0*/y(a: number) {}
+}
+const { /*x1*/x, /*y1*/y } = new Test();
+/*x2*/x; /*y2*/y;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "x0", "x1", "x2", "y0", "y1", "y2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsEnumAsNamespace_test.go b/internal/fourslash/tests/gen/findAllRefsEnumAsNamespace_test.go
new file mode 100644
index 0000000000..54d139f812
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsEnumAsNamespace_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsEnumAsNamespace(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/enum /*2*/E { A }
+let e: /*3*/E.A;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsEnumMember_test.go b/internal/fourslash/tests/gen/findAllRefsEnumMember_test.go
new file mode 100644
index 0000000000..571021c990
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsEnumMember_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsEnumMember(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `enum E { /*1*/A, B }
+const e: E./*2*/A = E./*3*/A;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsExportConstEqualToClass_test.go b/internal/fourslash/tests/gen/findAllRefsExportConstEqualToClass_test.go
new file mode 100644
index 0000000000..ef76be32c1
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsExportConstEqualToClass_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsExportConstEqualToClass(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+class C {}
+export const /*0*/D = C;
+// @Filename: /b.ts
+import { /*1*/D } from "./a";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsExportDefaultClassConstructor_test.go b/internal/fourslash/tests/gen/findAllRefsExportDefaultClassConstructor_test.go
new file mode 100644
index 0000000000..a47f3abc59
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsExportDefaultClassConstructor_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsExportDefaultClassConstructor(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `export default class {
+ /*1*/constructor() {}
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsExportEquals_test.go b/internal/fourslash/tests/gen/findAllRefsExportEquals_test.go
new file mode 100644
index 0000000000..56070c7f4e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsExportEquals_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsExportEquals(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+type /*0*/T = number;
+/*1*/export = /*2*/T;
+// @Filename: /b.ts
+import /*3*/T = require("/*4*/./a");`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsExportNotAtTopLevel_test.go b/internal/fourslash/tests/gen/findAllRefsExportNotAtTopLevel_test.go
new file mode 100644
index 0000000000..cfd0178704
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsExportNotAtTopLevel_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsExportNotAtTopLevel(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `{
+ /*1*/export const /*2*/x = 0;
+ /*3*/x;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForComputedProperties2_test.go b/internal/fourslash/tests/gen/findAllRefsForComputedProperties2_test.go
new file mode 100644
index 0000000000..ba482ed010
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForComputedProperties2_test.go
@@ -0,0 +1,27 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForComputedProperties2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ [/*1*/42](): void;
+}
+
+class C implements I {
+ [/*2*/42]: any;
+}
+
+var x: I = {
+ ["/*3*/42"]: function () { }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForComputedProperties_test.go b/internal/fourslash/tests/gen/findAllRefsForComputedProperties_test.go
new file mode 100644
index 0000000000..4e7d6ac84b
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForComputedProperties_test.go
@@ -0,0 +1,27 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForComputedProperties(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ ["/*0*/prop1"]: () => void;
+}
+
+class C implements I {
+ ["/*1*/prop1"]: any;
+}
+
+var x: I = {
+ ["/*2*/prop1"]: function () { },
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultExport01_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultExport01_test.go
new file mode 100644
index 0000000000..c4c2838ec0
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForDefaultExport01_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForDefaultExport01(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/export default class /*2*/DefaultExportedClass {
+}
+
+var x: /*3*/DefaultExportedClass;
+
+var y = new /*4*/DefaultExportedClass;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultExport02_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultExport02_test.go
new file mode 100644
index 0000000000..6e7b109f72
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForDefaultExport02_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForDefaultExport02(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/export default function /*2*/DefaultExportedFunction() {
+ return /*3*/DefaultExportedFunction;
+}
+
+var x: typeof /*4*/DefaultExportedFunction;
+
+var y = /*5*/DefaultExportedFunction();
+
+/*6*/namespace /*7*/DefaultExportedFunction {
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultExport03_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultExport03_test.go
new file mode 100644
index 0000000000..85578f9b73
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForDefaultExport03_test.go
@@ -0,0 +1,29 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForDefaultExport03(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/function /*2*/f() {
+ return 100;
+}
+
+/*3*/export default /*4*/f;
+
+var x: typeof /*5*/f;
+
+var y = /*6*/f();
+
+/*7*/namespace /*8*/f {
+ var local = 100;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultExport04_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultExport04_test.go
new file mode 100644
index 0000000000..6d4ffd4d02
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForDefaultExport04_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForDefaultExport04(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+const /*0*/a = 0;
+export /*1*/default /*2*/a;
+// @Filename: /b.ts
+import /*3*/a from "./a";
+/*4*/a;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "2", "1", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultExport09_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultExport09_test.go
new file mode 100644
index 0000000000..768bf83abb
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForDefaultExport09_test.go
@@ -0,0 +1,43 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForDefaultExport09(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @filename: /tsconfig.json
+{
+ "compilerOptions": {
+ "target": "esnext",
+ "strict": true,
+ "outDir": "./out",
+ "allowSyntheticDefaultImports": true
+ }
+}
+// @filename: /a.js
+module.exports = [];
+// @filename: /b.js
+module.exports = 1;
+// @filename: /c.ts
+export = [];
+// @filename: /d.ts
+export = 1;
+// @filename: /foo.ts
+import * as /*0*/a from "./a.js"
+import /*1*/aDefault from "./a.js"
+import * as /*2*/b from "./b.js"
+import /*3*/bDefault from "./b.js"
+
+import * as /*4*/c from "./c"
+import /*5*/cDefault from "./c"
+import * as /*6*/d from "./d"
+import /*7*/dDefault from "./d"`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3", "4", "5", "6", "7")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultExport_anonymous_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultExport_anonymous_test.go
new file mode 100644
index 0000000000..ce2bdf10e3
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForDefaultExport_anonymous_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForDefaultExport_anonymous(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+export /*1*/default 1;
+// @Filename: /b.ts
+import a from "./a";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultExport_reExport_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultExport_reExport_test.go
new file mode 100644
index 0000000000..e7bbb58786
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForDefaultExport_reExport_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForDefaultExport_reExport(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /export.ts
+const /*0*/foo = 1;
+export default /*1*/foo;
+// @Filename: /re-export.ts
+export { /*2*/default } from "./export";
+// @Filename: /re-export-dep.ts
+import /*3*/fooDefault from "./re-export";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForDefaultKeyword_test.go b/internal/fourslash/tests/gen/findAllRefsForDefaultKeyword_test.go
new file mode 100644
index 0000000000..b51c89b4d3
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForDefaultKeyword_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForDefaultKeyword(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @noLib: true
+function f(value: string, /*1*/default: string) {}
+
+const /*2*/default = 1;
+
+function /*3*/default() {}
+
+class /*4*/default {}
+
+const foo = {
+ /*5*/default: 1
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForFunctionExpression01_test.go b/internal/fourslash/tests/gen/findAllRefsForFunctionExpression01_test.go
new file mode 100644
index 0000000000..66e6fe3155
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForFunctionExpression01_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForFunctionExpression01(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: file1.ts
+var foo = /*1*/function /*2*/foo(a = /*3*/foo(), b = () => /*4*/foo) {
+ /*5*/foo(/*6*/foo, /*7*/foo);
+}
+// @Filename: file2.ts
+///
+foo();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForImportCallType_test.go b/internal/fourslash/tests/gen/findAllRefsForImportCallType_test.go
new file mode 100644
index 0000000000..710406adba
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForImportCallType_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForImportCallType(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /app.ts
+export function he/**/llo() {};
+// @Filename: /re-export.ts
+export type app = typeof import("./app")
+// @Filename: /indirect-use.ts
+import type { app } from "./re-export";
+declare const app: app
+app.hello();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForImportCall_test.go b/internal/fourslash/tests/gen/findAllRefsForImportCall_test.go
new file mode 100644
index 0000000000..2249e2d7a2
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForImportCall_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForImportCall(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /app.ts
+export function he/**/llo() {};
+// @Filename: /re-export.ts
+export const services = { app: setup(() => import('./app')) }
+function setup(importee: () => Promise): T { return {} as any }
+// @Filename: /indirect-use.ts
+import("./re-export").then(mod => mod.services.app.hello());
+// @Filename: /direct-use.ts
+async function main() {
+ const mod = await import("./app")
+ mod.hello();
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForMappedType_test.go b/internal/fourslash/tests/gen/findAllRefsForMappedType_test.go
new file mode 100644
index 0000000000..4045078336
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForMappedType_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForMappedType(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface T { /*1*/a: number };
+type U = { [K in keyof T]: string };
+type V = { [K in keyof U]: boolean };
+const u: U = { a: "" }
+const v: V = { a: true }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForObjectLiteralProperties_test.go b/internal/fourslash/tests/gen/findAllRefsForObjectLiteralProperties_test.go
new file mode 100644
index 0000000000..611d1a08e8
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForObjectLiteralProperties_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForObjectLiteralProperties(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var x = {
+ /*1*/property: {}
+};
+
+x./*2*/property;
+
+/*3*/let {/*4*/property: pVar} = x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForObjectSpread_test.go b/internal/fourslash/tests/gen/findAllRefsForObjectSpread_test.go
new file mode 100644
index 0000000000..f8ba47b3b5
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForObjectSpread_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForObjectSpread(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface A1 { readonly /*0*/a: string };
+interface A2 { /*1*/a?: number };
+let a1: A1;
+let a2: A2;
+let a12 = { ...a1, ...a2 };
+a12./*2*/a;
+a1./*3*/a;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForRest_test.go b/internal/fourslash/tests/gen/findAllRefsForRest_test.go
new file mode 100644
index 0000000000..971a4eed80
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForRest_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForRest(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface Gen {
+ x: number
+ /*1*/parent: Gen;
+ millennial: string;
+}
+let t: Gen;
+var { x, ...rest } = t;
+rest./*2*/parent;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForStaticInstanceMethodInheritance_test.go b/internal/fourslash/tests/gen/findAllRefsForStaticInstanceMethodInheritance_test.go
new file mode 100644
index 0000000000..83ab0d73e0
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForStaticInstanceMethodInheritance_test.go
@@ -0,0 +1,37 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForStaticInstanceMethodInheritance(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class X{
+ /*0*/foo(): void{}
+}
+
+class Y extends X{
+ static /*1*/foo(): void{}
+}
+
+class Z extends Y{
+ static /*2*/foo(): void{}
+ /*3*/foo(): void{}
+}
+
+const x = new X();
+const y = new Y();
+const z = new Z();
+x.foo();
+y.foo();
+z.foo();
+Y.foo();
+Z.foo();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForStaticInstancePropertyInheritance_test.go b/internal/fourslash/tests/gen/findAllRefsForStaticInstancePropertyInheritance_test.go
new file mode 100644
index 0000000000..54889cca8e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForStaticInstancePropertyInheritance_test.go
@@ -0,0 +1,37 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForStaticInstancePropertyInheritance(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class X{
+ /*0*/foo:any
+}
+
+class Y extends X{
+ static /*1*/foo:any
+}
+
+class Z extends Y{
+ static /*2*/foo:any
+ /*3*/foo:any
+}
+
+const x = new X();
+const y = new Y();
+const z = new Z();
+x./*4*/foo;
+y./*5*/foo;
+z./*6*/foo;
+Y./*7*/foo;
+Z./*8*/foo;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3", "4", "5", "6", "7", "8")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForStringLiteralTypes_test.go b/internal/fourslash/tests/gen/findAllRefsForStringLiteralTypes_test.go
new file mode 100644
index 0000000000..8fb7209b6e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForStringLiteralTypes_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForStringLiteralTypes(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `type Options = "/*1*/option 1" | "option 2";
+let myOption: Options = "/*2*/option 1";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForStringLiteral_test.go b/internal/fourslash/tests/gen/findAllRefsForStringLiteral_test.go
new file mode 100644
index 0000000000..b38f4a58c5
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForStringLiteral_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForStringLiteral(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @filename: /a.ts
+interface Foo {
+ property: /**/"foo";
+}
+/**
+ * @type {{ property: "foo"}}
+ */
+const obj: Foo = {
+ property: "foo",
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForUMDModuleAlias1_test.go b/internal/fourslash/tests/gen/findAllRefsForUMDModuleAlias1_test.go
new file mode 100644
index 0000000000..71dba41593
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForUMDModuleAlias1_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForUMDModuleAlias1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: 0.d.ts
+export function doThing(): string;
+export function doTheOtherThing(): void;
+/*1*/export as namespace /*2*/myLib;
+// @Filename: 1.ts
+///
+/*3*/myLib.doThing();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForVariableInExtendsClause01_test.go b/internal/fourslash/tests/gen/findAllRefsForVariableInExtendsClause01_test.go
new file mode 100644
index 0000000000..00010a6189
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForVariableInExtendsClause01_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForVariableInExtendsClause01(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/var /*2*/Base = class { };
+class C extends /*3*/Base { }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForVariableInExtendsClause02_test.go b/internal/fourslash/tests/gen/findAllRefsForVariableInExtendsClause02_test.go
new file mode 100644
index 0000000000..47debbc4e2
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForVariableInExtendsClause02_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForVariableInExtendsClause02(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/interface /*2*/Base { }
+namespace n {
+ var Base = class { };
+ interface I extends /*3*/Base { }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsForVariableInImplementsClause01_test.go b/internal/fourslash/tests/gen/findAllRefsForVariableInImplementsClause01_test.go
new file mode 100644
index 0000000000..c0be3ee14a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsForVariableInImplementsClause01_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsForVariableInImplementsClause01(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var Base = class { };
+class C extends Base implements /**/Base { }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsGlobalThisKeywordInModule_test.go b/internal/fourslash/tests/gen/findAllRefsGlobalThisKeywordInModule_test.go
new file mode 100644
index 0000000000..e402507300
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsGlobalThisKeywordInModule_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsGlobalThisKeywordInModule(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @noLib: true
+/*1*/this;
+export const c = 1;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsImportEquals_test.go b/internal/fourslash/tests/gen/findAllRefsImportEquals_test.go
new file mode 100644
index 0000000000..6d03e7b613
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsImportEquals_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsImportEquals(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `import j = N./**/q;
+namespace N { export const q = 0; }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsImportType_test.go b/internal/fourslash/tests/gen/findAllRefsImportType_test.go
new file mode 100644
index 0000000000..0fd25c7a9c
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsImportType_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsImportType(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+module.exports = 0;
+/*1*/export type /*2*/N = number;
+// @Filename: /b.js
+type T = import("./a")./*3*/N;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInClassExpression_test.go b/internal/fourslash/tests/gen/findAllRefsInClassExpression_test.go
new file mode 100644
index 0000000000..3dd4551ee9
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInClassExpression_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInClassExpression(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I { /*0*/boom(): void; }
+new class C implements I {
+ /*1*/boom(){}
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsIndexedAccessTypes_test.go b/internal/fourslash/tests/gen/findAllRefsIndexedAccessTypes_test.go
new file mode 100644
index 0000000000..b80e51a3d2
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsIndexedAccessTypes_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsIndexedAccessTypes(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ /*1*/0: number;
+ /*2*/s: string;
+}
+interface J {
+ a: I[/*3*/0],
+ b: I["/*4*/s"],
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInheritedProperties1_test.go b/internal/fourslash/tests/gen/findAllRefsInheritedProperties1_test.go
new file mode 100644
index 0000000000..217a55284e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInheritedProperties1_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInheritedProperties1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` class class1 extends class1 {
+ /*1*/doStuff() { }
+ /*2*/propName: string;
+ }
+
+ var v: class1;
+ v./*3*/doStuff();
+ v./*4*/propName;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInheritedProperties2_test.go b/internal/fourslash/tests/gen/findAllRefsInheritedProperties2_test.go
new file mode 100644
index 0000000000..deb24b7092
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInheritedProperties2_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInheritedProperties2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` interface interface1 extends interface1 {
+ /*1*/doStuff(): void; // r0
+ /*2*/propName: string; // r1
+ }
+
+ var v: interface1;
+ v./*3*/doStuff(); // r2
+ v./*4*/propName; // r3`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInheritedProperties3_test.go b/internal/fourslash/tests/gen/findAllRefsInheritedProperties3_test.go
new file mode 100644
index 0000000000..dfd454127b
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInheritedProperties3_test.go
@@ -0,0 +1,32 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInheritedProperties3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` class class1 extends class1 {
+ [|/*0*/doStuff() { }|]
+ [|/*1*/propName: string;|]
+ }
+ interface interface1 extends interface1 {
+ [|/*2*/doStuff(): void;|]
+ [|/*3*/propName: string;|]
+ }
+ class class2 extends class1 implements interface1 {
+ [|/*4*/doStuff() { }|]
+ [|/*5*/propName: string;|]
+ }
+
+ var v: class2;
+ v./*6*/doStuff();
+ v./*7*/propName;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3", "4", "6", "5", "7")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInheritedProperties4_test.go b/internal/fourslash/tests/gen/findAllRefsInheritedProperties4_test.go
new file mode 100644
index 0000000000..dd73c27523
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInheritedProperties4_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInheritedProperties4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` interface C extends D {
+ /*0*/prop0: string;
+ /*1*/prop1: number;
+ }
+
+ interface D extends C {
+ /*2*/prop0: string;
+ }
+
+ var d: D;
+ d./*3*/prop0;
+ d./*4*/prop1;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "2", "3", "1", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInheritedProperties5_test.go b/internal/fourslash/tests/gen/findAllRefsInheritedProperties5_test.go
new file mode 100644
index 0000000000..5bc90a3d9a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInheritedProperties5_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInheritedProperties5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` class C extends D {
+ /*0*/prop0: string;
+ /*1*/prop1: number;
+ }
+
+ class D extends C {
+ /*2*/prop0: string;
+ }
+
+ var d: D;
+ d./*3*/prop0;
+ d./*4*/prop1;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInsideTemplates1_test.go b/internal/fourslash/tests/gen/findAllRefsInsideTemplates1_test.go
new file mode 100644
index 0000000000..8ee15f418f
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInsideTemplates1_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInsideTemplates1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/var /*2*/x = 10;
+var y = ` + "`" + `${ /*3*/x } ${ /*4*/x }` + "`" + ``
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInsideTemplates2_test.go b/internal/fourslash/tests/gen/findAllRefsInsideTemplates2_test.go
new file mode 100644
index 0000000000..104197f240
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInsideTemplates2_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInsideTemplates2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/function /*2*/f(...rest: any[]) { }
+/*3*/f ` + "`" + `${ /*4*/f } ${ /*5*/f }` + "`" + ``
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsInsideWithBlock_test.go b/internal/fourslash/tests/gen/findAllRefsInsideWithBlock_test.go
new file mode 100644
index 0000000000..5de5e03522
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsInsideWithBlock_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsInsideWithBlock(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/var /*2*/x = 0;
+
+with ({}) {
+ var y = x; // Reference of x here should not be picked
+ y++; // also reference for y should be ignored
+}
+
+/*3*/x = /*4*/x + 1;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsIsDefinition_test.go b/internal/fourslash/tests/gen/findAllRefsIsDefinition_test.go
new file mode 100644
index 0000000000..e4838b2ae9
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsIsDefinition_test.go
@@ -0,0 +1,41 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsIsDefinition(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `declare function foo(a: number): number;
+declare function foo(a: string): string;
+declare function foo/*1*/(a: string | number): string | number;
+
+function foon(a: number): number;
+function foon(a: string): string;
+function foon/*2*/(a: string | number): string | number {
+ return a
+}
+
+foo; foon;
+
+export const bar/*3*/ = 123;
+console.log({ bar });
+
+interface IFoo {
+ foo/*4*/(): void;
+}
+class Foo implements IFoo {
+ constructor(n: number)
+ constructor()
+ /*5*/constructor(n: number?) { }
+ foo/*6*/(): void { }
+ static init() { return new this() }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocImportTag2_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag2_test.go
new file mode 100644
index 0000000000..aa70162606
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag2_test.go
@@ -0,0 +1,42 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocImportTag2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @checkJs: true
+// @Filename: /component.js
+export default class Component {
+ constructor() {
+ this.id_ = Math.random();
+ }
+ id() {
+ return this.id_;
+ }
+}
+// @Filename: /spatial-navigation.js
+/** @import Component from './component.js' */
+
+export class SpatialNavigation {
+ /**
+ * @param {Component} component
+ */
+ add(component) {}
+}
+// @Filename: /player.js
+import Component from './component.js';
+
+/**
+ * @extends Component/*1*/
+ */
+export class Player extends Component {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocImportTag3_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag3_test.go
new file mode 100644
index 0000000000..966773ac8a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag3_test.go
@@ -0,0 +1,42 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocImportTag3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @checkJs: true
+// @Filename: /component.js
+export class Component {
+ constructor() {
+ this.id_ = Math.random();
+ }
+ id() {
+ return this.id_;
+ }
+}
+// @Filename: /spatial-navigation.js
+/** @import { Component } from './component.js' */
+
+export class SpatialNavigation {
+ /**
+ * @param {Component} component
+ */
+ add(component) {}
+}
+// @Filename: /player.js
+import { Component } from './component.js';
+
+/**
+ * @extends Component/*1*/
+ */
+export class Player extends Component {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocImportTag4_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag4_test.go
new file mode 100644
index 0000000000..2a067d5246
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag4_test.go
@@ -0,0 +1,42 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocImportTag4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @checkJs: true
+// @Filename: /component.js
+export class Component {
+ constructor() {
+ this.id_ = Math.random();
+ }
+ id() {
+ return this.id_;
+ }
+}
+// @Filename: /spatial-navigation.js
+/** @import * as C from './component.js' */
+
+export class SpatialNavigation {
+ /**
+ * @param {C.Component} component
+ */
+ add(component) {}
+}
+// @Filename: /player.js
+import * as C from './component.js';
+
+/**
+ * @extends C/*1*/.Component
+ */
+export class Player extends Component {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocImportTag5_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag5_test.go
new file mode 100644
index 0000000000..06f4862545
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag5_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocImportTag5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @checkJs: true
+// @Filename: /a.js
+export default function /*0*/a() {}
+// @Filename: /b.js
+/** @import /*1*/a, * as ns from "./a" */`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocImportTag_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag_test.go
new file mode 100644
index 0000000000..0608b12346
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocImportTag_test.go
@@ -0,0 +1,29 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocImportTag(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJS: true
+// @checkJs: true
+// @Filename: /b.ts
+export interface A { }
+// @Filename: /a.js
+/**
+ * @import { A } from "./b";
+ */
+
+/**
+ * @param { [|A/**/|] } a
+ */
+function f(a) {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_class_js_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_class_js_test.go
new file mode 100644
index 0000000000..711befea3e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_class_js_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocTemplateTag_class_js(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+/** @template /*1*/T */
+class C {
+ constructor() {
+ /** @type {/*2*/T} */
+ this.x = null;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_class_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_class_test.go
new file mode 100644
index 0000000000..7fb0d8f215
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_class_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocTemplateTag_class(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/** @template /*1*/T */
+class C*2*/T> {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_function_js_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_function_js_test.go
new file mode 100644
index 0000000000..f84dd562aa
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_function_js_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocTemplateTag_function_js(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+/**
+ * @template /*1*/T
+ * @return {/*2*/T}
+ */
+function f() {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_function_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_function_test.go
new file mode 100644
index 0000000000..c438850de6
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocTemplateTag_function_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocTemplateTag_function(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/** @template /*1*/T */
+function f*2*/T>() {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocTypeDef_js_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocTypeDef_js_test.go
new file mode 100644
index 0000000000..1dfa6b2575
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocTypeDef_js_test.go
@@ -0,0 +1,29 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocTypeDef_js(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+/** /*1*/@typedef {number} /*2*/T */
+
+/**
+ * @return {/*3*/T}
+ */
+function f(obj) { return 0; }
+
+/**
+ * @return {/*4*/T}
+ */
+function f2(obj) { return 0; }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsDocTypeDef_test.go b/internal/fourslash/tests/gen/findAllRefsJsDocTypeDef_test.go
new file mode 100644
index 0000000000..d9a9b5de6f
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsDocTypeDef_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsDocTypeDef(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/** @typedef {Object} /*0*/T */
+function foo() {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsThisPropertyAssignment2_test.go b/internal/fourslash/tests/gen/findAllRefsJsThisPropertyAssignment2_test.go
new file mode 100644
index 0000000000..c2d222384d
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsThisPropertyAssignment2_test.go
@@ -0,0 +1,40 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsThisPropertyAssignment2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @noImplicitThis: true
+// @Filename: infer.d.ts
+export declare function infer(o: { m: Record } & ThisType<{ x: number }>): void;
+// @Filename: a.js
+import { infer } from "./infer";
+infer({
+ m: {
+ initData() {
+ this.x = 1;
+ this./*1*/x;
+ },
+ }
+});
+// @Filename: b.ts
+import { infer } from "./infer";
+infer({
+ m: {
+ initData() {
+ this.x = 1;
+ this./*2*/x;
+ },
+ }
+});`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsJsThisPropertyAssignment_test.go b/internal/fourslash/tests/gen/findAllRefsJsThisPropertyAssignment_test.go
new file mode 100644
index 0000000000..14d0eb2438
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsJsThisPropertyAssignment_test.go
@@ -0,0 +1,40 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsJsThisPropertyAssignment(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @noImplicitThis: true
+// @Filename: infer.d.ts
+export declare function infer(o: { m(): void } & ThisType<{ x: number }>): void;
+// @Filename: a.js
+import { infer } from "./infer";
+infer({
+ m() {
+ this.x = 1;
+ this./*1*/x;
+ },
+});
+// @Filename: b.js
+/**
+ * @template T
+ * @param {{m(): void} & ThisType<{x: number}>} o
+ */
+function infer(o) {}
+infer({
+ m() {
+ this.x = 2;
+ this./*2*/x;
+ },
+});`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsMappedType_nonHomomorphic_test.go b/internal/fourslash/tests/gen/findAllRefsMappedType_nonHomomorphic_test.go
new file mode 100644
index 0000000000..c6adb857ef
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsMappedType_nonHomomorphic_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsMappedType_nonHomomorphic(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @strict: true
+function f(x: { [K in "m"]: number; }) {
+ x./*1*/m;
+ x./*2*/m
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsMappedType_test.go b/internal/fourslash/tests/gen/findAllRefsMappedType_test.go
new file mode 100644
index 0000000000..4407a74a6f
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsMappedType_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsMappedType(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface T { /*1*/a: number; }
+type U = { readonly [K in keyof T]?: string };
+declare const t: T;
+t./*2*/a;
+declare const u: U;
+u./*3*/a;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsMissingModulesOverlappingSpecifiers_test.go b/internal/fourslash/tests/gen/findAllRefsMissingModulesOverlappingSpecifiers_test.go
new file mode 100644
index 0000000000..1ebea78f87
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsMissingModulesOverlappingSpecifiers_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsMissingModulesOverlappingSpecifiers(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// https://github.com/microsoft/TypeScript/issues/5551
+import { resolve/*0*/ as resolveUrl } from "idontcare";
+import { resolve/*1*/ } from "whatever";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsModuleDotExports_test.go b/internal/fourslash/tests/gen/findAllRefsModuleDotExports_test.go
new file mode 100644
index 0000000000..97fa6533ec
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsModuleDotExports_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsModuleDotExports(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+/*1*/const b = require("/*2*/./b");
+// @Filename: /b.js
+/*3*/module.exports = 0;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsNoImportClause_test.go b/internal/fourslash/tests/gen/findAllRefsNoImportClause_test.go
new file mode 100644
index 0000000000..b7e98d676c
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsNoImportClause_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsNoImportClause(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+/*1*/export const /*2*/x = 0;
+// @Filename: /b.ts
+import "./a";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsNoSubstitutionTemplateLiteralNoCrash1_test.go b/internal/fourslash/tests/gen/findAllRefsNoSubstitutionTemplateLiteralNoCrash1_test.go
new file mode 100644
index 0000000000..29e4b95f39
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsNoSubstitutionTemplateLiteralNoCrash1_test.go
@@ -0,0 +1,17 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsNoSubstitutionTemplateLiteralNoCrash1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `type Test = ` + "`" + `T/*1*/` + "`" + `;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsNonModule_test.go b/internal/fourslash/tests/gen/findAllRefsNonModule_test.go
new file mode 100644
index 0000000000..00b5bedb3d
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsNonModule_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsNonModule(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @checkJs: true
+// @Filename: /script.ts
+console.log("I'm a script!");
+// @Filename: /import.ts
+import "./script/*1*/";
+// @Filename: /require.js
+require("./script/*2*/");
+console.log("./script/*3*/");
+// @Filename: /tripleSlash.ts
+///
+// @Filename: /stringLiteral.ts
+console.log("./script");`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsNonexistentPropertyNoCrash1_test.go b/internal/fourslash/tests/gen/findAllRefsNonexistentPropertyNoCrash1_test.go
new file mode 100644
index 0000000000..d7b93361ba
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsNonexistentPropertyNoCrash1_test.go
@@ -0,0 +1,61 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsNonexistentPropertyNoCrash1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @strict: true
+// @allowJs: true
+// @checkJs: true
+// @filename: ./src/parser-input.js
+export default () => {
+ let input;
+
+ const parserInput = {};
+
+ parserInput.currentChar = () => input.charAt(parserInput.i);
+
+ parserInput.end = () => {
+ const isFinished = parserInput.i >= input.length;
+
+ return {
+ isFinished,
+ furthest: parserInput.i,
+ };
+ };
+
+ return parserInput;
+};
+// @filename: ./src/parser.js
+import getParserInput from "./parser-input";
+
+const Parser = function Parser(context, imports, fileInfo, currentIndex) {
+ currentIndex = currentIndex || 0;
+ let parsers;
+ const parserInput = getParserInput();
+
+ return {
+ parserInput,
+ parsers: (parsers = {
+ variable: function () {
+ let name;
+
+ if (parserInput.currentChar() === "/*1*/@") {
+ return name[1];
+ }
+ },
+ }),
+ };
+};
+
+export default Parser;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName01_test.go b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName01_test.go
new file mode 100644
index 0000000000..9597d43716
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName01_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsObjectBindingElementPropertyName01(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ /*1*/property1: number;
+ property2: string;
+}
+
+var foo: I;
+/*2*/var { /*3*/property1: prop1 } = foo;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName02_test.go b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName02_test.go
new file mode 100644
index 0000000000..eb786e6c17
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName02_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsObjectBindingElementPropertyName02(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ /*1*/property1: number;
+ property2: string;
+}
+
+var foo: I;
+/*2*/var { /*3*/property1: {} } = foo;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName03_test.go b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName03_test.go
new file mode 100644
index 0000000000..ba04d40b18
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName03_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsObjectBindingElementPropertyName03(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ /*1*/property1: number;
+ property2: string;
+}
+
+var foo: I;
+var [ { property1: prop1 }, { /*2*/property1, property2 } ] = [foo, foo];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName04_test.go b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName04_test.go
new file mode 100644
index 0000000000..7c3806cf9a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName04_test.go
@@ -0,0 +1,27 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsObjectBindingElementPropertyName04(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ /*0*/property1: number;
+ property2: string;
+}
+
+function f({ /*1*/property1: p1 }: I,
+ { /*2*/property1 }: I,
+ { property1: p2 }) {
+
+ return /*3*/property1 + 1;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName05_test.go b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName05_test.go
new file mode 100644
index 0000000000..aa13508472
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName05_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsObjectBindingElementPropertyName05(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ property1: number;
+ property2: string;
+}
+
+function f({ /**/property1: p }, { property1 }) {
+ let x = property1;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName06_test.go b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName06_test.go
new file mode 100644
index 0000000000..6a10bc3040
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName06_test.go
@@ -0,0 +1,31 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsObjectBindingElementPropertyName06(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ /*0*/property1: number;
+ property2: string;
+}
+
+var elems: I[];
+for (let { /*1*/property1: p } of elems) {
+}
+for (let { /*2*/property1 } of elems) {
+}
+for (var { /*3*/property1: p1 } of elems) {
+}
+var p2;
+for ({ /*4*/property1 : p2 } of elems) {
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "3", "4", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName07_test.go b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName07_test.go
new file mode 100644
index 0000000000..904acf3d98
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName07_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsObjectBindingElementPropertyName07(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `let p, b;
+
+p, [{ /*1*/a: p, b }] = [{ a: 10, b: true }];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName10_test.go b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName10_test.go
new file mode 100644
index 0000000000..599706f7ec
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsObjectBindingElementPropertyName10_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsObjectBindingElementPropertyName10(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface Recursive {
+ /*1*/next?: Recursive;
+ value: any;
+}
+
+function f (/*2*/{ /*3*/next: { /*4*/next: x} }: Recursive) {
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsOfConstructor_withModifier_test.go b/internal/fourslash/tests/gen/findAllRefsOfConstructor_withModifier_test.go
new file mode 100644
index 0000000000..1d6239b1d2
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsOfConstructor_withModifier_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsOfConstructor_withModifier(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class X {
+ public /*0*/constructor() {}
+}
+var x = new X();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsOnDecorators_test.go b/internal/fourslash/tests/gen/findAllRefsOnDecorators_test.go
new file mode 100644
index 0000000000..eab0fcdf3b
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsOnDecorators_test.go
@@ -0,0 +1,27 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsOnDecorators(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: a.ts
+/*1*/function /*2*/decorator(target) {
+ return target;
+}
+/*3*/decorator();
+// @Filename: b.ts
+@/*4*/decorator @/*5*/decorator("again")
+class C {
+ @/*6*/decorator
+ method() {}
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsOnDefinition2_test.go b/internal/fourslash/tests/gen/findAllRefsOnDefinition2_test.go
new file mode 100644
index 0000000000..2fbf5d60dc
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsOnDefinition2_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsOnDefinition2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: findAllRefsOnDefinition2-import.ts
+export module Test{
+
+ /*1*/export interface /*2*/start { }
+
+ export interface stop { }
+}
+//@Filename: findAllRefsOnDefinition2.ts
+import Second = require("./findAllRefsOnDefinition2-import");
+
+var start: Second.Test./*3*/start;
+var stop: Second.Test.stop;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsOnDefinition_test.go b/internal/fourslash/tests/gen/findAllRefsOnDefinition_test.go
new file mode 100644
index 0000000000..aac365995a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsOnDefinition_test.go
@@ -0,0 +1,37 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsOnDefinition(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: findAllRefsOnDefinition-import.ts
+export class Test{
+
+ constructor(){
+
+ }
+
+ /*1*/public /*2*/start(){
+ return this;
+ }
+
+ public stop(){
+ return this;
+ }
+}
+//@Filename: findAllRefsOnDefinition.ts
+import Second = require("./findAllRefsOnDefinition-import");
+
+var second = new Second.Test()
+second./*3*/start();
+second.stop();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsOnImportAliases_test.go b/internal/fourslash/tests/gen/findAllRefsOnImportAliases_test.go
new file mode 100644
index 0000000000..5c7ef13931
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsOnImportAliases_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsOnImportAliases(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: a.ts
+export class /*0*/Class {
+}
+//@Filename: b.ts
+import { /*1*/Class } from "./a";
+
+var c = new /*2*/Class();
+//@Filename: c.ts
+export { /*3*/Class } from "./a";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsOnPrivateParameterProperty1_test.go b/internal/fourslash/tests/gen/findAllRefsOnPrivateParameterProperty1_test.go
new file mode 100644
index 0000000000..8ffb377062
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsOnPrivateParameterProperty1_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsOnPrivateParameterProperty1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class ABCD {
+ constructor(private x: number, public y: number, /*1*/private /*2*/z: number) {
+ }
+
+ func() {
+ return this./*3*/z;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration1_test.go b/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration1_test.go
new file mode 100644
index 0000000000..e126ac0101
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration1_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsParameterPropertyDeclaration1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ constructor(private /*1*/privateParam: number) {
+ let localPrivate = privateParam;
+ this.privateParam += 10;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration2_test.go b/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration2_test.go
new file mode 100644
index 0000000000..a8170d7aed
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration2_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsParameterPropertyDeclaration2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ constructor(public /*0*/publicParam: number) {
+ let localPublic = /*1*/publicParam;
+ this./*2*/publicParam += 10;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration3_test.go b/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration3_test.go
new file mode 100644
index 0000000000..b86cb99bfd
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration3_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsParameterPropertyDeclaration3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ constructor(protected /*0*/protectedParam: number) {
+ let localProtected = /*1*/protectedParam;
+ this./*2*/protectedParam += 10;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration_inheritance_test.go b/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration_inheritance_test.go
new file mode 100644
index 0000000000..010fa06c59
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsParameterPropertyDeclaration_inheritance_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsParameterPropertyDeclaration_inheritance(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class C {
+ constructor(public /*0*/x: string) {
+ /*1*/x;
+ }
+}
+class D extends C {
+ constructor(public /*2*/x: string) {
+ super(/*3*/x);
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsPrimitiveJsDoc_test.go b/internal/fourslash/tests/gen/findAllRefsPrimitiveJsDoc_test.go
new file mode 100644
index 0000000000..671a2db410
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsPrimitiveJsDoc_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsPrimitiveJsDoc(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @noLib: true
+/**
+ * @param {/*1*/number} n
+ * @returns {/*2*/number}
+ */
+function f(n: /*3*/number): /*4*/number {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsPrivateNameAccessors_test.go b/internal/fourslash/tests/gen/findAllRefsPrivateNameAccessors_test.go
new file mode 100644
index 0000000000..081721bf96
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsPrivateNameAccessors_test.go
@@ -0,0 +1,36 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsPrivateNameAccessors(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class C {
+ /*1*/get /*2*/#foo(){ return 1; }
+ /*3*/set /*4*/#foo(value: number){ }
+ constructor() {
+ this./*5*/#foo();
+ }
+}
+class D extends C {
+ constructor() {
+ super()
+ this.#foo = 20;
+ }
+}
+class E {
+ /*6*/get /*7*/#foo(){ return 1; }
+ /*8*/set /*9*/#foo(value: number){ }
+ constructor() {
+ this./*10*/#foo();
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsPrivateNameMethods_test.go b/internal/fourslash/tests/gen/findAllRefsPrivateNameMethods_test.go
new file mode 100644
index 0000000000..b11bbc9837
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsPrivateNameMethods_test.go
@@ -0,0 +1,34 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsPrivateNameMethods(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class C {
+ /*1*/#foo(){ }
+ constructor() {
+ this./*2*/#foo();
+ }
+}
+class D extends C {
+ constructor() {
+ super()
+ this.#foo = 20;
+ }
+}
+class E {
+ /*3*/#foo(){ }
+ constructor() {
+ this./*4*/#foo();
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsPrivateNameProperties_test.go b/internal/fourslash/tests/gen/findAllRefsPrivateNameProperties_test.go
new file mode 100644
index 0000000000..7ffd784626
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsPrivateNameProperties_test.go
@@ -0,0 +1,35 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsPrivateNameProperties(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class C {
+ /*1*/#foo = 10;
+ constructor() {
+ this./*2*/#foo = 20;
+ /*3*/#foo in this;
+ }
+}
+class D extends C {
+ constructor() {
+ super()
+ this.#foo = 20;
+ }
+}
+class E {
+ /*4*/#foo: number;
+ constructor() {
+ this./*5*/#foo = 20;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsPropertyContextuallyTypedByTypeParam01_test.go b/internal/fourslash/tests/gen/findAllRefsPropertyContextuallyTypedByTypeParam01_test.go
new file mode 100644
index 0000000000..713e446976
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsPropertyContextuallyTypedByTypeParam01_test.go
@@ -0,0 +1,32 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsPropertyContextuallyTypedByTypeParam01(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface IFoo {
+ /*1*/a: string;
+}
+class C {
+ method() {
+ var x: T = {
+ a: ""
+ };
+ x.a;
+ }
+}
+
+
+var x: IFoo = {
+ a: "ss"
+};`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsReExport_broken2_test.go b/internal/fourslash/tests/gen/findAllRefsReExport_broken2_test.go
new file mode 100644
index 0000000000..960d40e890
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsReExport_broken2_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsReExport_broken2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+/*1*/export { /*2*/x } from "nonsense";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsReExport_broken_test.go b/internal/fourslash/tests/gen/findAllRefsReExport_broken_test.go
new file mode 100644
index 0000000000..8584434558
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsReExport_broken_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsReExport_broken(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+/*1*/export { /*2*/x };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsRedeclaredPropertyInDerivedInterface_test.go b/internal/fourslash/tests/gen/findAllRefsRedeclaredPropertyInDerivedInterface_test.go
new file mode 100644
index 0000000000..cdf8e9a389
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsRedeclaredPropertyInDerivedInterface_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsRedeclaredPropertyInDerivedInterface(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @noLib: true
+interface A {
+ readonly /*0*/x: number | string;
+}
+interface B extends A {
+ readonly /*1*/x: number;
+}
+const a: A = { /*2*/x: 0 };
+const b: B = { /*3*/x: 0 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsRootSymbols_test.go b/internal/fourslash/tests/gen/findAllRefsRootSymbols_test.go
new file mode 100644
index 0000000000..0f2448374c
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsRootSymbols_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsRootSymbols(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I { /*0*/x: {}; }
+interface J { /*1*/x: {}; }
+declare const o: (I | J) & { /*2*/x: string };
+o./*3*/x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsThisKeywordMultipleFiles_test.go b/internal/fourslash/tests/gen/findAllRefsThisKeywordMultipleFiles_test.go
new file mode 100644
index 0000000000..cf7d9e3157
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsThisKeywordMultipleFiles_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsThisKeywordMultipleFiles(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: file1.ts
+/*1*/this; /*2*/this;
+// @Filename: file2.ts
+/*3*/this;
+/*4*/this;
+// @Filename: file3.ts
+ ((x = /*5*/this, y) => /*6*/this)(/*7*/this, /*8*/this);
+ // different 'this'
+ function f(this) { return this; }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsThisKeyword_test.go b/internal/fourslash/tests/gen/findAllRefsThisKeyword_test.go
new file mode 100644
index 0000000000..71d5da8fc4
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsThisKeyword_test.go
@@ -0,0 +1,39 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsThisKeyword(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @noLib: true
+/*1*/this;
+function f(/*2*/this) {
+ return /*3*/this;
+ function g(/*4*/this) { return /*5*/this; }
+}
+class C {
+ static x() {
+ /*6*/this;
+ }
+ static y() {
+ () => /*7*/this;
+ }
+ constructor() {
+ /*8*/this;
+ }
+ method() {
+ () => /*9*/this;
+ }
+}
+// These are *not* real uses of the 'this' keyword, they are identifiers.
+const x = { /*10*/this: 0 }
+x./*11*/this;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsTypeParameterInMergedInterface_test.go b/internal/fourslash/tests/gen/findAllRefsTypeParameterInMergedInterface_test.go
new file mode 100644
index 0000000000..50ae313f12
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsTypeParameterInMergedInterface_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsTypeParameterInMergedInterface(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I*1*/T> { a: /*2*/T }
+interface I*3*/T> { b: /*4*/T }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsTypedef_importType_test.go b/internal/fourslash/tests/gen/findAllRefsTypedef_importType_test.go
new file mode 100644
index 0000000000..d104a0a569
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsTypedef_importType_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsTypedef_importType(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+module.exports = 0;
+/** /*1*/@typedef {number} /*2*/Foo */
+const dummy = 0;
+// @Filename: /b.js
+/** @type {import('./a')./*3*/Foo} */
+const x = 0;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsTypedef_test.go b/internal/fourslash/tests/gen/findAllRefsTypedef_test.go
new file mode 100644
index 0000000000..05e6d1d868
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsTypedef_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsTypedef(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+/**
+ * @typedef I {Object}
+ * /*1*/@prop /*2*/p {number}
+ */
+
+/** @type {I} */
+let x;
+x./*3*/p;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsTypeofImport_test.go b/internal/fourslash/tests/gen/findAllRefsTypeofImport_test.go
new file mode 100644
index 0000000000..23711b00fc
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsTypeofImport_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsTypeofImport(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+/*1*/export const /*2*/x = 0;
+declare const a: typeof import("./a");
+a./*3*/x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsUnionProperty_test.go b/internal/fourslash/tests/gen/findAllRefsUnionProperty_test.go
new file mode 100644
index 0000000000..b9665888ea
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsUnionProperty_test.go
@@ -0,0 +1,29 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsUnionProperty(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `type T =
+ | { /*t0*/type: "a", /*p0*/prop: number }
+ | { /*t1*/type: "b", /*p1*/prop: string };
+const tt: T = {
+ /*t2*/type: "a",
+ /*p2*/prop: 0,
+};
+declare const t: T;
+if (t./*t3*/type === "a") {
+ t./*t4*/type;
+} else {
+ t./*t5*/type;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "t0", "t1", "t3", "t4", "t5", "t2", "p0", "p1", "p2")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols1_test.go b/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols1_test.go
new file mode 100644
index 0000000000..88834f019f
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols1_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsUnresolvedSymbols1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `let a: /*a0*/Bar;
+let b: /*a1*/Bar;
+let c: /*a2*/Bar;
+let d: /*b0*/Bar./*c0*/X;
+let e: /*b1*/Bar./*c1*/X;
+let f: /*b2*/Bar./*d0*/X./*e0*/Y;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "a0", "a1", "a2", "b0", "b1", "b2", "c0", "c1", "d0", "e0")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols2_test.go b/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols2_test.go
new file mode 100644
index 0000000000..03cee6b46c
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols2_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsUnresolvedSymbols2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `import { /*a0*/Bar } from "does-not-exist";
+
+let a: /*a1*/Bar;
+let b: /*a2*/Bar;
+let c: /*a3*/Bar;
+let d: /*a4*/Bar./*b0*/X;
+let e: /*a5*/Bar./*b1*/X;
+let f: /*a6*/Bar./*c0*/X./*d0*/Y;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "a0", "a1", "a2", "a3", "a4", "a5", "a6", "b0", "b1", "c0", "d0")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols3_test.go b/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols3_test.go
new file mode 100644
index 0000000000..cbbc67a3c9
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsUnresolvedSymbols3_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsUnresolvedSymbols3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `import * as /*a0*/Bar from "does-not-exist";
+
+let a: /*a1*/Bar;
+let b: /*a2*/Bar;
+let c: /*a3*/Bar;
+let d: /*a4*/Bar./*b0*/X;
+let e: /*a5*/Bar./*b1*/X;
+let f: /*a6*/Bar./*c0*/X./*d0*/Y;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "a0", "a1", "a2", "a3", "a4", "a5", "a6", "b0", "b1", "c0", "d0")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames1_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames1_test.go
new file mode 100644
index 0000000000..dcee1b535d
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames1_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ /*1*/public /*2*/_bar() { return 0; }
+}
+
+var x: Foo;
+x./*3*/_bar;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames2_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames2_test.go
new file mode 100644
index 0000000000..d71df5ccc7
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames2_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ /*1*/public /*2*/__bar() { return 0; }
+}
+
+var x: Foo;
+x./*3*/__bar;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames3_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames3_test.go
new file mode 100644
index 0000000000..6c46e0d097
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames3_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ /*1*/public /*2*/___bar() { return 0; }
+}
+
+var x: Foo;
+x./*3*/___bar;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames4_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames4_test.go
new file mode 100644
index 0000000000..c560ef5d0f
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames4_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ /*1*/public /*2*/____bar() { return 0; }
+}
+
+var x: Foo;
+x./*3*/____bar;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames5_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames5_test.go
new file mode 100644
index 0000000000..1f7a9e84b0
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames5_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ public _bar;
+ public __bar;
+ /*1*/public /*2*/___bar;
+ public ____bar;
+}
+
+var x: Foo;
+x._bar;
+x.__bar;
+x./*3*/___bar;
+x.____bar;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames6_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames6_test.go
new file mode 100644
index 0000000000..6c15f525b3
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames6_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames6(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ public _bar;
+ /*1*/public /*2*/__bar;
+ public ___bar;
+ public ____bar;
+}
+
+var x: Foo;
+x._bar;
+x./*3*/__bar;
+x.___bar;
+x.____bar;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames7_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames7_test.go
new file mode 100644
index 0000000000..227ab8092f
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames7_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames7(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/function /*2*/__foo() {
+ /*3*/__foo();
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames8_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames8_test.go
new file mode 100644
index 0000000000..aaac6e4473
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames8_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames8(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `(/*1*/function /*2*/__foo() {
+ /*3*/__foo();
+})`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames9_test.go b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames9_test.go
new file mode 100644
index 0000000000..5612ed5d47
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithLeadingUnderscoreNames9_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithLeadingUnderscoreNames9(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `(/*1*/function /*2*/___foo() {
+ /*3*/___foo();
+})`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithShorthandPropertyAssignment2_test.go b/internal/fourslash/tests/gen/findAllRefsWithShorthandPropertyAssignment2_test.go
new file mode 100644
index 0000000000..0f95e39d3f
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithShorthandPropertyAssignment2_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithShorthandPropertyAssignment2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` var /*0*/dx = "Foo";
+
+ module M { export var /*1*/dx; }
+ module M {
+ var z = 100;
+ export var y = { /*2*/dx, z };
+ }
+ M.y./*3*/dx;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWithShorthandPropertyAssignment_test.go b/internal/fourslash/tests/gen/findAllRefsWithShorthandPropertyAssignment_test.go
new file mode 100644
index 0000000000..b3d83a5d77
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWithShorthandPropertyAssignment_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWithShorthandPropertyAssignment(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` var /*0*/name = "Foo";
+
+ var obj = { /*1*/name };
+ var obj1 = { /*2*/name: /*3*/name };
+ obj./*4*/name;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "3", "1", "2", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefsWriteAccess_test.go b/internal/fourslash/tests/gen/findAllRefsWriteAccess_test.go
new file mode 100644
index 0000000000..7f4ab28ec0
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefsWriteAccess_test.go
@@ -0,0 +1,33 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefsWriteAccess(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface Obj {
+ [` + "`" + `/*1*/num` + "`" + `]: number;
+}
+
+let o: Obj = {
+ [` + "`" + `num` + "`" + `]: 0
+};
+
+o = {
+ ['num']: 1
+};
+
+o['num'] = 2;
+o[` + "`" + `num` + "`" + `] = 3;
+
+o['num'];
+o[` + "`" + `num` + "`" + `];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefs_importType_js.4_test.go b/internal/fourslash/tests/gen/findAllRefs_importType_js.4_test.go
new file mode 100644
index 0000000000..0747e8616a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefs_importType_js.4_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefs_importType_js.4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @module: commonjs
+// @allowJs: true
+// @checkJs: true
+// @Filename: /a.js
+/**
+ * @callback /**/A
+ * @param {unknown} response
+ */
+
+module.exports = {};
+// @Filename: /b.js
+/** @typedef {import("./a").A} A */
`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
\ No newline at end of file
diff --git a/internal/fourslash/tests/gen/findAllRefs_importType_meaningAtLocation_test.go b/internal/fourslash/tests/gen/findAllRefs_importType_meaningAtLocation_test.go
new file mode 100644
index 0000000000..c35480b923
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefs_importType_meaningAtLocation_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefs_importType_meaningAtLocation(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+/*1*/export type /*2*/T = 0;
+/*3*/export const /*4*/T = 0;
+// @Filename: /b.ts
+const x: import("./a")./*5*/T = 0;
+const x: typeof import("./a")./*6*/T = 0;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefs_importType_named_test.go b/internal/fourslash/tests/gen/findAllRefs_importType_named_test.go
new file mode 100644
index 0000000000..f7cd7bd8a8
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefs_importType_named_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefs_importType_named(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+/*1*/export type /*2*/T = number;
+/*3*/export type /*4*/U = string;
+// @Filename: /b.ts
+const x: import("./a")./*5*/T = 0;
+const x: import("./a")./*6*/U = 0;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefs_importType_typeofImport_test.go b/internal/fourslash/tests/gen/findAllRefs_importType_typeofImport_test.go
new file mode 100644
index 0000000000..02e749e266
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefs_importType_typeofImport_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefs_importType_typeofImport(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /a.ts
+export const x = 0;
+// @Filename: /b.ts
+/*1*/const x: typeof import("/*2*/./a") = { x: 0 };
+/*3*/const y: typeof import("/*4*/./a") = { x: 0 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findAllRefs_jsEnum_test.go b/internal/fourslash/tests/gen/findAllRefs_jsEnum_test.go
new file mode 100644
index 0000000000..8b9635f3b9
--- /dev/null
+++ b/internal/fourslash/tests/gen/findAllRefs_jsEnum_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindAllRefs_jsEnum(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: /a.js
+/** @enum {string} */
+/*1*/const /*2*/E = { A: "" };
+/*3*/E["A"];
+/** @type {/*4*/E} */
+const e = /*5*/E.A;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/findReferencesAcrossMultipleProjects_test.go b/internal/fourslash/tests/gen/findReferencesAcrossMultipleProjects_test.go
new file mode 100644
index 0000000000..cc49f492dc
--- /dev/null
+++ b/internal/fourslash/tests/gen/findReferencesAcrossMultipleProjects_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindReferencesAcrossMultipleProjects(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: a.ts
+/*1*/var /*2*/x: number;
+//@Filename: b.ts
+///
+/*3*/x++;
+//@Filename: c.ts
+///
+/*4*/x++;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash1_test.go b/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash1_test.go
new file mode 100644
index 0000000000..5aceae785e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash1_test.go
@@ -0,0 +1,42 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindReferencesBindingPatternInJsdocNoCrash1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @moduleResolution: node
+// @Filename: node_modules/use-query/package.json
+{
+ "name": "use-query",
+ "types": "index.d.ts"
+}
+// @Filename: node_modules/use-query/index.d.ts
+declare function useQuery(): {
+ data: string[];
+};
+// @Filename: node_modules/other/package.json
+{
+ "name": "other",
+ "types": "index.d.ts"
+}
+// @Filename: node_modules/other/index.d.ts
+interface BottomSheetModalProps {
+ /**
+ * A scrollable node or normal view.
+ * @type {({ data: any }?) => any}
+ */
+ children: ({ data: any }?) => any;
+}
+// @Filename: src/index.ts
+import { useQuery } from "use-query";
+const { /*1*/data } = useQuery();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash2_test.go b/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash2_test.go
new file mode 100644
index 0000000000..1ff230f14a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findReferencesBindingPatternInJsdocNoCrash2_test.go
@@ -0,0 +1,42 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindReferencesBindingPatternInJsdocNoCrash2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @moduleResolution: node
+// @Filename: node_modules/use-query/package.json
+{
+ "name": "use-query",
+ "types": "index.d.ts"
+}
+// @Filename: node_modules/use-query/index.d.ts
+declare function useQuery(): {
+ data: string[];
+};
+// @Filename: node_modules/use-query/package.json
+{
+ "name": "other",
+ "types": "index.d.ts"
+}
+// @Filename: node_modules/other/index.d.ts
+interface BottomSheetModalProps {
+ /**
+ * A scrollable node or normal view.
+ * @type null | (({ data: any }?) => any)
+ */
+ children: null | (({ data: any }?) => any);
+}
+// @Filename: src/index.ts
+import { useQuery } from "use-query";
+const { /*1*/data } = useQuery();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/findReferencesDefinitionDisplayParts_test.go b/internal/fourslash/tests/gen/findReferencesDefinitionDisplayParts_test.go
new file mode 100644
index 0000000000..6981eb7c6a
--- /dev/null
+++ b/internal/fourslash/tests/gen/findReferencesDefinitionDisplayParts_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindReferencesDefinitionDisplayParts(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Gre/*1*/eter {
+ someFunction() { th/*2*/is; }
+}
+
+type Options = "opt/*3*/ion 1" | "option 2";
+let myOption: Options = "option 1";
+
+some/*4*/Label:
+break someLabel;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/findReferencesJSXTagName2_test.go b/internal/fourslash/tests/gen/findReferencesJSXTagName2_test.go
new file mode 100644
index 0000000000..856fcf2966
--- /dev/null
+++ b/internal/fourslash/tests/gen/findReferencesJSXTagName2_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindReferencesJSXTagName2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: index.tsx
+/*1*/const /*2*/obj = {Component: () => };
+const element = *3*/obj.Component/>;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/findReferencesJSXTagName_test.go b/internal/fourslash/tests/gen/findReferencesJSXTagName_test.go
new file mode 100644
index 0000000000..c700ef584d
--- /dev/null
+++ b/internal/fourslash/tests/gen/findReferencesJSXTagName_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindReferencesJSXTagName(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: index.tsx
+import { /*1*/SubmissionComp } from "./RedditSubmission"
+function displaySubreddit(subreddit: string) {
+ let components = submissions
+ .map((value, index) => );
+}
+// @Filename: RedditSubmission.ts
+export const /*2*/SubmissionComp = (submission: SubmissionProps) =>
+ ;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/findReferencesSeeTagInTs_test.go b/internal/fourslash/tests/gen/findReferencesSeeTagInTs_test.go
new file mode 100644
index 0000000000..5748a1f47e
--- /dev/null
+++ b/internal/fourslash/tests/gen/findReferencesSeeTagInTs_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestFindReferencesSeeTagInTs(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `function doStuffWithStuff/*1*/(stuff: { quantity: number }) {}
+
+declare const stuff: { quantity: number };
+/** @see {doStuffWithStuff} */
+if (stuff.quantity) {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfArrowFunction_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfArrowFunction_test.go
new file mode 100644
index 0000000000..6b0c4c5c13
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfArrowFunction_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfArrowFunction(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/var /*2*/f = x => x + 1;
+/*3*/f(12);`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfBindingPattern_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfBindingPattern_test.go
new file mode 100644
index 0000000000..9145f141a6
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfBindingPattern_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfBindingPattern(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `const { /*1*/x, y } = { /*2*/x: 1, y: 2 };
+const z = /*3*/x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfClass_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfClass_test.go
new file mode 100644
index 0000000000..7ffcf4d91c
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfClass_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfClass(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/class /*2*/C {
+ n: number;
+ constructor() {
+ this.n = 12;
+ }
+}
+let c = new /*3*/C();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfComputedProperty_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfComputedProperty_test.go
new file mode 100644
index 0000000000..e4a3fac0cb
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfComputedProperty_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfComputedProperty(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `let o = { /*1*/["/*2*/foo"]: 12 };
+let y = o./*3*/foo;
+let z = o['/*4*/foo'];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfEnum_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfEnum_test.go
new file mode 100644
index 0000000000..9ce1bce0a2
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfEnum_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfEnum(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/enum /*2*/E {
+ First,
+ Second
+}
+let first = /*3*/E.First;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfExport_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfExport_test.go
new file mode 100644
index 0000000000..82ee0347ff
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfExport_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfExport(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: m.ts
+export var /*1*/x = 12;
+// @Filename: main.ts
+import { /*2*/x } from "./m";
+const y = x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfFunction_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfFunction_test.go
new file mode 100644
index 0000000000..45b274c359
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfFunction_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfFunction(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/function /*2*/func(x: number) {
+}
+/*3*/func(x)`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfInterfaceClassMerge_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfInterfaceClassMerge_test.go
new file mode 100644
index 0000000000..bf74636cce
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfInterfaceClassMerge_test.go
@@ -0,0 +1,29 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfInterfaceClassMerge(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/interface /*2*/Numbers {
+ p: number;
+}
+/*3*/interface /*4*/Numbers {
+ m: number;
+}
+/*5*/class /*6*/Numbers {
+ f(n: number) {
+ return this.p + this.m + n;
+ }
+}
+let i: /*7*/Numbers = new /*8*/Numbers();
+let x = i.f(i.p + i.m);`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfInterface_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfInterface_test.go
new file mode 100644
index 0000000000..163e79261f
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfInterface_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfInterface(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/interface /*2*/I {
+ p: number;
+}
+let i: /*3*/I = { p: 12 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfNamespace_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfNamespace_test.go
new file mode 100644
index 0000000000..ec47571f6b
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfNamespace_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfNamespace(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/namespace /*2*/Numbers {
+ export var n = 12;
+}
+let x = /*3*/Numbers.n + 1;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfNumberNamedProperty_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfNumberNamedProperty_test.go
new file mode 100644
index 0000000000..00d2aa3c82
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfNumberNamedProperty_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfNumberNamedProperty(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `let o = { /*1*/1: 12 };
+let y = o[/*2*/1];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfParameter_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfParameter_test.go
new file mode 100644
index 0000000000..db7530e644
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfParameter_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfParameter(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `function f(/*1*/x: number) {
+ return /*2*/x + 1
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfStringNamedProperty_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfStringNamedProperty_test.go
new file mode 100644
index 0000000000..fafef8d456
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfStringNamedProperty_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfStringNamedProperty(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `let o = { /*1*/"/*2*/x": 12 };
+let y = o./*3*/x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfTypeAlias_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfTypeAlias_test.go
new file mode 100644
index 0000000000..d52e14fa09
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfTypeAlias_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfTypeAlias(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/type /*2*/Alias= number;
+let n: /*3*/Alias = 12;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfVariable_test.go b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfVariable_test.go
new file mode 100644
index 0000000000..4afb5bf9a1
--- /dev/null
+++ b/internal/fourslash/tests/gen/getOccurrencesIsDefinitionOfVariable_test.go
@@ -0,0 +1,33 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestGetOccurrencesIsDefinitionOfVariable(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/var /*2*/x = 0;
+var assignmentRightHandSide = /*3*/x;
+var assignmentRightHandSide2 = 1 + /*4*/x;
+
+/*5*/x = 1;
+/*6*/x = /*7*/x + /*8*/x;
+
+/*9*/x == 1;
+/*10*/x <= 1;
+
+var preIncrement = ++/*11*/x;
+var postIncrement = /*12*/x++;
+var preDecrement = --/*13*/x;
+var postDecrement = /*14*/x--;
+
+/*15*/x += 1;
+/*16*/x <<= 1;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16")
+}
diff --git a/internal/fourslash/tests/gen/isDefinitionAcrossGlobalProjects_test.go b/internal/fourslash/tests/gen/isDefinitionAcrossGlobalProjects_test.go
new file mode 100644
index 0000000000..cdcdc26f23
--- /dev/null
+++ b/internal/fourslash/tests/gen/isDefinitionAcrossGlobalProjects_test.go
@@ -0,0 +1,97 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestIsDefinitionAcrossGlobalProjects(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /home/src/workspaces/project/a/index.ts
+namespace NS {
+ export function /*1*/FA() {
+ FB();
+ }
+}
+
+interface /*2*/I {
+ /*3*/FA();
+}
+
+const ia: I = {
+ FA() { },
+ FB() { },
+ FC() { },
+ };
+// @Filename: /home/src/workspaces/project/a/tsconfig.json
+{
+ "extends": "../tsconfig.settings.json",
+ "references": [
+ { "path": "../b" },
+ { "path": "../c" },
+ ],
+ "files": [
+ "index.ts",
+ ],
+}
+// @Filename: /home/src/workspaces/project/b/index.ts
+namespace NS {
+ export function /*4*/FB() {}
+}
+
+interface /*5*/I {
+ /*6*/FB();
+}
+
+const ib: I = { FB() {} };
+// @Filename: /home/src/workspaces/project/b/tsconfig.json
+{
+ "extends": "../tsconfig.settings.json",
+ "files": [
+ "index.ts",
+ ],
+}
+// @Filename: /home/src/workspaces/project/c/index.ts
+namespace NS {
+ export function /*7*/FC() {}
+}
+
+interface /*8*/I {
+ /*9*/FC();
+}
+
+const ic: I = { FC() {} };
+// @Filename: /home/src/workspaces/project/c/tsconfig.json
+{
+ "extends": "../tsconfig.settings.json",
+ "files": [
+ "index.ts",
+ ],
+}
+// @Filename: /home/src/workspaces/project/tsconfig.json
+{
+ "compilerOptions": {
+ "composite": true,
+ },
+ "references": [
+ { "path": "a" },
+ ],
+ "files": []
+}
+// @Filename: /home/src/workspaces/project/tsconfig.settings.json
+{
+ "compilerOptions": {
+ "composite": true,
+ "skipLibCheck": true,
+ "declarationMap": true,
+ "module": "none",
+ "emitDeclarationOnly": true,
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9")
+}
diff --git a/internal/fourslash/tests/gen/isDefinitionAcrossModuleProjects_test.go b/internal/fourslash/tests/gen/isDefinitionAcrossModuleProjects_test.go
new file mode 100644
index 0000000000..98a8ee14d6
--- /dev/null
+++ b/internal/fourslash/tests/gen/isDefinitionAcrossModuleProjects_test.go
@@ -0,0 +1,136 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestIsDefinitionAcrossModuleProjects(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /home/src/workspaces/project/a/index.ts
+import { NS } from "../b";
+import { I } from "../c";
+
+declare module "../b" {
+ export namespace NS {
+ export function /*1*/FA();
+ }
+}
+
+declare module "../c" {
+ export interface /*2*/I {
+ /*3*/FA();
+ }
+}
+
+const ia: I = {
+ FA: NS.FA,
+ FC() { },
+};
+// @Filename: /home/src/workspaces/project/a/tsconfig.json
+{
+ "extends": "../tsconfig.settings.json",
+ "references": [
+ { "path": "../b" },
+ { "path": "../c" },
+ ],
+ "files": [
+ "index.ts",
+ ],
+}
+// @Filename: /home/src/workspaces/project/a2/index.ts
+import { NS } from "../b";
+import { I } from "../c";
+
+declare module "../b" {
+ export namespace NS {
+ export function /*4*/FA();
+ }
+}
+
+declare module "../c" {
+ export interface /*5*/I {
+ /*6*/FA();
+ }
+}
+
+const ia: I = {
+ FA: NS.FA,
+ FC() { },
+};
+// @Filename: /home/src/workspaces/project/a2/tsconfig.json
+{
+ "extends": "../tsconfig.settings.json",
+ "references": [
+ { "path": "../b" },
+ { "path": "../c" },
+ ],
+ "files": [
+ "index.ts",
+ ],
+}
+// @Filename: /home/src/workspaces/project/b/index.ts
+export namespace NS {
+ export function /*7*/FB() {}
+}
+
+export interface /*8*/I {
+ /*9*/FB();
+}
+
+const ib: I = { FB() {} };
+// @Filename: /home/src/workspaces/project/b/other.ts
+export const Other = 1;
+// @Filename: /home/src/workspaces/project/b/tsconfig.json
+{
+ "extends": "../tsconfig.settings.json",
+ "files": [
+ "index.ts",
+ "other.ts",
+ ],
+}
+// @Filename: /home/src/workspaces/project/c/index.ts
+export namespace NS {
+ export function /*10*/FC() {}
+}
+
+export interface /*11*/I {
+ /*12*/FC();
+}
+
+const ic: I = { FC() {} };
+// @Filename: /home/src/workspaces/project/c/tsconfig.json
+{
+ "extends": "../tsconfig.settings.json",
+ "files": [
+ "index.ts",
+ ],
+}
+// @Filename: /home/src/workspaces/project/tsconfig.json
+{
+ "compilerOptions": {
+ "composite": true,
+ },
+ "references": [
+ { "path": "a" },
+ { "path": "a2" },
+ ],
+ "files": []
+}
+// @Filename: /home/src/workspaces/project/tsconfig.settings.json
+{
+ "compilerOptions": {
+ "composite": true,
+ "skipLibCheck": true,
+ "declarationMap": true,
+ "module": "CommonJS",
+ "emitDeclarationOnly": true,
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12")
+}
diff --git a/internal/fourslash/tests/gen/isDefinitionInterfaceImplementation_test.go b/internal/fourslash/tests/gen/isDefinitionInterfaceImplementation_test.go
new file mode 100644
index 0000000000..4663706823
--- /dev/null
+++ b/internal/fourslash/tests/gen/isDefinitionInterfaceImplementation_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestIsDefinitionInterfaceImplementation(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {
+ /*1*/M(): void;
+}
+
+class C implements I {
+ /*2*/M() { }
+}
+
+({} as I).M();
+({} as C).M();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/isDefinitionOverloads_test.go b/internal/fourslash/tests/gen/isDefinitionOverloads_test.go
new file mode 100644
index 0000000000..0ec53d8590
--- /dev/null
+++ b/internal/fourslash/tests/gen/isDefinitionOverloads_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestIsDefinitionOverloads(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `function /*1*/f(x: number): void;
+function /*2*/f(x: string): void;
+function /*3*/f(x: number | string) { }
+
+f(1);
+f("a");`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/isDefinitionShorthandProperty_test.go b/internal/fourslash/tests/gen/isDefinitionShorthandProperty_test.go
new file mode 100644
index 0000000000..743326da9e
--- /dev/null
+++ b/internal/fourslash/tests/gen/isDefinitionShorthandProperty_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestIsDefinitionShorthandProperty(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `const /*1*/x = 1;
+const y: { /*2*/x: number } = { /*3*/x };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/isDefinitionSingleImport_test.go b/internal/fourslash/tests/gen/isDefinitionSingleImport_test.go
new file mode 100644
index 0000000000..3d6b6948f9
--- /dev/null
+++ b/internal/fourslash/tests/gen/isDefinitionSingleImport_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestIsDefinitionSingleImport(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @filename: a.ts
+export function /*1*/f() {}
+// @filename: b.ts
+import { /*2*/f } from "./a";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/isDefinitionSingleReference_test.go b/internal/fourslash/tests/gen/isDefinitionSingleReference_test.go
new file mode 100644
index 0000000000..bcbeb76bb9
--- /dev/null
+++ b/internal/fourslash/tests/gen/isDefinitionSingleReference_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestIsDefinitionSingleReference(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `function /*1*/f() {}
+/*2*/f();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/jsdocLink_findAllReferences1_test.go b/internal/fourslash/tests/gen/jsdocLink_findAllReferences1_test.go
new file mode 100644
index 0000000000..8a6ba41c5b
--- /dev/null
+++ b/internal/fourslash/tests/gen/jsdocLink_findAllReferences1_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestJsdocLink_findAllReferences1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface A/**/ {}
+/**
+ * {@link A()} is ok
+ */
+declare const a: A`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/jsdocSatisfiesTagFindAllReferences_test.go b/internal/fourslash/tests/gen/jsdocSatisfiesTagFindAllReferences_test.go
new file mode 100644
index 0000000000..9a41f9fa98
--- /dev/null
+++ b/internal/fourslash/tests/gen/jsdocSatisfiesTagFindAllReferences_test.go
@@ -0,0 +1,27 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestJsdocSatisfiesTagFindAllReferences(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @noEmit: true
+// @allowJS: true
+// @checkJs: true
+// @filename: /a.js
+/**
+ * @typedef {Object} T
+ * @property {number} a
+ */
+
+/** @satisfies {/**/T} comment */
+const foo = { a: 1 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/jsdocThrowsTag_findAllReferences_test.go b/internal/fourslash/tests/gen/jsdocThrowsTag_findAllReferences_test.go
new file mode 100644
index 0000000000..79ff8af1a3
--- /dev/null
+++ b/internal/fourslash/tests/gen/jsdocThrowsTag_findAllReferences_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestJsdocThrowsTag_findAllReferences(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class /**/E extends Error {}
+/**
+ * @throws {E}
+ */
+function f() {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/jsdocTypedefTagSemanticMeaning0_test.go b/internal/fourslash/tests/gen/jsdocTypedefTagSemanticMeaning0_test.go
new file mode 100644
index 0000000000..c5ff10b84b
--- /dev/null
+++ b/internal/fourslash/tests/gen/jsdocTypedefTagSemanticMeaning0_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestJsdocTypedefTagSemanticMeaning0(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: a.js
+/** /*1*/@typedef {number} /*2*/T */
+/*3*/const /*4*/T = 1;
+/** @type {/*5*/T} */
+const n = /*6*/T;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6")
+}
diff --git a/internal/fourslash/tests/gen/jsdocTypedefTagSemanticMeaning1_test.go b/internal/fourslash/tests/gen/jsdocTypedefTagSemanticMeaning1_test.go
new file mode 100644
index 0000000000..23ab8a1d1c
--- /dev/null
+++ b/internal/fourslash/tests/gen/jsdocTypedefTagSemanticMeaning1_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestJsdocTypedefTagSemanticMeaning1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: a.js
+/** @typedef {number} */
+/*1*/const /*2*/T = 1;
+/** @type {/*3*/T} */
+const n = /*4*/T;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/jsxFindAllReferencesOnRuntimeImportWithPaths1_test.go b/internal/fourslash/tests/gen/jsxFindAllReferencesOnRuntimeImportWithPaths1_test.go
new file mode 100644
index 0000000000..83a9c2d649
--- /dev/null
+++ b/internal/fourslash/tests/gen/jsxFindAllReferencesOnRuntimeImportWithPaths1_test.go
@@ -0,0 +1,43 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestJsxFindAllReferencesOnRuntimeImportWithPaths1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: project/src/foo.ts
+import * as x from /**/"@foo/dir/jsx-runtime";
+// @Filename: project/src/bar.tsx
+export default ;
+// @Filename: project/src/baz.tsx
+export default <>>;
+// @Filename: project/src/bam.tsx
+export default ;
+// @Filename: project/src/bat.tsx
+export const a = 1;
+// @Filename: project/src/bal.tsx
+
+// @Filename: project/src/dir/jsx-runtime.ts
+export {}
+// @Filename: project/tsconfig.json
+{
+ "compilerOptions": {
+ "moduleResolution": "node",
+ "module": "es2020",
+ "jsx": "react-jsx",
+ "jsxImportSource": "@foo/dir",
+ "moduleDetection": "force",
+ "paths": {
+ "@foo/dir/jsx-runtime": ["./src/dir/jsx-runtime"]
+ }
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/localGetReferences_test.go b/internal/fourslash/tests/gen/localGetReferences_test.go
new file mode 100644
index 0000000000..a64ef60797
--- /dev/null
+++ b/internal/fourslash/tests/gen/localGetReferences_test.go
@@ -0,0 +1,199 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestLocalGetReferences(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: localGetReferences_1.ts
+// Comment Refence Test: g/*43*/lobalVar
+// References to a variable declared in global.
+/*1*/var /*2*/globalVar: number = 2;
+
+class fooCls {
+ // References to static variable declared in a class.
+ /*3*/static /*4*/clsSVar = 1;
+ // References to a variable declared in a class.
+ /*5*/clsVar = 1;
+
+ constructor (/*6*/public /*7*/clsParam: number) {
+ //Increments
+ /*8*/globalVar++;
+ this./*9*/clsVar++;
+ fooCls./*10*/clsSVar++;
+ // References to a class parameter.
+ this./*11*/clsParam++;
+ modTest.modVar++;
+ }
+}
+
+// References to a function parameter.
+/*12*/function /*13*/foo(/*14*/x: number) {
+ // References to a variable declared in a function.
+ /*15*/var /*16*/fnVar = 1;
+
+ //Increments
+ fooCls./*17*/clsSVar++;
+ /*18*/globalVar++;
+ modTest.modVar++;
+ /*19*/fnVar++;
+
+ //Return
+ return /*20*/x++;
+}
+
+module modTest {
+ //Declare
+ export var modVar:number;
+
+ //Increments
+ /*21*/globalVar++;
+ fooCls./*22*/clsSVar++;
+ modVar++;
+
+ class testCls {
+ static boo = /*23*/foo;
+ }
+
+ function testFn(){
+ static boo = /*24*/foo;
+
+ //Increments
+ /*25*/globalVar++;
+ fooCls./*26*/clsSVar++;
+ modVar++;
+ }
+
+ module testMod {
+ var boo = /*27*/foo;
+ }
+}
+
+//Type test
+var clsTest: fooCls;
+
+//Arguments
+// References to a class argument.
+clsTest = new fooCls(/*28*/globalVar);
+// References to a function argument.
+/*29*/foo(/*30*/globalVar);
+
+//Increments
+fooCls./*31*/clsSVar++;
+modTest.modVar++;
+/*32*/globalVar = /*33*/globalVar + /*34*/globalVar;
+
+//ETC - Other cases
+/*35*/globalVar = 3;
+// References to illegal assignment.
+/*36*/foo = /*37*/foo + 1;
+/*44*/err = err++;
+/*45*/
+//Shadowed fn Parameter
+function shdw(/*38*/globalVar: number) {
+ //Increments
+ /*39*/globalVar++;
+ return /*40*/globalVar;
+}
+
+//Remotes
+//Type test
+var remoteclsTest: remotefooCls;
+
+//Arguments
+remoteclsTest = new remotefooCls(remoteglobalVar);
+remotefoo(remoteglobalVar);
+
+//Increments
+remotefooCls.remoteclsSVar++;
+remotemodTest.remotemodVar++;
+remoteglobalVar = remoteglobalVar + remoteglobalVar;
+
+//ETC - Other cases
+remoteglobalVar = 3;
+
+//Find References misses method param
+var
+
+
+
+ array = ["f", "o", "o"];
+
+array.forEach(
+
+
+function(/*41*/str) {
+
+
+
+ // Reference misses function parameter.
+ return /*42*/str + " ";
+
+});
+// @Filename: localGetReferences_2.ts
+var remoteglobalVar: number = 2;
+
+class remotefooCls {
+ //Declare
+ remoteclsVar = 1;
+ static remoteclsSVar = 1;
+
+ constructor(public remoteclsParam: number) {
+ //Increments
+ remoteglobalVar++;
+ this.remoteclsVar++;
+ remotefooCls.remoteclsSVar++;
+ this.remoteclsParam++;
+ remotemodTest.remotemodVar++;
+ }
+}
+
+function remotefoo(remotex: number) {
+ //Declare
+ var remotefnVar = 1;
+
+ //Increments
+ remotefooCls.remoteclsSVar++;
+ remoteglobalVar++;
+ remotemodTest.remotemodVar++;
+ remotefnVar++;
+
+ //Return
+ return remotex++;
+}
+
+module remotemodTest {
+ //Declare
+ export var remotemodVar: number;
+
+ //Increments
+ remoteglobalVar++;
+ remotefooCls.remoteclsSVar++;
+ remotemodVar++;
+
+ class remotetestCls {
+ static remoteboo = remotefoo;
+ }
+` + "`" + `
+ function remotetestFn(){
+ static remoteboo = remotefoo;
+
+ //Increments
+ remoteglobalVar++;
+ remotefooCls.remoteclsSVar++;
+ remotemodVar++;
+ }
+
+ module remotetestMod {
+ var remoteboo = remotefoo;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45")
+}
diff --git a/internal/fourslash/tests/gen/referenceInParameterPropertyDeclaration_test.go b/internal/fourslash/tests/gen/referenceInParameterPropertyDeclaration_test.go
new file mode 100644
index 0000000000..b579a1d06d
--- /dev/null
+++ b/internal/fourslash/tests/gen/referenceInParameterPropertyDeclaration_test.go
@@ -0,0 +1,32 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferenceInParameterPropertyDeclaration(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: file1.ts
+ class Foo {
+ constructor(private /*1*/privateParam: number,
+ public /*2*/publicParam: string,
+ protected /*3*/protectedParam: boolean) {
+
+ let localPrivate = privateParam;
+ this.privateParam += 10;
+
+ let localPublic = publicParam;
+ this.publicParam += " Hello!";
+
+ let localProtected = protectedParam;
+ this.protectedParam = false;
+ }
+ }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referenceToClass_test.go b/internal/fourslash/tests/gen/referenceToClass_test.go
new file mode 100644
index 0000000000..d29f1a37bc
--- /dev/null
+++ b/internal/fourslash/tests/gen/referenceToClass_test.go
@@ -0,0 +1,32 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferenceToClass(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: referenceToClass_1.ts
+class /*1*/foo {
+ public n: /*2*/foo;
+ public foo: number;
+}
+
+class bar {
+ public n: /*3*/foo;
+ public k = new /*4*/foo();
+}
+
+module mod {
+ var k: /*5*/foo = null;
+}
+// @Filename: referenceToClass_2.ts
+var k: /*6*/foo;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6")
+}
diff --git a/internal/fourslash/tests/gen/referenceToEmptyObject_test.go b/internal/fourslash/tests/gen/referenceToEmptyObject_test.go
new file mode 100644
index 0000000000..ddd33ebfbf
--- /dev/null
+++ b/internal/fourslash/tests/gen/referenceToEmptyObject_test.go
@@ -0,0 +1,17 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferenceToEmptyObject(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `const obj = {}/*1*/;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/references01_test.go b/internal/fourslash/tests/gen/references01_test.go
new file mode 100644
index 0000000000..a0930537a1
--- /dev/null
+++ b/internal/fourslash/tests/gen/references01_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferences01(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /home/src/workspaces/project/referencesForGlobals_1.ts
+class /*0*/globalClass {
+ public f() { }
+}
+// @Filename: /home/src/workspaces/project/referencesForGlobals_2.ts
+///
+var c = /*1*/globalClass();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesBloomFilters2_test.go b/internal/fourslash/tests/gen/referencesBloomFilters2_test.go
new file mode 100644
index 0000000000..471bfb582c
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesBloomFilters2_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesBloomFilters2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: declaration.ts
+var container = { /*1*/42: 1 };
+// @Filename: expression.ts
+function blah() { return (container[42]) === 2; };
+// @Filename: stringIndexer.ts
+function blah2() { container["42"] };
+// @Filename: redeclaration.ts
+container = { "42" : 18 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesBloomFilters3_test.go b/internal/fourslash/tests/gen/referencesBloomFilters3_test.go
new file mode 100644
index 0000000000..b0c08e0577
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesBloomFilters3_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesBloomFilters3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: declaration.ts
+enum Test { /*1*/"/*2*/42" = 1 };
+// @Filename: expression.ts
+(Test[/*3*/42]);`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesBloomFilters_test.go b/internal/fourslash/tests/gen/referencesBloomFilters_test.go
new file mode 100644
index 0000000000..151c422662
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesBloomFilters_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesBloomFilters(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: declaration.ts
+var container = { /*1*/searchProp : 1 };
+// @Filename: expression.ts
+function blah() { return (1 + 2 + container.searchProp()) === 2; };
+// @Filename: stringIndexer.ts
+function blah2() { container["searchProp"] };
+// @Filename: redeclaration.ts
+container = { "searchProp" : 18 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesForAmbients_test.go b/internal/fourslash/tests/gen/referencesForAmbients_test.go
new file mode 100644
index 0000000000..a417f81a64
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForAmbients_test.go
@@ -0,0 +1,29 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForAmbients(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/declare module "/*2*/foo" {
+ /*3*/var /*4*/f: number;
+}
+
+/*5*/declare module "/*6*/bar" {
+ /*7*/export import /*8*/foo = require("/*9*/foo");
+ var f2: typeof /*10*/foo./*11*/f;
+}
+
+declare module "baz" {
+ /*12*/import bar = require("/*13*/bar");
+ var f2: typeof bar./*14*/foo;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14")
+}
diff --git a/internal/fourslash/tests/gen/referencesForClassLocal_test.go b/internal/fourslash/tests/gen/referencesForClassLocal_test.go
new file mode 100644
index 0000000000..c42b4e5f08
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForClassLocal_test.go
@@ -0,0 +1,33 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForClassLocal(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var n = 14;
+
+class foo {
+ /*1*/private /*2*/n = 0;
+
+ public bar() {
+ this./*3*/n = 9;
+ }
+
+ constructor() {
+ this./*4*/n = 4;
+ }
+
+ public bar2() {
+ var n = 12;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForClassMembersExtendingAbstractClass_test.go b/internal/fourslash/tests/gen/referencesForClassMembersExtendingAbstractClass_test.go
new file mode 100644
index 0000000000..8129292533
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForClassMembersExtendingAbstractClass_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForClassMembersExtendingAbstractClass(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `abstract class Base {
+ abstract /*a1*/a: number;
+ abstract /*method1*/method(): void;
+}
+class MyClass extends Base {
+ /*a2*/a;
+ /*method2*/method() { }
+}
+
+var c: MyClass;
+c./*a3*/a;
+c./*method3*/method();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "a1", "a2", "a3", "method1", "method2", "method3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForClassMembersExtendingGenericClass_test.go b/internal/fourslash/tests/gen/referencesForClassMembersExtendingGenericClass_test.go
new file mode 100644
index 0000000000..9f21ba1d01
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForClassMembersExtendingGenericClass_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForClassMembersExtendingGenericClass(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Base {
+ /*a1*/a: this;
+ /*method1*/method(a?:T, b?:U): this { }
+}
+class MyClass extends Base {
+ /*a2*/a;
+ /*method2*/method() { }
+}
+
+var c: MyClass;
+c./*a3*/a;
+c./*method3*/method();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "a1", "a2", "a3", "method1", "method2", "method3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForClassMembers_test.go b/internal/fourslash/tests/gen/referencesForClassMembers_test.go
new file mode 100644
index 0000000000..8e08a9f78e
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForClassMembers_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForClassMembers(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Base {
+ /*a1*/a: number;
+ /*method1*/method(): void { }
+}
+class MyClass extends Base {
+ /*a2*/a;
+ /*method2*/method() { }
+}
+
+var c: MyClass;
+c./*a3*/a;
+c./*method3*/method();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "a1", "a2", "a3", "method1", "method2", "method3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForClassParameter_test.go b/internal/fourslash/tests/gen/referencesForClassParameter_test.go
new file mode 100644
index 0000000000..24c0c23b60
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForClassParameter_test.go
@@ -0,0 +1,32 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForClassParameter(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var p = 2;
+
+class p { }
+
+class foo {
+ constructor (/*1*/public /*2*/p: any) {
+ }
+
+ public f(p) {
+ this./*3*/p = p;
+ }
+
+}
+
+var n = new foo(undefined);
+n./*4*/p = null;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForContextuallyTypedObjectLiteralProperties_test.go b/internal/fourslash/tests/gen/referencesForContextuallyTypedObjectLiteralProperties_test.go
new file mode 100644
index 0000000000..ef5a7799e2
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForContextuallyTypedObjectLiteralProperties_test.go
@@ -0,0 +1,40 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForContextuallyTypedObjectLiteralProperties(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface IFoo { /*xy*/xy: number; }
+
+// Assignment
+var a1: IFoo = { xy: 0 };
+var a2: IFoo = { xy: 0 };
+
+// Function call
+function consumer(f: IFoo) { }
+consumer({ xy: 1 });
+
+// Type cast
+var c = { xy: 0 };
+
+// Array literal
+var ar: IFoo[] = [{ xy: 1 }, { xy: 2 }];
+
+// Nested object literal
+var ob: { ifoo: IFoo } = { ifoo: { xy: 0 } };
+
+// Widened type
+var w: IFoo = { xy: undefined };
+
+// Untped -- should not be included
+var u = { xy: 0 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "xy")
+}
diff --git a/internal/fourslash/tests/gen/referencesForContextuallyTypedUnionProperties2_test.go b/internal/fourslash/tests/gen/referencesForContextuallyTypedUnionProperties2_test.go
new file mode 100644
index 0000000000..9b647f8095
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForContextuallyTypedUnionProperties2_test.go
@@ -0,0 +1,49 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForContextuallyTypedUnionProperties2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface A {
+ a: number;
+ common: string;
+}
+
+interface B {
+ /*1*/b: number;
+ common: number;
+}
+
+// Assignment
+var v1: A | B = { a: 0, common: "" };
+var v2: A | B = { b: 0, common: 3 };
+
+// Function call
+function consumer(f: A | B) { }
+consumer({ a: 0, b: 0, common: 1 });
+
+// Type cast
+var c = { common: 0, b: 0 };
+
+// Array literal
+var ar: Array = [{ a: 0, common: "" }, { b: 0, common: 0 }];
+
+// Nested object literal
+var ob: { aorb: A|B } = { aorb: { b: 0, common: 0 } };
+
+// Widened type
+var w: A|B = { b:undefined, common: undefined };
+
+// Untped -- should not be included
+var u1 = { a: 0, b: 0, common: "" };
+var u2 = { b: 0, common: 0 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesForContextuallyTypedUnionProperties_test.go b/internal/fourslash/tests/gen/referencesForContextuallyTypedUnionProperties_test.go
new file mode 100644
index 0000000000..471ea513e4
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForContextuallyTypedUnionProperties_test.go
@@ -0,0 +1,49 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForContextuallyTypedUnionProperties(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface A {
+ a: number;
+ /*1*/common: string;
+}
+
+interface B {
+ b: number;
+ /*2*/common: number;
+}
+
+// Assignment
+var v1: A | B = { a: 0, /*3*/common: "" };
+var v2: A | B = { b: 0, /*4*/common: 3 };
+
+// Function call
+function consumer(f: A | B) { }
+consumer({ a: 0, b: 0, /*5*/common: 1 });
+
+// Type cast
+var c = { /*6*/common: 0, b: 0 };
+
+// Array literal
+var ar: Array = [{ a: 0, /*7*/common: "" }, { b: 0, /*8*/common: 0 }];
+
+// Nested object literal
+var ob: { aorb: A|B } = { aorb: { b: 0, /*9*/common: 0 } };
+
+// Widened type
+var w: A|B = { a:0, /*10*/common: undefined };
+
+// Untped -- should not be included
+var u1 = { a: 0, b: 0, common: "" };
+var u2 = { b: 0, common: 0 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
+}
diff --git a/internal/fourslash/tests/gen/referencesForDeclarationKeywords_test.go b/internal/fourslash/tests/gen/referencesForDeclarationKeywords_test.go
new file mode 100644
index 0000000000..48846fe766
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForDeclarationKeywords_test.go
@@ -0,0 +1,35 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForDeclarationKeywords(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Base {}
+interface Implemented1 {}
+/*classDecl1_classKeyword*/class C1 /*classDecl1_extendsKeyword*/extends Base /*classDecl1_implementsKeyword*/implements Implemented1 {
+ /*getDecl_getKeyword*/get e() { return 1; }
+ /*setDecl_setKeyword*/set e(v) {}
+}
+/*interfaceDecl1_interfaceKeyword*/interface I1 /*interfaceDecl1_extendsKeyword*/extends Base { }
+/*typeDecl_typeKeyword*/type T = { }
+/*enumDecl_enumKeyword*/enum E { }
+/*namespaceDecl_namespaceKeyword*/namespace N { }
+/*moduleDecl_moduleKeyword*/module M { }
+/*functionDecl_functionKeyword*/function fn() {}
+/*varDecl_varKeyword*/var x;
+/*letDecl_letKeyword*/let y;
+/*constDecl_constKeyword*/const z = 1;
+interface Implemented2 {}
+interface Implemented3 {}
+class C2 /*classDecl2_implementsKeyword*/implements Implemented2, Implemented3 {}
+interface I2 /*interfaceDecl2_extendsKeyword*/extends Implemented2, Implemented3 {}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "classDecl1_classKeyword", "classDecl1_extendsKeyword", "classDecl1_implementsKeyword", "classDecl2_implementsKeyword", "getDecl_getKeyword", "setDecl_setKeyword", "interfaceDecl1_interfaceKeyword", "interfaceDecl1_extendsKeyword", "interfaceDecl2_extendsKeyword", "typeDecl_typeKeyword", "enumDecl_enumKeyword", "namespaceDecl_namespaceKeyword", "moduleDecl_moduleKeyword", "functionDecl_functionKeyword", "varDecl_varKeyword", "letDecl_letKeyword", "constDecl_constKeyword")
+}
diff --git a/internal/fourslash/tests/gen/referencesForEnums_test.go b/internal/fourslash/tests/gen/referencesForEnums_test.go
new file mode 100644
index 0000000000..af587dbe88
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForEnums_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForEnums(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `enum E {
+ /*1*/value1 = 1,
+ /*2*/"/*3*/value2" = /*4*/value1,
+ /*5*/111 = 11
+}
+
+E./*6*/value1;
+E["/*7*/value2"];
+E./*8*/value2;
+E[/*9*/111];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9")
+}
diff --git a/internal/fourslash/tests/gen/referencesForExportedValues_test.go b/internal/fourslash/tests/gen/referencesForExportedValues_test.go
new file mode 100644
index 0000000000..3398a768ab
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForExportedValues_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForExportedValues(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `module M {
+ /*1*/export var /*2*/variable = 0;
+
+ // local use
+ var x = /*3*/variable;
+}
+
+// external use
+M./*4*/variable`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForExpressionKeywords_test.go b/internal/fourslash/tests/gen/referencesForExpressionKeywords_test.go
new file mode 100644
index 0000000000..6ec8b0fab4
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForExpressionKeywords_test.go
@@ -0,0 +1,30 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForExpressionKeywords(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class C {
+ static x = 1;
+}
+/*new*/new C();
+/*void*/void C;
+/*typeof*/typeof C;
+/*delete*/delete C.x;
+/*async*/async function* f() {
+ /*yield*/yield C;
+ /*await*/await C;
+}
+"x" /*in*/in C;
+undefined /*instanceof*/instanceof C;
+undefined /*as*/as C;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "new", "void", "typeof", "yield", "await", "in", "instanceof", "as", "delete")
+}
diff --git a/internal/fourslash/tests/gen/referencesForExternalModuleNames_test.go b/internal/fourslash/tests/gen/referencesForExternalModuleNames_test.go
new file mode 100644
index 0000000000..f01ce0d1ca
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForExternalModuleNames_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForExternalModuleNames(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: referencesForGlobals_1.ts
+/*1*/declare module "/*2*/foo" {
+ var f: number;
+}
+// @Filename: referencesForGlobals_2.ts
+/*3*/import f = require("/*4*/foo");`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForFunctionOverloads_test.go b/internal/fourslash/tests/gen/referencesForFunctionOverloads_test.go
new file mode 100644
index 0000000000..d3358d930d
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForFunctionOverloads_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForFunctionOverloads(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/function /*2*/foo(x: string);
+/*3*/function /*4*/foo(x: string, y: number) {
+ /*5*/foo('', 43);
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/referencesForFunctionParameter_test.go b/internal/fourslash/tests/gen/referencesForFunctionParameter_test.go
new file mode 100644
index 0000000000..3e60ab0a9b
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForFunctionParameter_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForFunctionParameter(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var x;
+var n;
+
+function n(x: number, /*1*/n: number) {
+ /*2*/n = 32;
+ x = /*3*/n;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForGlobals2_test.go b/internal/fourslash/tests/gen/referencesForGlobals2_test.go
new file mode 100644
index 0000000000..a68023c267
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForGlobals2_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForGlobals2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: referencesForGlobals_1.ts
+/*1*/class /*2*/globalClass {
+ public f() { }
+}
+// @Filename: referencesForGlobals_2.ts
+var c = /*3*/globalClass();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForGlobals3_test.go b/internal/fourslash/tests/gen/referencesForGlobals3_test.go
new file mode 100644
index 0000000000..a0fbdf23e7
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForGlobals3_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForGlobals3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: referencesForGlobals_1.ts
+/*1*/interface /*2*/globalInterface {
+ f();
+}
+// @Filename: referencesForGlobals_2.ts
+var i: /*3*/globalInterface;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForGlobals4_test.go b/internal/fourslash/tests/gen/referencesForGlobals4_test.go
new file mode 100644
index 0000000000..e7748fb210
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForGlobals4_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForGlobals4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: referencesForGlobals_1.ts
+/*1*/module /*2*/globalModule {
+ export f() { };
+}
+// @Filename: referencesForGlobals_2.ts
+var m = /*3*/globalModule;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForGlobals5_test.go b/internal/fourslash/tests/gen/referencesForGlobals5_test.go
new file mode 100644
index 0000000000..176433eab7
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForGlobals5_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForGlobals5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: referencesForGlobals_1.ts
+module globalModule {
+ export var x;
+}
+
+/*1*/import /*2*/globalAlias = globalModule;
+// @Filename: referencesForGlobals_2.ts
+var m = /*3*/globalAlias;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForGlobalsInExternalModule_test.go b/internal/fourslash/tests/gen/referencesForGlobalsInExternalModule_test.go
new file mode 100644
index 0000000000..ee69b5eaf8
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForGlobalsInExternalModule_test.go
@@ -0,0 +1,31 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForGlobalsInExternalModule(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/var /*2*/topLevelVar = 2;
+var topLevelVar2 = /*3*/topLevelVar;
+
+/*4*/class /*5*/topLevelClass { }
+var c = new /*6*/topLevelClass();
+
+/*7*/interface /*8*/topLevelInterface { }
+var i: /*9*/topLevelInterface;
+
+/*10*/module /*11*/topLevelModule {
+ export var x;
+}
+var x = /*12*/topLevelModule.x;
+
+export = x;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12")
+}
diff --git a/internal/fourslash/tests/gen/referencesForGlobals_test.go b/internal/fourslash/tests/gen/referencesForGlobals_test.go
new file mode 100644
index 0000000000..9156eec570
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForGlobals_test.go
@@ -0,0 +1,37 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForGlobals(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: referencesForGlobals_1.ts
+/*1*/var /*2*/global = 2;
+
+class foo {
+ constructor (public global) { }
+ public f(global) { }
+ public f2(global) { }
+}
+
+class bar {
+ constructor () {
+ var n = /*3*/global;
+
+ var f = new foo('');
+ f.global = '';
+ }
+}
+
+var k = /*4*/global;
+// @Filename: referencesForGlobals_2.ts
+var m = /*5*/global;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/referencesForIllegalAssignment_test.go b/internal/fourslash/tests/gen/referencesForIllegalAssignment_test.go
new file mode 100644
index 0000000000..770f3f2317
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForIllegalAssignment_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForIllegalAssignment(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `f/*1*/oo = fo/*2*/o;
+var /*bar*/bar = function () { };
+bar = bar + 1;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "bar")
+}
diff --git a/internal/fourslash/tests/gen/referencesForImports_test.go b/internal/fourslash/tests/gen/referencesForImports_test.go
new file mode 100644
index 0000000000..6f4f648f77
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForImports_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForImports(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `declare module "jquery" {
+ function $(s: string): any;
+ export = $;
+}
+/*1*/import /*2*/$ = require("jquery");
+/*3*/$("a");
+/*4*/import /*5*/$ = require("jquery");`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/referencesForIndexProperty2_test.go b/internal/fourslash/tests/gen/referencesForIndexProperty2_test.go
new file mode 100644
index 0000000000..1d761dc33a
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForIndexProperty2_test.go
@@ -0,0 +1,18 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForIndexProperty2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var a;
+a["/*1*/blah"];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesForIndexProperty3_test.go b/internal/fourslash/tests/gen/referencesForIndexProperty3_test.go
new file mode 100644
index 0000000000..2c9bb1158e
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForIndexProperty3_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForIndexProperty3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface Object {
+ /*1*/toMyString();
+}
+
+var y: Object;
+y./*2*/toMyString();
+
+var x = {};
+x["/*3*/toMyString"]();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForIndexProperty_test.go b/internal/fourslash/tests/gen/referencesForIndexProperty_test.go
new file mode 100644
index 0000000000..ca8e5b5502
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForIndexProperty_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForIndexProperty(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ /*1*/property: number;
+ /*2*/method(): void { }
+}
+
+var f: Foo;
+f["/*3*/property"];
+f["/*4*/method"];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties2_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties2_test.go
new file mode 100644
index 0000000000..455aff4272
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties2_test.go
@@ -0,0 +1,39 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface interface1 {
+ /*1*/doStuff(): void;
+}
+
+interface interface2 {
+ doStuff(): void;
+}
+
+interface interface2 extends interface1 {
+}
+
+class class1 implements interface2 {
+ doStuff() {
+
+ }
+}
+
+class class2 extends class1 {
+
+}
+
+var v: class2;
+v.doStuff();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties3_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties3_test.go
new file mode 100644
index 0000000000..48f0d4850b
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties3_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` interface interface1 extends interface1 {
+ /*1*/doStuff(): void;
+ /*2*/propName: string;
+ }
+
+ var v: interface1;
+ v./*3*/propName;
+ v./*4*/doStuff();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties4_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties4_test.go
new file mode 100644
index 0000000000..fe811d22c3
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties4_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` class class1 extends class1 {
+ /*1*/doStuff() { }
+ /*2*/propName: string;
+ }
+
+ var c: class1;
+ c./*3*/doStuff();
+ c./*4*/propName;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties5_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties5_test.go
new file mode 100644
index 0000000000..ebceec5557
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties5_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` interface interface1 extends interface1 {
+ /*1*/doStuff(): void;
+ /*2*/propName: string;
+ }
+ interface interface2 extends interface1 {
+ doStuff(): void;
+ propName: string;
+ }
+
+ var v: interface1;
+ v.propName;
+ v.doStuff();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties6_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties6_test.go
new file mode 100644
index 0000000000..87418ee6f9
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties6_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties6(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class class1 extends class1 {
+ /*1*/doStuff() { }
+}
+class class2 extends class1 {
+ doStuff() { }
+}
+
+var v: class2;
+v.doStuff();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties7_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties7_test.go
new file mode 100644
index 0000000000..c2e3b2e0ed
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties7_test.go
@@ -0,0 +1,32 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties7(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` class class1 extends class1 {
+ /*0*/doStuff() { }
+ /*1*/propName: string;
+ }
+ interface interface1 extends interface1 {
+ /*2*/doStuff(): void;
+ /*3*/propName: string;
+ }
+ class class2 extends class1 implements interface1 {
+ /*4*/doStuff() { }
+ /*5*/propName: string;
+ }
+
+ var v: class2;
+ v.doStuff();
+ v.propName;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "0", "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties8_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties8_test.go
new file mode 100644
index 0000000000..27f2aeddba
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties8_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties8(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface C extends D {
+ /*d*/propD: number;
+}
+interface D extends C {
+ propD: string;
+ /*c*/propC: number;
+}
+var d: D;
+d.propD;
+d.propC;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "d", "c")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties9_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties9_test.go
new file mode 100644
index 0000000000..e273930cf9
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties9_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties9(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = ` class D extends C {
+ /*1*/prop1: string;
+ }
+
+ class C extends D {
+ /*2*/prop1: string;
+ }
+
+ var c: C;
+ c./*3*/prop1;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForInheritedProperties_test.go b/internal/fourslash/tests/gen/referencesForInheritedProperties_test.go
new file mode 100644
index 0000000000..3b3ebac800
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForInheritedProperties_test.go
@@ -0,0 +1,36 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForInheritedProperties(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface interface1 {
+ /*1*/doStuff(): void;
+}
+
+interface interface2 extends interface1{
+ /*2*/doStuff(): void;
+}
+
+class class1 implements interface2 {
+ /*3*/doStuff() {
+
+ }
+}
+
+class class2 extends class1 {
+
+}
+
+var v: class2;
+v./*4*/doStuff();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForLabel2_test.go b/internal/fourslash/tests/gen/referencesForLabel2_test.go
new file mode 100644
index 0000000000..efefc20c15
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForLabel2_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForLabel2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var label = "label";
+while (true) {
+ if (false) break /**/label;
+ if (true) continue label;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/referencesForLabel3_test.go b/internal/fourslash/tests/gen/referencesForLabel3_test.go
new file mode 100644
index 0000000000..e371a590bc
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForLabel3_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForLabel3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/label: while (true) {
+ var label = "label";
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesForLabel4_test.go b/internal/fourslash/tests/gen/referencesForLabel4_test.go
new file mode 100644
index 0000000000..de8eae0387
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForLabel4_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForLabel4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/label: function foo(label) {
+ while (true) {
+ /*2*/break /*3*/label;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForLabel5_test.go b/internal/fourslash/tests/gen/referencesForLabel5_test.go
new file mode 100644
index 0000000000..da38cc76bf
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForLabel5_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForLabel5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/label: while (true) {
+ if (false) /*2*/break /*3*/label;
+ function blah() {
+/*4*/label: while (true) {
+ if (false) /*5*/break /*6*/label;
+ }
+ }
+ if (false) /*7*/break /*8*/label;
+ }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8")
+}
diff --git a/internal/fourslash/tests/gen/referencesForLabel6_test.go b/internal/fourslash/tests/gen/referencesForLabel6_test.go
new file mode 100644
index 0000000000..03fe557b0e
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForLabel6_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForLabel6(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/labela: while (true) {
+/*2*/labelb: while (false) { /*3*/break /*4*/labelb; }
+ break labelc;
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForLabel_test.go b/internal/fourslash/tests/gen/referencesForLabel_test.go
new file mode 100644
index 0000000000..5f5fa4a2f1
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForLabel_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForLabel(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/label: while (true) {
+ if (false) /*2*/break /*3*/label;
+ if (true) /*4*/continue /*5*/label;
+}
+
+/*6*/label: while (false) { }
+var label = "label";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6")
+}
diff --git a/internal/fourslash/tests/gen/referencesForMergedDeclarations2_test.go b/internal/fourslash/tests/gen/referencesForMergedDeclarations2_test.go
new file mode 100644
index 0000000000..082be1013c
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForMergedDeclarations2_test.go
@@ -0,0 +1,26 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForMergedDeclarations2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `module ATest {
+ export interface Bar { }
+}
+
+function ATest() { }
+
+/*1*/import /*2*/alias = ATest; // definition
+
+var a: /*3*/alias.Bar; // namespace
+/*4*/alias.call(this); // value`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForMergedDeclarations3_test.go b/internal/fourslash/tests/gen/referencesForMergedDeclarations3_test.go
new file mode 100644
index 0000000000..b885fb07d6
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForMergedDeclarations3_test.go
@@ -0,0 +1,33 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForMergedDeclarations3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `[|class /*class*/[|testClass|] {
+ static staticMethod() { }
+ method() { }
+}|]
+
+[|module /*module*/[|testClass|] {
+ export interface Bar {
+
+ }
+}|]
+
+var c1: [|testClass|];
+var c2: [|testClass|].Bar;
+[|testClass|].staticMethod();
+[|testClass|].prototype.method();
+[|testClass|].bind(this);
+new [|testClass|]();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "module", "class")
+}
diff --git a/internal/fourslash/tests/gen/referencesForMergedDeclarations4_test.go b/internal/fourslash/tests/gen/referencesForMergedDeclarations4_test.go
new file mode 100644
index 0000000000..ce391d529a
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForMergedDeclarations4_test.go
@@ -0,0 +1,35 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForMergedDeclarations4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/class /*2*/testClass {
+ static staticMethod() { }
+ method() { }
+}
+
+/*3*/module /*4*/testClass {
+ export interface Bar {
+
+ }
+ export var s = 0;
+}
+
+var c1: /*5*/testClass;
+var c2: /*6*/testClass.Bar;
+/*7*/testClass.staticMethod();
+/*8*/testClass.prototype.method();
+/*9*/testClass.bind(this);
+/*10*/testClass.s;
+new /*11*/testClass();`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11")
+}
diff --git a/internal/fourslash/tests/gen/referencesForMergedDeclarations5_test.go b/internal/fourslash/tests/gen/referencesForMergedDeclarations5_test.go
new file mode 100644
index 0000000000..a98370171a
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForMergedDeclarations5_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForMergedDeclarations5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface /*1*/Foo { }
+module /*2*/Foo { export interface Bar { } }
+function /*3*/Foo() { }
+
+export = /*4*/Foo;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForMergedDeclarations6_test.go b/internal/fourslash/tests/gen/referencesForMergedDeclarations6_test.go
new file mode 100644
index 0000000000..cfcf88cdb6
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForMergedDeclarations6_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForMergedDeclarations6(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface Foo { }
+/*1*/module /*2*/Foo {
+ export interface Bar { }
+ export module Bar { export interface Baz { } }
+ export function Bar() { }
+}
+
+// module
+import a1 = /*3*/Foo;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForMergedDeclarations7_test.go b/internal/fourslash/tests/gen/referencesForMergedDeclarations7_test.go
new file mode 100644
index 0000000000..83354b51fd
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForMergedDeclarations7_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForMergedDeclarations7(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface Foo { }
+module Foo {
+ export interface /*1*/Bar { }
+ export module /*2*/Bar { export interface Baz { } }
+ export function /*3*/Bar() { }
+}
+
+// module, value and type
+import a2 = Foo./*4*/Bar;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForMergedDeclarations8_test.go b/internal/fourslash/tests/gen/referencesForMergedDeclarations8_test.go
new file mode 100644
index 0000000000..f2486e8de1
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForMergedDeclarations8_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForMergedDeclarations8(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface Foo { }
+module Foo {
+ export interface Bar { }
+ /*1*/export module /*2*/Bar { export interface Baz { } }
+ export function Bar() { }
+}
+
+// module
+import a3 = Foo./*3*/Bar.Baz;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForMergedDeclarations_test.go b/internal/fourslash/tests/gen/referencesForMergedDeclarations_test.go
new file mode 100644
index 0000000000..5a427d3099
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForMergedDeclarations_test.go
@@ -0,0 +1,29 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForMergedDeclarations(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/interface /*2*/Foo {
+}
+
+/*3*/module /*4*/Foo {
+ export interface Bar { }
+}
+
+/*5*/function /*6*/Foo(): void {
+}
+
+var f1: /*7*/Foo.Bar;
+var f2: /*8*/Foo;
+/*9*/Foo.bind(this);`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9")
+}
diff --git a/internal/fourslash/tests/gen/referencesForModifiers_test.go b/internal/fourslash/tests/gen/referencesForModifiers_test.go
new file mode 100644
index 0000000000..2157e37b6a
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForModifiers_test.go
@@ -0,0 +1,27 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForModifiers(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `[|/*declareModifier*/declare /*abstractModifier*/abstract class C1 {
+ [|/*staticModifier*/static a;|]
+ [|/*readonlyModifier*/readonly b;|]
+ [|/*publicModifier*/public c;|]
+ [|/*protectedModifier*/protected d;|]
+ [|/*privateModifier*/private e;|]
+}|]
+[|/*constModifier*/const enum E {
+}|]
+[|/*asyncModifier*/async function fn() {}|]
+[|/*exportModifier*/export /*defaultModifier*/default class C2 {}|]`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "declareModifier", "abstractModifier", "staticModifier", "readonlyModifier", "publicModifier", "protectedModifier", "privateModifier", "constModifier", "asyncModifier", "exportModifier", "defaultModifier")
+}
diff --git a/internal/fourslash/tests/gen/referencesForNoContext_test.go b/internal/fourslash/tests/gen/referencesForNoContext_test.go
new file mode 100644
index 0000000000..dd1d223397
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForNoContext_test.go
@@ -0,0 +1,36 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForNoContext(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `module modTest {
+ //Declare
+ export var modVar:number;
+ /*1*/
+
+ //Increments
+ modVar++;
+
+ class testCls{
+ /*2*/
+ }
+
+ function testFn(){
+ //Increments
+ modVar++;
+ } /*3*/
+/*4*/
+ module testMod {
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForNumericLiteralPropertyNames_test.go b/internal/fourslash/tests/gen/referencesForNumericLiteralPropertyNames_test.go
new file mode 100644
index 0000000000..8940ca7c27
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForNumericLiteralPropertyNames_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForNumericLiteralPropertyNames(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ public /*1*/12: any;
+}
+
+var x: Foo;
+x[12];
+x = { "12": 0 };
+x = { 12: 0 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesForObjectLiteralProperties_test.go b/internal/fourslash/tests/gen/referencesForObjectLiteralProperties_test.go
new file mode 100644
index 0000000000..80ffe95456
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForObjectLiteralProperties_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForObjectLiteralProperties(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var x = { /*1*/add: 0, b: "string" };
+x["/*2*/add"];
+x./*3*/add;
+var y = x;
+y./*4*/add;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesForOverrides_test.go b/internal/fourslash/tests/gen/referencesForOverrides_test.go
new file mode 100644
index 0000000000..c428243a11
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForOverrides_test.go
@@ -0,0 +1,90 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForOverrides(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `module FindRef3 {
+ module SimpleClassTest {
+ export class Foo {
+ public /*foo*/foo(): void {
+ }
+ }
+ export class Bar extends Foo {
+ public foo(): void {
+ }
+ }
+ }
+
+ module SimpleInterfaceTest {
+ export interface IFoo {
+ /*ifoo*/ifoo(): void;
+ }
+ export interface IBar extends IFoo {
+ ifoo(): void;
+ }
+ }
+
+ module SimpleClassInterfaceTest {
+ export interface IFoo {
+ /*icfoo*/icfoo(): void;
+ }
+ export class Bar implements IFoo {
+ public icfoo(): void {
+ }
+ }
+ }
+
+ module Test {
+ export interface IBase {
+ /*field*/field: string;
+ /*method*/method(): void;
+ }
+
+ export interface IBlah extends IBase {
+ field: string;
+ }
+
+ export interface IBlah2 extends IBlah {
+ field: string;
+ }
+
+ export interface IDerived extends IBlah2 {
+ method(): void;
+ }
+
+ export class Bar implements IDerived {
+ public field: string;
+ public method(): void { }
+ }
+
+ export class BarBlah extends Bar {
+ public field: string;
+ }
+ }
+
+ function test() {
+ var x = new SimpleClassTest.Bar();
+ x.foo();
+
+ var y: SimpleInterfaceTest.IBar = null;
+ y.ifoo();
+
+ var w: SimpleClassInterfaceTest.Bar = null;
+ w.icfoo();
+
+ var z = new Test.BarBlah();
+ z.field = "";
+ z.method();
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "foo", "ifoo", "icfoo", "field", "method")
+}
diff --git a/internal/fourslash/tests/gen/referencesForPropertiesOfGenericType_test.go b/internal/fourslash/tests/gen/referencesForPropertiesOfGenericType_test.go
new file mode 100644
index 0000000000..6172ff9100
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForPropertiesOfGenericType_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForPropertiesOfGenericType(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface IFoo {
+ /*1*/doSomething(v: T): T;
+}
+
+var x: IFoo;
+x./*2*/doSomething("ss");
+
+var y: IFoo;
+y./*3*/doSomething(12);`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStatementKeywords_test.go b/internal/fourslash/tests/gen/referencesForStatementKeywords_test.go
new file mode 100644
index 0000000000..bde9db9024
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStatementKeywords_test.go
@@ -0,0 +1,69 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStatementKeywords(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @filename: /main.ts
+// import ... = ...
+[|{| "id": "importEqualsDecl1" |}/*importEqualsDecl1_importKeyword*/[|import|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importEqualsDecl1" |}A|] = /*importEqualsDecl1_requireKeyword*/[|require|]("[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importEqualsDecl1" |}./a|]");|]
+[|{| "id": "namespaceDecl1" |}namespace [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "namespaceDecl1" |}N|] { }|]
+[|{| "id": "importEqualsDecl2" |}/*importEqualsDecl2_importKeyword*/[|import|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importEqualsDecl2" |}N2|] = [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importEqualsDecl2" |}N|];|]
+
+// import ... from ...
+[|{| "id": "importDecl1" |}/*importDecl1_importKeyword*/[|import|] /*importDecl1_typeKeyword*/[|type|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importDecl1" |}B|] /*importDecl1_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl1" |}./b|]";|]
+[|{| "id": "importDecl2" |}/*importDecl2_importKeyword*/[|import|] /*importDecl2_typeKeyword*/[|type|] * /*importDecl2_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importDecl2" |}C|] /*importDecl2_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl2" |}./c|]";|]
+[|{| "id": "importDecl3" |}/*importDecl3_importKeyword*/[|import|] /*importDecl3_typeKeyword*/[|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importDecl3" |}D|] } /*importDecl3_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl3" |}./d|]";|]
+[|{| "id": "importDecl4" |}/*importDecl4_importKeyword*/[|import|] /*importDecl4_typeKeyword*/[|type|] { e1, e2 /*importDecl4_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "importDecl4" |}e3|] } /*importDecl4_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl4" |}./e|]";|]
+
+// import "module"
+[|{| "id": "importDecl5" |}/*importDecl5_importKeyword*/[|import|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "importDecl5" |}./f|]";|]
+
+// export ... from ...
+[|{| "id": "exportDecl1" |}/*exportDecl1_exportKeyword*/[|export|] /*exportDecl1_typeKeyword*/[|type|] * /*exportDecl1_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl1" |}./g|]";|]
+[|{| "id": "exportDecl2" |}/*exportDecl2_exportKeyword*/[|export|] /*exportDecl2_typeKeyword*/[|type|] [|{| "id": "exportDecl2_namespaceExport" |}* /*exportDecl2_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl2" |}H|]|] /*exportDecl2_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl2" |}./h|]";|]
+[|{| "id": "exportDecl3" |}/*exportDecl3_exportKeyword*/[|export|] /*exportDecl3_typeKeyword*/[|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl3" |}I|] } /*exportDecl3_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl3" |}./i|]";|]
+[|{| "id": "exportDecl4" |}/*exportDecl4_exportKeyword*/[|export|] /*exportDecl4_typeKeyword*/[|type|] { j1, j2 /*exportDecl4_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl4" |}j3|] } /*exportDecl4_fromKeyword*/[|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl4" |}./j|]";|]
+[|{| "id": "typeDecl1" |}type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "typeDecl1" |}Z1|] = 1;|]
+[|{| "id": "exportDecl5" |}/*exportDecl5_exportKeyword*/[|export|] /*exportDecl5_typeKeyword*/[|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl5" |}Z1|] };|]
+type Z2 = 2;
+type Z3 = 3;
+[|{| "id": "exportDecl6" |}/*exportDecl6_exportKeyword*/[|export|] /*exportDecl6_typeKeyword*/[|type|] { z2, z3 /*exportDecl6_asKeyword*/[|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl6" |}z4|] };|]
+// @filename: /main2.ts
+[|{| "id": "varDecl1" |}const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "varDecl1" |}x|] = {};|]
+[|{| "id": "exportAssignment1" |}/*exportAssignment1_exportKeyword*/[|export|] = [|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportAssignment1"|}x|];|]
+// @filename: /main3.ts
+[|{| "id": "varDecl3" |}const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "varDecl3" |}y|] = {};|]
+[|{| "id": "exportAssignment2" |}/*exportAssignment2_exportKeyword*/[|export|] [|default|] [|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportAssignment2"|}y|];|]
+// @filename: /a.ts
+export const a = 1;
+// @filename: /b.ts
+[|{| "id": "classDecl1" |}export default class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "classDecl1" |}B|] {}|]
+// @filename: /c.ts
+export const c = 1;
+// @filename: /d.ts
+[|{| "id": "classDecl2" |}export class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "classDecl2" |}D|] {}|]
+// @filename: /e.ts
+export const e1 = 1;
+export const e2 = 2;
+// @filename: /f.ts
+export const f = 1;
+// @filename: /g.ts
+export const g = 1;
+// @filename: /h.ts
+export const h = 1;
+// @filename: /i.ts
+[|{| "id": "classDecl3" |}export class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "classDecl3" |}I|] {}|]
+// @filename: /j.ts
+export const j1 = 1;
+export const j2 = 2;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "importEqualsDecl1_importKeyword", "importEqualsDecl1_requireKeyword", "importEqualsDecl2_importKeyword", "importDecl1_importKeyword", "importDecl1_typeKeyword", "importDecl1_fromKeyword", "importDecl2_importKeyword", "importDecl2_typeKeyword", "importDecl2_asKeyword", "importDecl2_fromKeyword", "importDecl3_importKeyword", "importDecl3_typeKeyword", "importDecl3_fromKeyword", "importDecl4_importKeyword", "importDecl4_typeKeyword", "importDecl4_fromKeyword", "importDecl4_asKeyword", "importDecl5_importKeyword", "exportDecl1_exportKeyword", "exportDecl1_typeKeyword", "exportDecl1_fromKeyword", "exportDecl2_exportKeyword", "exportDecl2_typeKeyword", "exportDecl2_asKeyword", "exportDecl2_fromKeyword", "exportDecl3_exportKeyword", "exportDecl3_typeKeyword", "exportDecl3_fromKeyword", "exportDecl4_exportKeyword", "exportDecl4_typeKeyword", "exportDecl4_fromKeyword", "exportDecl4_asKeyword", "exportDecl5_exportKeyword", "exportDecl5_typeKeyword", "exportDecl6_exportKeyword", "exportDecl6_typeKeyword", "exportDecl6_asKeyword", "exportAssignment1_exportKeyword", "exportAssignment2_exportKeyword")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStatic_test.go b/internal/fourslash/tests/gen/referencesForStatic_test.go
new file mode 100644
index 0000000000..84434f05fb
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStatic_test.go
@@ -0,0 +1,42 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStatic(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: referencesOnStatic_1.ts
+var n = 43;
+
+class foo {
+ /*1*/static /*2*/n = '';
+
+ public bar() {
+ foo./*3*/n = "'";
+ if(foo./*4*/n) {
+ var x = foo./*5*/n;
+ }
+ }
+}
+
+class foo2 {
+ private x = foo./*6*/n;
+ constructor() {
+ foo./*7*/n = x;
+ }
+
+ function b(n) {
+ n = foo./*8*/n;
+ }
+}
+// @Filename: referencesOnStatic_2.ts
+var q = foo./*9*/n;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStaticsAndMembersWithSameNames_test.go b/internal/fourslash/tests/gen/referencesForStaticsAndMembersWithSameNames_test.go
new file mode 100644
index 0000000000..cae12914f9
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStaticsAndMembersWithSameNames_test.go
@@ -0,0 +1,40 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStaticsAndMembersWithSameNames(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `module FindRef4 {
+ module MixedStaticsClassTest {
+ export class Foo {
+ /*1*/bar: Foo;
+ /*2*/static /*3*/bar: Foo;
+
+ /*4*/public /*5*/foo(): void {
+ }
+ /*6*/public static /*7*/foo(): void {
+ }
+ }
+ }
+
+ function test() {
+ // instance function
+ var x = new MixedStaticsClassTest.Foo();
+ x./*8*/foo();
+ x./*9*/bar;
+
+ // static function
+ MixedStaticsClassTest.Foo./*10*/foo();
+ MixedStaticsClassTest.Foo./*11*/bar;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames2_test.go b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames2_test.go
new file mode 100644
index 0000000000..b804e7556e
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames2_test.go
@@ -0,0 +1,22 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStringLiteralPropertyNames2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ /*1*/"/*2*/blah"() { return 0; }
+}
+
+var x: Foo;
+x./*3*/blah;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames3_test.go b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames3_test.go
new file mode 100644
index 0000000000..f43888eb6d
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames3_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStringLiteralPropertyNames3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo2 {
+ /*1*/get "/*2*/42"() { return 0; }
+ /*3*/set /*4*/42(n) { }
+}
+
+var y: Foo2;
+y[/*5*/42];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames4_test.go b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames4_test.go
new file mode 100644
index 0000000000..033bfa432d
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames4_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStringLiteralPropertyNames4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var x = { "/*1*/someProperty": 0 }
+x[/*2*/"someProperty"] = 3;
+x.someProperty = 5;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames5_test.go b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames5_test.go
new file mode 100644
index 0000000000..f8e1ce2aa3
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames5_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStringLiteralPropertyNames5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `var x = { "/*1*/someProperty": 0 }
+x["/*2*/someProperty"] = 3;
+x.someProperty = 5;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames6_test.go b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames6_test.go
new file mode 100644
index 0000000000..646c17e9f1
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames6_test.go
@@ -0,0 +1,19 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStringLiteralPropertyNames6(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `const x = function () { return 111111; }
+x./*1*/someProperty = 5;
+x["/*2*/someProperty"] = 3;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames7_test.go b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames7_test.go
new file mode 100644
index 0000000000..4b3f174c07
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames7_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStringLiteralPropertyNames7(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: foo.js
+// @noEmit: true
+// @allowJs: true
+// @checkJs: true
+var x = { "/*1*/someProperty": 0 }
+x["/*2*/someProperty"] = 3;
+x.someProperty = 5;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames_test.go b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames_test.go
new file mode 100644
index 0000000000..14c62731c7
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForStringLiteralPropertyNames_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForStringLiteralPropertyNames(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `class Foo {
+ public "/*1*/ss": any;
+}
+
+var x: Foo;
+x.ss;
+x["ss"];
+x = { "ss": 0 };
+x = { ss: 0 };`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesForTypeKeywords_test.go b/internal/fourslash/tests/gen/referencesForTypeKeywords_test.go
new file mode 100644
index 0000000000..f7ed16407f
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForTypeKeywords_test.go
@@ -0,0 +1,23 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForTypeKeywords(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface I {}
+function f() {}
+type A1 = T /*conditionalType_extendsKeyword*/extends U ? 1 : 0;
+type A2 = T extends /*inferType_inferKeyword*/infer U ? 1 : 0;
+type A3 = { [P /*mappedType_inOperator*/in keyof T]: 1 };
+type A4 = /*keyofOperator_keyofKeyword*/keyof T;
+type A5 = /*readonlyOperator_readonlyKeyword*/readonly T[];`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "typeParam_extendsKeyword", "conditionalType_extendsKeyword", "inferType_inferKeyword", "mappedType_inOperator", "keyofOperator_keyofKeyword", "readonlyOperator_readonlyKeyword")
+}
diff --git a/internal/fourslash/tests/gen/referencesForUnionProperties_test.go b/internal/fourslash/tests/gen/referencesForUnionProperties_test.go
new file mode 100644
index 0000000000..678abc04dc
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesForUnionProperties_test.go
@@ -0,0 +1,37 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesForUnionProperties(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `interface One {
+ common: { /*one*/a: number; };
+}
+
+interface Base {
+ /*base*/a: string;
+ b: string;
+}
+
+interface HasAOrB extends Base {
+ a: string;
+ b: string;
+}
+
+interface Two {
+ common: HasAOrB;
+}
+
+var x : One | Two;
+
+x.common./*x*/a;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "one", "base", "x")
+}
diff --git a/internal/fourslash/tests/gen/referencesInComment_test.go b/internal/fourslash/tests/gen/referencesInComment_test.go
new file mode 100644
index 0000000000..91e2e6fe2c
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesInComment_test.go
@@ -0,0 +1,20 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesInComment(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// References to /*1*/foo or b/*2*/ar
+/* in comments should not find fo/*3*/o or bar/*4*/ */
+class foo { }
+var bar = 0;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/referencesInConfiguredProject_test.go b/internal/fourslash/tests/gen/referencesInConfiguredProject_test.go
new file mode 100644
index 0000000000..618ebb7428
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesInConfiguredProject_test.go
@@ -0,0 +1,24 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesInConfiguredProject(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /home/src/workspaces/project/referencesForGlobals_1.ts
+class /*0*/globalClass {
+ public f() { }
+}
+// @Filename: /home/src/workspaces/project/referencesForGlobals_2.ts
+var c = /*1*/globalClass();
+// @Filename: /home/src/workspaces/project/tsconfig.json
+{ "files": ["referencesForGlobals_1.ts", "referencesForGlobals_2.ts"] }`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesInEmptyFileWithMultipleProjects_test.go b/internal/fourslash/tests/gen/referencesInEmptyFileWithMultipleProjects_test.go
new file mode 100644
index 0000000000..04141f4343
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesInEmptyFileWithMultipleProjects_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesInEmptyFileWithMultipleProjects(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /home/src/workspaces/project/a/tsconfig.json
+{ "files": ["a.ts"] }
+// @Filename: /home/src/workspaces/project/a/a.ts
+///
+/*1*/;
+// @Filename: /home/src/workspaces/project/b/tsconfig.json
+{ "files": ["b.ts"] }
+// @Filename: /home/src/workspaces/project/b/b.ts
+/*2*/;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/referencesInEmptyFile_test.go b/internal/fourslash/tests/gen/referencesInEmptyFile_test.go
new file mode 100644
index 0000000000..57bc1bfe21
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesInEmptyFile_test.go
@@ -0,0 +1,17 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesInEmptyFile(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `/*1*/`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesInStringLiteralValueWithMultipleProjects_test.go b/internal/fourslash/tests/gen/referencesInStringLiteralValueWithMultipleProjects_test.go
new file mode 100644
index 0000000000..2cbc1cc5d7
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesInStringLiteralValueWithMultipleProjects_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesInStringLiteralValueWithMultipleProjects(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /home/src/workspaces/project/a/tsconfig.json
+{ "files": ["a.ts"] }
+// @Filename: /home/src/workspaces/project/a/a.ts
+///
+const str: string = "hello/*1*/";
+// @Filename: /home/src/workspaces/project/b/tsconfig.json
+{ "files": ["b.ts"] }
+// @Filename: /home/src/workspaces/project/b/b.ts
+const str2: string = "hello/*2*/";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/referencesIsAvailableThroughGlobalNoCrash_test.go b/internal/fourslash/tests/gen/referencesIsAvailableThroughGlobalNoCrash_test.go
new file mode 100644
index 0000000000..d7f6558e51
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesIsAvailableThroughGlobalNoCrash_test.go
@@ -0,0 +1,29 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesIsAvailableThroughGlobalNoCrash(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: /packages/playwright-core/bundles/utils/node_modules/@types/debug/index.d.ts
+declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug };
+export = debug;
+export as namespace debug;
+declare namespace debug {
+ interface Debug {
+ coerce: (val: any) => any;
+ }
+}
+// @Filename: /packages/playwright-core/bundles/utils/node_modules/@types/debug/package.json
+{ "types": "index.d.ts" }
+// @Filename: /packages/playwright-core/src/index.ts
+export const debug: typeof import('../bundles/utils/node_modules//*1*/@types/debug') = require('./utilsBundleImpl').debug;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesToNonPropertyNameStringLiteral_test.go b/internal/fourslash/tests/gen/referencesToNonPropertyNameStringLiteral_test.go
new file mode 100644
index 0000000000..43e383c407
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesToNonPropertyNameStringLiteral_test.go
@@ -0,0 +1,17 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesToNonPropertyNameStringLiteral(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `const str: string = "hello/*1*/";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/referencesToStringLiteralValue_test.go b/internal/fourslash/tests/gen/referencesToStringLiteralValue_test.go
new file mode 100644
index 0000000000..8db6a6fca4
--- /dev/null
+++ b/internal/fourslash/tests/gen/referencesToStringLiteralValue_test.go
@@ -0,0 +1,17 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestReferencesToStringLiteralValue(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `const s: string = "some /*1*/ string";`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/remoteGetReferences_test.go b/internal/fourslash/tests/gen/remoteGetReferences_test.go
new file mode 100644
index 0000000000..4781235aaf
--- /dev/null
+++ b/internal/fourslash/tests/gen/remoteGetReferences_test.go
@@ -0,0 +1,191 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestRemoteGetReferences(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: remoteGetReferences_1.ts
+// Comment Refence Test: globalVar
+var globalVar: number = 2;
+
+class fooCls {
+ static clsSVar = 1;
+ //Declare
+ clsVar = 1;
+
+ constructor (public clsParam: number) {
+ //Increments
+ globalVar++;
+ this.clsVar++;
+ fooCls.clsSVar++;
+ this.clsParam++;
+ modTest.modVar++;
+ }
+}
+
+function foo(x: number) {
+ //Declare
+ var fnVar = 1;
+
+ //Increments
+ fooCls.clsSVar++;
+ globalVar++;
+ modTest.modVar++;
+ fnVar++;
+
+ //Return
+ return x++;
+}
+
+module modTest {
+ //Declare
+ export var modVar:number;
+
+ //Increments
+ globalVar++;
+ fooCls.clsSVar++;
+ modVar++;
+
+ class testCls {
+ static boo = foo;
+ }
+
+ function testFn(){
+ static boo = foo;
+
+ //Increments
+ globalVar++;
+ fooCls.clsSVar++;
+ modVar++;
+ }
+
+ module testMod {
+ var boo = foo;
+ }
+}
+
+//Type test
+var clsTest: fooCls;
+
+//Arguments
+clsTest = new fooCls(globalVar);
+foo(globalVar);
+
+//Increments
+fooCls.clsSVar++;
+modTest.modVar++;
+globalVar = globalVar + globalVar;
+
+//ETC - Other cases
+globalVar = 3;
+foo = foo + 1;
+err = err++;
+
+//Shadowed fn Parameter
+function shdw(globalVar: number) {
+ //Increments
+ globalVar++;
+ return globalVar;
+}
+
+//Remotes
+//Type test
+var remoteclsTest: /*1*/remotefooCls;
+
+//Arguments
+remoteclsTest = new /*2*/remotefooCls(/*3*/remoteglobalVar);
+remotefoo(/*4*/remoteglobalVar);
+
+//Increments
+/*5*/remotefooCls./*6*/remoteclsSVar++;
+remotemodTest.remotemodVar++;
+/*7*/remoteglobalVar = /*8*/remoteglobalVar + /*9*/remoteglobalVar;
+
+//ETC - Other cases
+/*10*/remoteglobalVar = 3;
+
+//Find References misses method param
+var
+
+
+
+ array = ["f", "o", "o"];
+
+array.forEach(
+
+
+function(str) {
+
+
+
+ return str + " ";
+
+});
+// @Filename: remoteGetReferences_2.ts
+/*11*/var /*12*/remoteglobalVar: number = 2;
+
+/*13*/class /*14*/remotefooCls {
+ //Declare
+ /*15*/remoteclsVar = 1;
+ /*16*/static /*17*/remoteclsSVar = 1;
+
+ constructor(public remoteclsParam: number) {
+ //Increments
+ /*18*/remoteglobalVar++;
+ this./*19*/remoteclsVar++;
+ /*20*/remotefooCls./*21*/remoteclsSVar++;
+ this.remoteclsParam++;
+ remotemodTest.remotemodVar++;
+ }
+}
+
+function remotefoo(remotex: number) {
+ //Declare
+ var remotefnVar = 1;
+
+ //Increments
+ /*22*/remotefooCls./*23*/remoteclsSVar++;
+ /*24*/remoteglobalVar++;
+ remotemodTest.remotemodVar++;
+ remotefnVar++;
+
+ //Return
+ return remotex++;
+}
+
+module remotemodTest {
+ //Declare
+ export var remotemodVar: number;
+
+ //Increments
+ /*25*/remoteglobalVar++;
+ /*26*/remotefooCls./*27*/remoteclsSVar++;
+ remotemodVar++;
+
+ class remotetestCls {
+ static remoteboo = remotefoo;
+ }
+
+ function remotetestFn(){
+ static remoteboo = remotefoo;
+
+ //Increments
+ /*28*/remoteglobalVar++;
+ /*29*/remotefooCls./*30*/remoteclsSVar++;
+ remotemodVar++;
+ }
+
+ module remotetestMod {
+ var remoteboo = remotefoo;
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30")
+}
diff --git a/internal/fourslash/tests/gen/renameJsExports02_test.go b/internal/fourslash/tests/gen/renameJsExports02_test.go
new file mode 100644
index 0000000000..cd8ee36596
--- /dev/null
+++ b/internal/fourslash/tests/gen/renameJsExports02_test.go
@@ -0,0 +1,21 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestRenameJsExports02(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: a.js
+module.exports = class /*1*/A {}
+// @Filename: b.js
+const /*2*/A = require("./a");`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2")
+}
diff --git a/internal/fourslash/tests/gen/renameJsExports03_test.go b/internal/fourslash/tests/gen/renameJsExports03_test.go
new file mode 100644
index 0000000000..4e4415d72e
--- /dev/null
+++ b/internal/fourslash/tests/gen/renameJsExports03_test.go
@@ -0,0 +1,25 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestRenameJsExports03(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @allowJs: true
+// @Filename: a.js
+class /*1*/A {
+ /*2*/constructor() { }
+}
+module.exports = A;
+// @Filename: b.js
+const /*3*/A = require("./a");
+new /*4*/A;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/tslibFindAllReferencesOnRuntimeImportWithPaths1_test.go b/internal/fourslash/tests/gen/tslibFindAllReferencesOnRuntimeImportWithPaths1_test.go
new file mode 100644
index 0000000000..0abd8e3240
--- /dev/null
+++ b/internal/fourslash/tests/gen/tslibFindAllReferencesOnRuntimeImportWithPaths1_test.go
@@ -0,0 +1,37 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTslibFindAllReferencesOnRuntimeImportWithPaths1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `// @Filename: project/src/foo.ts
+import * as x from /**/"tslib";
+// @Filename: project/src/bar.ts
+export default "";
+// @Filename: project/src/bal.ts
+
+// @Filename: project/src/dir/tslib.d.ts
+export function __importDefault(...args: any): any;
+export function __importStar(...args: any): any;
+// @Filename: project/tsconfig.json
+{
+ "compilerOptions": {
+ "moduleResolution": "node",
+ "module": "es2020",
+ "importHelpers": true,
+ "moduleDetection": "force",
+ "paths": {
+ "tslib": ["./src/dir/tslib"]
+ }
+ }
+}`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences10_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences10_test.go
new file mode 100644
index 0000000000..5f8d62dba5
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences10_test.go
@@ -0,0 +1,44 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences10(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props; }
+ }
+ interface ClickableProps {
+ children?: string;
+ className?: string;
+ }
+ interface ButtonProps extends ClickableProps {
+ /*1*/onClick(event?: React.MouseEvent): void;
+ }
+ interface LinkProps extends ClickableProps {
+ goTo: string;
+ }
+ declare function MainButton(buttonProps: ButtonProps): JSX.Element;
+ declare function MainButton(linkProps: LinkProps): JSX.Element;
+ declare function MainButton(props: ButtonProps | LinkProps): JSX.Element;
+ let opt = ;
+ let opt = ;
+ let opt = {}} />;
+ let opt = {}} ignore-prop />;
+ let opt = ;
+ let opt = ;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences11_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences11_test.go
new file mode 100644
index 0000000000..31e45fa9de
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences11_test.go
@@ -0,0 +1,39 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences11(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props; }
+ }
+ interface ClickableProps {
+ children?: string;
+ className?: string;
+ }
+ interface ButtonProps extends ClickableProps {
+ onClick(event?: React.MouseEvent): void;
+ }
+ interface LinkProps extends ClickableProps {
+ goTo: string;
+ }
+ declare function MainButton(buttonProps: ButtonProps): JSX.Element;
+ declare function MainButton(linkProps: LinkProps): JSX.Element;
+ declare function MainButton(props: ButtonProps | LinkProps): JSX.Element;
+ let opt = ;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences1_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences1_test.go
new file mode 100644
index 0000000000..b7dc7d442f
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences1_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ /*1*/div: {
+ name?: string;
+ isOpen?: boolean;
+ };
+ span: { n: string; };
+ }
+ }
+ var x = /*2*/*3*/div />;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences2_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences2_test.go
new file mode 100644
index 0000000000..e7631db8b4
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences2_test.go
@@ -0,0 +1,28 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ div: {
+ /*1*/name?: string;
+ isOpen?: boolean;
+ };
+ span: { n: string; };
+ }
+ }
+ var x = ;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences3_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences3_test.go
new file mode 100644
index 0000000000..001241a3f8
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences3_test.go
@@ -0,0 +1,31 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences3(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props }
+ }
+ class MyClass {
+ props: {
+ /*1*/name?: string;
+ size?: number;
+ }
+
+
+ var x = ;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences4_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences4_test.go
new file mode 100644
index 0000000000..3221f7255d
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences4_test.go
@@ -0,0 +1,31 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences4(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props }
+ }
+ /*1*/class /*2*/MyClass {
+ props: {
+ name?: string;
+ size?: number;
+ }
+
+
+ var x = /*3*/*4*/MyClass name='hello'>/*5*/MyClass>;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences5_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences5_test.go
new file mode 100644
index 0000000000..3b06c56a3e
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences5_test.go
@@ -0,0 +1,36 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences5(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props; }
+ }
+ interface OptionPropBag {
+ propx: number
+ propString: string
+ optional?: boolean
+ }
+ /*1*/declare function /*2*/Opt(attributes: OptionPropBag): JSX.Element;
+ let opt = /*3*/*4*/Opt />;
+ let opt1 = /*5*/*6*/Opt propx={100} propString />;
+ let opt2 = /*7*/*8*/Opt propx={100} optional/>;
+ let opt3 = /*9*/*10*/Opt wrong />;
+ let opt4 = /*11*/*12*/Opt propx={100} propString="hi" />;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences6_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences6_test.go
new file mode 100644
index 0000000000..96922cf8d6
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences6_test.go
@@ -0,0 +1,32 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences6(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props; }
+ }
+ interface OptionPropBag {
+ propx: number
+ propString: string
+ optional?: boolean
+ }
+ declare function Opt(attributes: OptionPropBag): JSX.Element;
+ let opt = ;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences7_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences7_test.go
new file mode 100644
index 0000000000..66a1e9d48d
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences7_test.go
@@ -0,0 +1,35 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences7(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props; }
+ }
+ interface OptionPropBag {
+ /*1*/propx: number
+ propString: string
+ optional?: boolean
+ }
+ declare function Opt(attributes: OptionPropBag): JSX.Element;
+ let opt = ;
+ let opt1 = ;
+ let opt2 = ;
+ let opt3 = ;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences8_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences8_test.go
new file mode 100644
index 0000000000..77818118d9
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences8_test.go
@@ -0,0 +1,44 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences8(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props; }
+ }
+ interface ClickableProps {
+ children?: string;
+ className?: string;
+ }
+ interface ButtonProps extends ClickableProps {
+ onClick(event?: React.MouseEvent): void;
+ }
+ interface LinkProps extends ClickableProps {
+ goTo: string;
+ }
+ /*1*/declare function /*2*/MainButton(buttonProps: ButtonProps): JSX.Element;
+ /*3*/declare function /*4*/MainButton(linkProps: LinkProps): JSX.Element;
+ /*5*/declare function /*6*/MainButton(props: ButtonProps | LinkProps): JSX.Element;
+ let opt = /*7*/*8*/MainButton />;
+ let opt = /*9*/*10*/MainButton children="chidlren" />;
+ let opt = /*11*/*12*/MainButton onClick={()=>{}} />;
+ let opt = /*13*/*14*/MainButton onClick={()=>{}} ignore-prop />;
+ let opt = /*15*/*16*/MainButton goTo="goTo" />;
+ let opt = /*17*/*18*/MainButton wrong />;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferences9_test.go b/internal/fourslash/tests/gen/tsxFindAllReferences9_test.go
new file mode 100644
index 0000000000..a8b2e41414
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferences9_test.go
@@ -0,0 +1,45 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferences9(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props; }
+ }
+ interface ClickableProps {
+ children?: string;
+ className?: string;
+ }
+ interface ButtonProps extends ClickableProps {
+ onClick(event?: React.MouseEvent): void;
+ }
+ interface LinkProps extends ClickableProps {
+ /*1*/goTo: string;
+ }
+ declare function MainButton(buttonProps: ButtonProps): JSX.Element;
+ declare function MainButton(linkProps: LinkProps): JSX.Element;
+ declare function MainButton(props: ButtonProps | LinkProps): JSX.Element;
+ let opt = ;
+ let opt = ;
+ let opt = {}} />;
+ let opt = {}} ignore-prop />;
+ let opt = ;
+ let opt = ;
+ let opt = ;`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferencesUnionElementType1_test.go b/internal/fourslash/tests/gen/tsxFindAllReferencesUnionElementType1_test.go
new file mode 100644
index 0000000000..b4e3518efc
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferencesUnionElementType1_test.go
@@ -0,0 +1,33 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferencesUnionElementType1(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ declare module JSX {
+ interface Element { }
+ interface IntrinsicElements {
+ }
+ interface ElementAttributesProperty { props; }
+ }
+ function SFC1(prop: { x: number }) {
+ return hello
;
+ };
+ function SFC2(prop: { x: boolean }) {
+ return World
;
+ }
+ /*1*/var /*2*/SFCComp = SFC1 || SFC2;
+ /*3*/*4*/SFCComp x={ "hi" } />`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/fourslash/tests/gen/tsxFindAllReferencesUnionElementType2_test.go b/internal/fourslash/tests/gen/tsxFindAllReferencesUnionElementType2_test.go
new file mode 100644
index 0000000000..704de86965
--- /dev/null
+++ b/internal/fourslash/tests/gen/tsxFindAllReferencesUnionElementType2_test.go
@@ -0,0 +1,32 @@
+package fourslash_test
+
+import (
+ "testing"
+
+ "github.com/microsoft/typescript-go/internal/fourslash"
+ "github.com/microsoft/typescript-go/internal/testutil"
+)
+
+func TestTsxFindAllReferencesUnionElementType2(t *testing.T) {
+ t.Parallel()
+
+ defer testutil.RecoverAndFail(t, "Panic on fourslash test")
+ const content = `//@Filename: file.tsx
+// @jsx: preserve
+// @noLib: true
+ class RC1 extends React.Component<{}, {}> {
+ render() {
+ return null;
+ }
+ }
+ class RC2 extends React.Component<{}, {}> {
+ render() {
+ return null;
+ }
+ private method() { }
+ }
+ /*1*/var /*2*/RCComp = RC1 || RC2;
+ /*3*/*4*/RCComp />`
+ f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
+ f.VerifyBaselineFindAllReferences(t, "1", "2", "3", "4")
+}
diff --git a/internal/ls/findallreferences_test.go b/internal/ls/findallreferences_test.go
index 7030fd85c7..0dd99f44e3 100644
--- a/internal/ls/findallreferences_test.go
+++ b/internal/ls/findallreferences_test.go
@@ -23,7 +23,7 @@ func runFindReferencesTest(t *testing.T, input string, expectedLocations map[str
// for each marker location, calculate the expected ref location ahead of time so we don't have to re-calculate each location for every reference call
allExpectedLocations := map[lsproto.Location]string{}
for _, expectedRange := range testData.Ranges {
- allExpectedLocations[*service.GetExpectedReferenceFromMarker(expectedRange.FileName, expectedRange.Position)] = expectedRange.Name
+ allExpectedLocations[*service.GetExpectedReferenceFromMarker(expectedRange.FileName(), expectedRange.Position)] = expectedRange.Name
}
for requestMarkerName, expectedSet := range expectedLocations {
@@ -32,7 +32,7 @@ func runFindReferencesTest(t *testing.T, input string, expectedLocations map[str
t.Fatalf("No marker found for '%s'", requestMarkerName)
}
- referencesResult := service.TestProvideReferences(marker.FileName, marker.Position)
+ referencesResult := service.TestProvideReferences(marker.FileName(), marker.Position)
libReference := 0
for _, loc := range referencesResult {
diff --git a/internal/ls/linemap.go b/internal/ls/linemap.go
index 04b67dc571..673470466e 100644
--- a/internal/ls/linemap.go
+++ b/internal/ls/linemap.go
@@ -1,6 +1,8 @@
package ls
import (
+ "cmp"
+ "slices"
"strings"
"unicode/utf8"
@@ -48,3 +50,20 @@ func ComputeLineStarts(text string) *LineMap {
AsciiOnly: asciiOnly,
}
}
+
+func (lm *LineMap) ComputeIndexOfLineStart(targetPos core.TextPos) int {
+ // port of computeLineOfPosition(lineStarts: readonly number[], position: number, lowerBound?: number): number {
+ lineNumber, ok := slices.BinarySearchFunc(lm.LineStarts, targetPos, func(p, t core.TextPos) int {
+ return cmp.Compare(int(p), int(t))
+ })
+ if !ok && lineNumber > 0 {
+ // If the actual position was not found, the binary search returns where the target line start would be inserted
+ // if the target was in the slice.
+ // e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20
+ // then the search will return -3.
+ //
+ // We want the index of the previous line start, so we subtract 1.
+ lineNumber = lineNumber - 1
+ }
+ return lineNumber
+}