From 70585aa0c0e4fbd2921f340f276d87fef8801997 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Thu, 31 Mar 2022 12:18:12 -0700 Subject: [PATCH 01/41] Correct node used for isDefinition calculation (#48499) It should be adjusted as in `getReferencedSymbolsForNode`. The baseline changes show that it was incorrectly returning false at keywords preceding definitions. --- src/services/findAllReferences.ts | 22 ++++++---- .../findAllRefsExportEquals.baseline.jsonc | 2 +- ...efs_importType_exportEquals.baseline.jsonc | 4 +- ...encesForDeclarationKeywords.baseline.jsonc | 30 ++++++------- ...rencesForExpressionKeywords.baseline.jsonc | 18 ++++---- .../referencesForModifiers.baseline.jsonc | 20 ++++----- ...erencesForStatementKeywords.baseline.jsonc | 42 +++++++++---------- .../referencesForTypeKeywords.baseline.jsonc | 12 +++--- 8 files changed, 78 insertions(+), 72 deletions(-) diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 636ea64ecea..d9a74d10d07 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -206,9 +206,10 @@ namespace ts.FindAllReferences { export function findReferencedSymbols(program: Program, cancellationToken: CancellationToken, sourceFiles: readonly SourceFile[], sourceFile: SourceFile, position: number): ReferencedSymbol[] | undefined { const node = getTouchingPropertyName(sourceFile, position); - const referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, { use: FindReferencesUse.References }); + const options = { use: FindReferencesUse.References }; + const referencedSymbols = Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options); const checker = program.getTypeChecker(); - const symbol = checker.getSymbolAtLocation(node); + const symbol = checker.getSymbolAtLocation(getAdjustedReferenceLocation(Core.getAdjustedNode(node, options))); return !referencedSymbols || !referencedSymbols.length ? undefined : mapDefined(referencedSymbols, ({ definition, references }) => // Only include referenced symbols that have a valid definition. definition && { @@ -622,12 +623,7 @@ namespace ts.FindAllReferences { export namespace Core { /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ export function getReferencedSymbolsForNode(position: number, node: Node, program: Program, sourceFiles: readonly SourceFile[], cancellationToken: CancellationToken, options: Options = {}, sourceFilesSet: ReadonlySet = new Set(sourceFiles.map(f => f.fileName))): readonly SymbolAndEntries[] | undefined { - if (options.use === FindReferencesUse.References) { - node = getAdjustedReferenceLocation(node); - } - else if (options.use === FindReferencesUse.Rename) { - node = getAdjustedRenameLocation(node); - } + node = getAdjustedNode(node, options); if (isSourceFile(node)) { const resolvedRef = GoToDefinition.getReferenceAtPosition(node, position, program); if (!resolvedRef?.file) { @@ -695,6 +691,16 @@ namespace ts.FindAllReferences { return mergeReferences(program, moduleReferences, references, moduleReferencesOfExportTarget); } + export function getAdjustedNode(node: Node, options: Options) { + if (options.use === FindReferencesUse.References) { + node = getAdjustedReferenceLocation(node); + } + else if (options.use === FindReferencesUse.Rename) { + node = getAdjustedRenameLocation(node); + } + return node; + } + export function getReferencesForFileName(fileName: string, program: Program, sourceFiles: readonly SourceFile[], sourceFilesSet: ReadonlySet = new Set(sourceFiles.map(f => f.fileName))): readonly Entry[] { const moduleSymbol = program.getSourceFile(fileName)?.symbol; if (moduleSymbol) { diff --git a/tests/baselines/reference/findAllRefsExportEquals.baseline.jsonc b/tests/baselines/reference/findAllRefsExportEquals.baseline.jsonc index 14b72c702ee..ef36f386301 100644 --- a/tests/baselines/reference/findAllRefsExportEquals.baseline.jsonc +++ b/tests/baselines/reference/findAllRefsExportEquals.baseline.jsonc @@ -271,7 +271,7 @@ "length": 16 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { diff --git a/tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc b/tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc index b71b73a700f..a895c84f39f 100644 --- a/tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc +++ b/tests/baselines/reference/findAllRefs_importType_exportEquals.baseline.jsonc @@ -774,7 +774,7 @@ "length": 16 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -787,7 +787,7 @@ "length": 43 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { diff --git a/tests/baselines/reference/referencesForDeclarationKeywords.baseline.jsonc b/tests/baselines/reference/referencesForDeclarationKeywords.baseline.jsonc index fe37f52b542..75b22accc01 100644 --- a/tests/baselines/reference/referencesForDeclarationKeywords.baseline.jsonc +++ b/tests/baselines/reference/referencesForDeclarationKeywords.baseline.jsonc @@ -132,7 +132,7 @@ "length": 13 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -220,7 +220,7 @@ "length": 25 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -329,7 +329,7 @@ undefined "length": 21 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -342,7 +342,7 @@ undefined "length": 11 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -440,7 +440,7 @@ undefined "length": 21 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -453,7 +453,7 @@ undefined "length": 11 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -523,7 +523,7 @@ undefined "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -593,7 +593,7 @@ undefined "length": 13 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -703,7 +703,7 @@ undefined "length": 12 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -773,7 +773,7 @@ undefined "length": 10 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -843,7 +843,7 @@ undefined "length": 15 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -913,7 +913,7 @@ undefined "length": 12 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -1085,7 +1085,7 @@ undefined "length": 6 }, "isWriteAccess": false, - "isDefinition": false + "isDefinition": true } ] } @@ -1167,7 +1167,7 @@ undefined "length": 6 }, "isWriteAccess": false, - "isDefinition": false + "isDefinition": true } ] } @@ -1249,7 +1249,7 @@ undefined "length": 12 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } diff --git a/tests/baselines/reference/referencesForExpressionKeywords.baseline.jsonc b/tests/baselines/reference/referencesForExpressionKeywords.baseline.jsonc index 24bcc1f1fe6..111f5f2e3be 100644 --- a/tests/baselines/reference/referencesForExpressionKeywords.baseline.jsonc +++ b/tests/baselines/reference/referencesForExpressionKeywords.baseline.jsonc @@ -57,7 +57,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -203,7 +203,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -349,7 +349,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -495,7 +495,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -641,7 +641,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -787,7 +787,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -933,7 +933,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -1079,7 +1079,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -1253,7 +1253,7 @@ "length": 13 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { diff --git a/tests/baselines/reference/referencesForModifiers.baseline.jsonc b/tests/baselines/reference/referencesForModifiers.baseline.jsonc index 6838b5a141d..786b3832fc3 100644 --- a/tests/baselines/reference/referencesForModifiers.baseline.jsonc +++ b/tests/baselines/reference/referencesForModifiers.baseline.jsonc @@ -54,7 +54,7 @@ "length": 105 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -116,7 +116,7 @@ "length": 105 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -206,7 +206,7 @@ "length": 9 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -296,7 +296,7 @@ "length": 11 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -386,7 +386,7 @@ "length": 9 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -476,7 +476,7 @@ "length": 12 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -566,7 +566,7 @@ "length": 10 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -636,7 +636,7 @@ "length": 16 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -730,7 +730,7 @@ "length": 22 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -792,7 +792,7 @@ "length": 26 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } diff --git a/tests/baselines/reference/referencesForStatementKeywords.baseline.jsonc b/tests/baselines/reference/referencesForStatementKeywords.baseline.jsonc index 7f8ebfbc946..649b7519254 100644 --- a/tests/baselines/reference/referencesForStatementKeywords.baseline.jsonc +++ b/tests/baselines/reference/referencesForStatementKeywords.baseline.jsonc @@ -95,7 +95,7 @@ "length": 26 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -289,7 +289,7 @@ "length": 14 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -399,7 +399,7 @@ "length": 25 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] }, @@ -555,7 +555,7 @@ "length": 25 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] }, @@ -747,7 +747,7 @@ "length": 30 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -822,7 +822,7 @@ "length": 30 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -897,7 +897,7 @@ "length": 30 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -1078,7 +1078,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] }, @@ -1234,7 +1234,7 @@ "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] }, @@ -1545,7 +1545,7 @@ undefined "length": 40 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -1904,7 +1904,7 @@ undefined "length": 30 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -1979,7 +1979,7 @@ undefined "length": 30 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -2054,7 +2054,7 @@ undefined "length": 30 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -2235,7 +2235,7 @@ undefined "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] }, @@ -2391,7 +2391,7 @@ undefined "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] }, @@ -2702,7 +2702,7 @@ undefined "length": 40 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -2806,7 +2806,7 @@ undefined "length": 19 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -2910,7 +2910,7 @@ undefined "length": 19 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -2989,7 +2989,7 @@ undefined "length": 29 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -3058,7 +3058,7 @@ undefined "length": 13 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -3140,7 +3140,7 @@ undefined "length": 13 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { diff --git a/tests/baselines/reference/referencesForTypeKeywords.baseline.jsonc b/tests/baselines/reference/referencesForTypeKeywords.baseline.jsonc index 993430a6c1d..57a6ac4774f 100644 --- a/tests/baselines/reference/referencesForTypeKeywords.baseline.jsonc +++ b/tests/baselines/reference/referencesForTypeKeywords.baseline.jsonc @@ -50,7 +50,7 @@ "length": 14 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -165,7 +165,7 @@ }, "fileName": "/tests/cases/fourslash/referencesForTypeKeywords.ts", "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -232,7 +232,7 @@ }, "fileName": "/tests/cases/fourslash/referencesForTypeKeywords.ts", "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -298,7 +298,7 @@ "length": 12 }, "isWriteAccess": true, - "isDefinition": false + "isDefinition": true } ] } @@ -392,7 +392,7 @@ }, "fileName": "/tests/cases/fourslash/referencesForTypeKeywords.ts", "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { @@ -495,7 +495,7 @@ }, "fileName": "/tests/cases/fourslash/referencesForTypeKeywords.ts", "isWriteAccess": true, - "isDefinition": false + "isDefinition": true }, { "textSpan": { From 9153eaaee0b2f99dc1e076417bcc6d529194acba Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 31 Mar 2022 21:27:58 -0700 Subject: [PATCH 02/41] Reserve a core in runtests-parallel on non-CI machines (#48502) --- scripts/build/options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/options.js b/scripts/build/options.js index 5d4aad6f5fc..646ae1f826b 100644 --- a/scripts/build/options.js +++ b/scripts/build/options.js @@ -31,7 +31,7 @@ module.exports = minimist(process.argv.slice(2), { reporter: process.env.reporter || process.env.r, lint: process.env.lint || true, fix: process.env.fix || process.env.f, - workers: process.env.workerCount || os.cpus().length, + workers: process.env.workerCount || ((os.cpus().length - (process.env.CI ? 0 : 1)) || 1), failed: false, keepFailed: false, lkg: true, From 54fa69cb471e2bf4abcc155ff613ff9529bf075d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 31 Mar 2022 21:45:34 -0700 Subject: [PATCH 03/41] Fix API under exactOptionalPropertyTypes (#48505) --- src/compiler/types.ts | 2 +- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index ac4faa72e97..5180c765990 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6613,7 +6613,7 @@ namespace ts { realpath?(path: string): string; getCurrentDirectory?(): string; getDirectories?(path: string): string[]; - useCaseSensitiveFileNames?: boolean | (() => boolean); + useCaseSensitiveFileNames?: boolean | (() => boolean) | undefined; } /** diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index a5bd8005936..680978e77c2 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -3164,7 +3164,7 @@ declare namespace ts { realpath?(path: string): string; getCurrentDirectory?(): string; getDirectories?(path: string): string[]; - useCaseSensitiveFileNames?: boolean | (() => boolean); + useCaseSensitiveFileNames?: boolean | (() => boolean) | undefined; } /** * Used by services to specify the minimum host area required to set up source files under any compilation settings diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 01ed44a4dfe..1a7f9480772 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -3164,7 +3164,7 @@ declare namespace ts { realpath?(path: string): string; getCurrentDirectory?(): string; getDirectories?(path: string): string[]; - useCaseSensitiveFileNames?: boolean | (() => boolean); + useCaseSensitiveFileNames?: boolean | (() => boolean) | undefined; } /** * Used by services to specify the minimum host area required to set up source files under any compilation settings From acb927e8a5ec85b23b62f96d1f85c050aa7ade76 Mon Sep 17 00:00:00 2001 From: csigs Date: Fri, 1 Apr 2022 05:41:47 -0700 Subject: [PATCH 04/41] LEGO: Merge pull request 48512 LEGO: Merge pull request 48512 --- .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ 10 files changed, 90 insertions(+) diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index eb8e85488ff..90c07e3c9da 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8184,6 +8184,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl index 854c998d309..cf3646a049a 100644 --- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8184,6 +8184,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index b534ce0a673..e3ae122d6c9 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8196,6 +8196,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index d56a62f1057..632da2ccfe7 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8196,6 +8196,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index 59951b9b449..1adf647dea7 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8184,6 +8184,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 3b0ceb4783d..6cda72d2a7b 100644 --- a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8184,6 +8184,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl index aaa0d9488b2..465a1eb0a91 100644 --- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8184,6 +8184,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 148cab39680..a26c731b7f6 100644 --- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8174,6 +8174,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index d66e5046b5d..b5b13ec6589 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8177,6 +8177,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl index f9c3e47e744..28eef0fc4d4 100644 --- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8183,6 +8183,15 @@ + + + + + + + + + From 802007228196dda1849ff6a661931680a2f93f45 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Fri, 1 Apr 2022 09:24:14 -0700 Subject: [PATCH 05/41] Respect @BaselineFile in fourslash tests and tidy up quickInfoDisplayPartsVarShims (#48506) --- src/harness/fourslashImpl.ts | 3 +- ...uickInfoDisplayPartsVar.shims-pp.baseline} | 28 +++++++++---------- ...> quickInfoDisplayPartsVar.shims.baseline} | 0 ...pp.ts => quickInfoDisplayPartsVarShims.ts} | 0 4 files changed, 16 insertions(+), 15 deletions(-) rename tests/baselines/reference/{quickInfoDisplayPartsVarShimspp.baseline => quickInfoDisplayPartsVar.shims-pp.baseline} (98%) rename tests/baselines/reference/{quickInfoDisplayPartsVarShims.baseline => quickInfoDisplayPartsVar.shims.baseline} (100%) rename tests/cases/fourslash/shims-pp/{quickInfoDisplayPartsVarShimspp.ts => quickInfoDisplayPartsVarShims.ts} (100%) diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 71886f8ff5f..408785ccf00 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -2120,7 +2120,8 @@ namespace FourSlash { } private getBaselineFileNameForContainingTestFile(ext = ".baseline") { - return ts.getBaseFileName(this.originalInputFileName).replace(ts.Extension.Ts, ext); + return this.testData.globalOptions[MetadataOptionNames.baselineFile] || + ts.getBaseFileName(this.originalInputFileName).replace(ts.Extension.Ts, ext); } private getSignatureHelp({ triggerReason }: FourSlashInterface.VerifySignatureHelpOptions): ts.SignatureHelpItems | undefined { diff --git a/tests/baselines/reference/quickInfoDisplayPartsVarShimspp.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline similarity index 98% rename from tests/baselines/reference/quickInfoDisplayPartsVarShimspp.baseline rename to tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline index 4159f71406c..3e82efaf6b1 100644 --- a/tests/baselines/reference/quickInfoDisplayPartsVarShimspp.baseline +++ b/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline @@ -1,7 +1,7 @@ [ { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 4, "name": "1" }, @@ -43,7 +43,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 37, "name": "2" }, @@ -93,7 +93,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 41, "name": "3" }, @@ -135,7 +135,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 65, "name": "4" }, @@ -177,7 +177,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 88, "name": "5" }, @@ -227,7 +227,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 102, "name": "6" }, @@ -289,7 +289,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 123, "name": "7" }, @@ -351,7 +351,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 127, "name": "8" }, @@ -413,7 +413,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 130, "name": "9" }, @@ -475,7 +475,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 139, "name": "10" }, @@ -621,7 +621,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 193, "name": "11" }, @@ -767,7 +767,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 197, "name": "12" }, @@ -913,7 +913,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 200, "name": "13" }, @@ -1019,7 +1019,7 @@ }, { "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts", + "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", "position": 207, "name": "14" }, diff --git a/tests/baselines/reference/quickInfoDisplayPartsVarShims.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline similarity index 100% rename from tests/baselines/reference/quickInfoDisplayPartsVarShims.baseline rename to tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline diff --git a/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts b/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts similarity index 100% rename from tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShimspp.ts rename to tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts From 337d1326fb67c7d8ec76531892e07990fb3871d4 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Fri, 1 Apr 2022 11:14:14 -0700 Subject: [PATCH 06/41] Sync fourslash shims and shims-pp (#48507) It appears that they were intended to be identical so, in each case, I updated the side that looked less correct. --- .../shims-pp/goToDefinitionTypeReferenceDirective.ts | 2 +- tests/cases/fourslash/shims/getCompletionsAtPosition.ts | 2 +- tests/cases/fourslash/shims/getOutliningSpans.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts b/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts index 532390fb35e..f318de7c25e 100644 --- a/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts +++ b/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective.ts @@ -1,4 +1,4 @@ -/// +/// // @typeRoots: src/types // @Filename: src/types/lib/index.d.ts diff --git a/tests/cases/fourslash/shims/getCompletionsAtPosition.ts b/tests/cases/fourslash/shims/getCompletionsAtPosition.ts index aa8f7a64e7f..527c0d0b6ca 100644 --- a/tests/cases/fourslash/shims/getCompletionsAtPosition.ts +++ b/tests/cases/fourslash/shims/getCompletionsAtPosition.ts @@ -1,4 +1,4 @@ -/// +/// ////function foo(strOrNum: string | number) { //// /*1*/ diff --git a/tests/cases/fourslash/shims/getOutliningSpans.ts b/tests/cases/fourslash/shims/getOutliningSpans.ts index c5b41ff7997..849d7bcf8b9 100644 --- a/tests/cases/fourslash/shims/getOutliningSpans.ts +++ b/tests/cases/fourslash/shims/getOutliningSpans.ts @@ -1,4 +1,4 @@ -/// +/// ////// interface ////interface IFoo[| { @@ -26,7 +26,7 @@ //// }|] ////}|] ////switch(1)[| { -//// case 1:[| break;|] +//// case 1:[| break;|] ////}|] //// ////var array =[| [ From fd4943bd9c0651f098649dff8d4677d4d28b4203 Mon Sep 17 00:00:00 2001 From: csigs Date: Sat, 2 Apr 2022 05:36:37 -0700 Subject: [PATCH 07/41] LEGO: Merge pull request 48526 LEGO: Merge pull request 48526 --- .../diagnosticMessages.generated.json.lcl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl index de7316b3cb6..9498c63a478 100644 --- a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8193,6 +8193,15 @@ + + + + + + + + + From b1a25fd8b1adec4514809d54d96b64069887652c Mon Sep 17 00:00:00 2001 From: csigs Date: Sun, 3 Apr 2022 03:46:54 -0700 Subject: [PATCH 08/41] LEGO: Merge pull request 48534 LEGO: Merge pull request 48534 --- .../diagnosticMessages.generated.json.lcl | 9 +++++++++ .../diagnosticMessages.generated.json.lcl | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl index 97ec28c5a0d..19d68a960fb 100644 --- a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8181,6 +8181,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 9f6f2861b6e..edd0e585924 100644 --- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -8177,6 +8177,15 @@ + + + + + + + + + From 2db17fdda212574f29d06c08cc35b8668258af51 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Mon, 4 Apr 2022 07:42:37 +0300 Subject: [PATCH 09/41] fix(48520): fix getting parameter type by index (#48521) --- src/services/codefixes/fixAddMissingMember.ts | 2 +- .../fourslash/codeFixAddMissingProperties20.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/codeFixAddMissingProperties20.ts diff --git a/src/services/codefixes/fixAddMissingMember.ts b/src/services/codefixes/fixAddMissingMember.ts index ee4743f1afb..d7606830ea1 100644 --- a/src/services/codefixes/fixAddMissingMember.ts +++ b/src/services/codefixes/fixAddMissingMember.ts @@ -169,7 +169,7 @@ namespace ts.codefix { const param = signature.parameters[argIndex].valueDeclaration; if (!(param && isParameter(param) && isIdentifier(param.name))) return undefined; - const properties = arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getTypeAtLocation(param), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); + const properties = arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!length(properties)) return undefined; return { kind: InfoKind.ObjectLiteral, token: param.name, properties, parentDeclaration: parent }; } diff --git a/tests/cases/fourslash/codeFixAddMissingProperties20.ts b/tests/cases/fourslash/codeFixAddMissingProperties20.ts new file mode 100644 index 00000000000..2c66a708e7f --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingProperties20.ts @@ -0,0 +1,14 @@ +/// + +////type T = { foo: number }; +////const foo: T[] = []; +////[|foo.push({ })|] + +verify.codeFix({ + index: 0, + description: ts.Diagnostics.Add_missing_properties.message, + newRangeContent: +`foo.push({ + foo: 0 +})`, +}); From 99620117be72b737b627f7a686e501d713470e37 Mon Sep 17 00:00:00 2001 From: magic-akari Date: Mon, 4 Apr 2022 23:33:47 +0800 Subject: [PATCH 10/41] Fix crash when circular reference in variance annotations (#48539) * Fix crash when circular reference in variance annotations * chore: clean code --- src/compiler/checker.ts | 3 +++ ...ionsWithCircularlyReferencesError.errors.txt | 17 +++++++++++++++++ ...eAnnotationsWithCircularlyReferencesError.js | 11 +++++++++++ ...tationsWithCircularlyReferencesError.symbols | 12 ++++++++++++ ...notationsWithCircularlyReferencesError.types | 7 +++++++ ...eAnnotationsWithCircularlyReferencesError.ts | 5 +++++ 6 files changed, 55 insertions(+) create mode 100644 tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.errors.txt create mode 100644 tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.js create mode 100644 tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.symbols create mode 100644 tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.types create mode 100644 tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 92005a36b65..b891a0ec6c0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20640,6 +20640,9 @@ namespace ts { function createMarkerType(symbol: Symbol, source: TypeParameter, target: Type) { const mapper = makeUnaryTypeMapper(source, target); const type = getDeclaredTypeOfSymbol(symbol); + if (isErrorType(type)) { + return type; + } const result = symbol.flags & SymbolFlags.TypeAlias ? getTypeAliasInstantiation(symbol, instantiateTypes(getSymbolLinks(symbol).typeParameters!, mapper)) : createTypeReference(type as GenericType, instantiateTypes((type as GenericType).typeParameters, mapper)); diff --git a/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.errors.txt b/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.errors.txt new file mode 100644 index 00000000000..d6589051967 --- /dev/null +++ b/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts(1,6): error TS2456: Type alias 'T1' circularly references itself. +tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts(1,11): error TS2300: Duplicate identifier '(Missing)'. +tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts(1,12): error TS1359: Identifier expected. 'in' is a reserved word that cannot be used here. +tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts(2,6): error TS2456: Type alias 'T2' circularly references itself. + + +==== tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts (4 errors) ==== + type T1 = T1 // Error: circularly references + ~~ +!!! error TS2456: Type alias 'T1' circularly references itself. + +!!! error TS2300: Duplicate identifier '(Missing)'. + ~~ +!!! error TS1359: Identifier expected. 'in' is a reserved word that cannot be used here. + type T2 = T2 // Error: circularly references + ~~ +!!! error TS2456: Type alias 'T2' circularly references itself. \ No newline at end of file diff --git a/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.js b/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.js new file mode 100644 index 00000000000..8f2cc8a9c38 --- /dev/null +++ b/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.js @@ -0,0 +1,11 @@ +//// [varianceAnnotationsWithCircularlyReferencesError.ts] +type T1 = T1 // Error: circularly references +type T2 = T2 // Error: circularly references + +//// [varianceAnnotationsWithCircularlyReferencesError.js] +"use strict"; + + +//// [varianceAnnotationsWithCircularlyReferencesError.d.ts] +declare type T1 = T1; +declare type T2 = T2; diff --git a/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.symbols b/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.symbols new file mode 100644 index 00000000000..cb4760c4430 --- /dev/null +++ b/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.symbols @@ -0,0 +1,12 @@ +=== tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts === +type T1 = T1 // Error: circularly references +>T1 : Symbol(T1, Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 0, 0)) +> : Symbol((Missing), Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 0, 8), Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 0, 10)) +> : Symbol((Missing), Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 0, 8), Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 0, 10)) +>T1 : Symbol(T1, Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 0, 0)) + +type T2 = T2 // Error: circularly references +>T2 : Symbol(T2, Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 0, 19)) +>out : Symbol(out, Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 1, 8)) +>T2 : Symbol(T2, Decl(varianceAnnotationsWithCircularlyReferencesError.ts, 0, 19)) + diff --git a/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.types b/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.types new file mode 100644 index 00000000000..21c624057f1 --- /dev/null +++ b/tests/baselines/reference/varianceAnnotationsWithCircularlyReferencesError.types @@ -0,0 +1,7 @@ +=== tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts === +type T1 = T1 // Error: circularly references +>T1 : any + +type T2 = T2 // Error: circularly references +>T2 : any + diff --git a/tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts b/tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts new file mode 100644 index 00000000000..3ad0e4a6a57 --- /dev/null +++ b/tests/cases/conformance/types/typeParameters/typeParameterLists/varianceAnnotationsWithCircularlyReferencesError.ts @@ -0,0 +1,5 @@ +// @strict: true +// @declaration: true + +type T1 = T1 // Error: circularly references +type T2 = T2 // Error: circularly references \ No newline at end of file From d5f5c6d61e06717613286546f568e80c4a8775b4 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Mon, 4 Apr 2022 09:23:58 -0700 Subject: [PATCH 11/41] Convert many tests from verify.singleReferenceGroup to verify.baselineFindAllReferences (#48518) * Convert referenceToClass to baselining * Delete stray marker from findAllRefsInsideWithBlock * Bulk convert tests that just call verify.singleReferenceGroup * Update tests with duplicate names * Bulk update verify.singleReferenceGroup tests with BOMs * Semi-automatically convert FAR tests with explicit range code * Convert findAllReferencesDynamicImport2 to baselines --- ...ambientShorthandFindAllRefs.baseline.jsonc | 167 + ...uleInteropFindAllReferences.baseline.jsonc | 159 + ...leInteropFindAllReferences2.baseline.jsonc | 157 + ...essExpressionHeritageClause.baseline.jsonc | 308 ++ ...AllReferencesDynamicImport1.baseline.jsonc | 225 ++ ...AllReferencesDynamicImport2.baseline.jsonc | 169 + ...lReferencesJSDocFunctionNew.baseline.jsonc | 72 + ...lReferencesJsDocTypeLiteral.baseline.jsonc | 169 + ...esOfConstructor_badOverload.baseline.jsonc | 135 + ...ndAllReferencesOfJsonModule.baseline.jsonc | 185 + .../findAllRefsCatchClause.baseline.jsonc | 135 + ...AllRefsConstructorFunctions.baseline.jsonc | 439 +++ .../findAllRefsDeclareClass.baseline.jsonc | 107 + .../findAllRefsEnumAsNamespace.baseline.jsonc | 185 + .../findAllRefsEnumMember.baseline.jsonc | 284 ++ ...portDefaultClassConstructor.baseline.jsonc | 49 + ...dAllRefsExportNotAtTopLevel.baseline.jsonc | 153 + ...ndAllRefsForDefaultExport01.baseline.jsonc | 299 ++ ...ndAllRefsForDefaultExport02.baseline.jsonc | 801 ++++ ...ndAllRefsForDefaultExport03.baseline.jsonc | 1151 ++++++ ...ndAllRefsForDefaultExport08.baseline.jsonc | 75 + ...RefsForFunctionExpression01.baseline.jsonc | 1840 +++++++++ ...sForObjectLiteralProperties.baseline.jsonc | 313 ++ .../findAllRefsForRest.baseline.jsonc | 191 + ...llRefsForStringLiteralTypes.baseline.jsonc | 16 +- ...ndAllRefsForUMDModuleAlias1.baseline.jsonc | 151 + ...orVariableInExtendsClause01.baseline.jsonc | 245 ++ ...orVariableInExtendsClause02.baseline.jsonc | 194 + ...efsGlobalModuleAugmentation.baseline.jsonc | 260 ++ .../findAllRefsImportType.baseline.jsonc | 242 ++ ...ndAllRefsIndexedAccessTypes.baseline.jsonc | 391 ++ ...AllRefsInheritedProperties1.baseline.jsonc | 399 ++ ...AllRefsInheritedProperties2.baseline.jsonc | 399 ++ ...findAllRefsInsideTemplates1.baseline.jsonc | 331 ++ ...findAllRefsInsideTemplates2.baseline.jsonc | 639 ++++ .../findAllRefsInsideWithBlock.baseline.jsonc | 355 ++ ...lRefsJsDocTemplateTag_class.baseline.jsonc | 179 + ...fsJsDocTemplateTag_class_js.baseline.jsonc | 189 + ...fsJsDocTemplateTag_function.baseline.jsonc | 219 ++ ...sDocTemplateTag_function_js.baseline.jsonc | 129 + .../findAllRefsJsDocTypeDef_js.baseline.jsonc | 289 ++ .../findAllRefsMappedType.baseline.jsonc | 308 ++ ...fsMappedType_nonHomomorphic.baseline.jsonc | 151 + ...ndAllRefsModuleAugmentation.baseline.jsonc | 248 ++ ...findAllRefsModuleDotExports.baseline.jsonc | 179 + .../findAllRefsNoImportClause.baseline.jsonc | 65 + ...indingElementPropertyName01.baseline.jsonc | 199 + ...indingElementPropertyName02.baseline.jsonc | 199 + ...indingElementPropertyName10.baseline.jsonc | 349 ++ .../findAllRefsOnDecorators.baseline.jsonc | 803 ++++ .../findAllRefsOnDefinition.baseline.jsonc | 350 ++ .../findAllRefsOnDefinition2.baseline.jsonc | 239 ++ ...OnPrivateParameterProperty1.baseline.jsonc | 287 ++ .../findAllRefsPrimitiveJsDoc.baseline.jsonc | 267 ++ ...AllRefsPrivateNameAccessors.baseline.jsonc | 1209 ++++++ ...ndAllRefsPrivateNameMethods.baseline.jsonc | 455 +++ ...llRefsPrivateNameProperties.baseline.jsonc | 561 +++ .../findAllRefsReExport_broken.baseline.jsonc | 103 + ...findAllRefsReExport_broken2.baseline.jsonc | 103 + .../findAllRefsThisKeyword.baseline.jsonc | 984 +++++ ...efsThisKeywordMultipleFiles.baseline.jsonc | 1023 +++++ ...eParameterInMergedInterface.baseline.jsonc | 431 +++ .../findAllRefsTypedef.baseline.jsonc | 177 + ...ndAllRefsTypedef_importType.baseline.jsonc | 167 + .../findAllRefsTypeofImport.baseline.jsonc | 151 + ...WithLeadingUnderscoreNames1.baseline.jsonc | 305 ++ ...WithLeadingUnderscoreNames2.baseline.jsonc | 305 ++ ...WithLeadingUnderscoreNames3.baseline.jsonc | 305 ++ ...WithLeadingUnderscoreNames4.baseline.jsonc | 305 ++ ...WithLeadingUnderscoreNames5.baseline.jsonc | 299 ++ ...WithLeadingUnderscoreNames6.baseline.jsonc | 299 ++ ...WithLeadingUnderscoreNames7.baseline.jsonc | 248 ++ ...WithLeadingUnderscoreNames8.baseline.jsonc | 272 ++ ...WithLeadingUnderscoreNames9.baseline.jsonc | 272 ++ ...mportType_meaningAtLocation.baseline.jsonc | 403 ++ ...indAllRefs_importType_named.baseline.jsonc | 491 +++ ...efs_importType_typeofImport.baseline.jsonc | 293 ++ .../findAllRefs_jsEnum.baseline.jsonc | 814 ++++ ...encesAcrossMultipleProjects.baseline.jsonc | 359 ++ .../findReferencesJSXTagName2.baseline.jsonc | 389 ++ ...IsDefinitionOfArrowFunction.baseline.jsonc | 329 ++ ...urrencesIsDefinitionOfClass.baseline.jsonc | 200 + ...efinitionOfComputedProperty.baseline.jsonc | 277 ++ ...currencesIsDefinitionOfEnum.baseline.jsonc | 194 + ...encesIsDefinitionOfFunction.baseline.jsonc | 296 ++ ...ncesIsDefinitionOfInterface.baseline.jsonc | 191 + ...nitionOfInterfaceClassMerge.baseline.jsonc | 991 +++++ ...ncesIsDefinitionOfNamespace.baseline.jsonc | 191 + ...nitionOfNumberNamedProperty.baseline.jsonc | 163 + ...ncesIsDefinitionOfParameter.baseline.jsonc | 165 + ...nitionOfStringNamedProperty.baseline.jsonc | 245 ++ ...ncesIsDefinitionOfTypeAlias.baseline.jsonc | 233 ++ ...encesIsDefinitionOfVariable.baseline.jsonc | 3295 +++++++++++++++++ .../getReferencesAtPosition-pp.baseline.jsonc | 350 ++ .../getReferencesAtPosition.baseline.jsonc | 350 ++ ...cTypedefTagSemanticMeaning0.baseline.jsonc | 389 ++ ...cTypedefTagSemanticMeaning1.baseline.jsonc | 467 +++ ...uickInfoUntypedModuleImport.baseline.jsonc | 165 + .../reference/referenceToClass.baseline.jsonc | 671 ++++ .../referencesBloomFilters3.baseline.jsonc | 299 ++ .../referencesForAmbients.baseline.jsonc | 1417 +++++++ .../referencesForAmbients2.baseline.jsonc | 399 ++ .../referencesForClassLocal.baseline.jsonc | 455 +++ ...referencesForClassParameter.baseline.jsonc | 451 +++ .../referencesForEnums.baseline.jsonc | 1004 +++++ ...referencesForExportedValues.baseline.jsonc | 295 ++ ...encesForExternalModuleNames.baseline.jsonc | 321 ++ ...erencesForFunctionOverloads.baseline.jsonc | 564 +++ ...erencesForFunctionParameter.baseline.jsonc | 287 ++ .../referencesForGlobals.baseline.jsonc | 554 +++ .../referencesForGlobals2.baseline.jsonc | 197 + .../referencesForGlobals3.baseline.jsonc | 197 + .../referencesForGlobals4.baseline.jsonc | 197 + .../referencesForGlobals5.baseline.jsonc | 347 ++ ...sForGlobalsInExternalModule.baseline.jsonc | 935 +++++ .../referencesForImports.baseline.jsonc | 456 +++ .../referencesForIndexProperty.baseline.jsonc | 399 ++ ...referencesForIndexProperty2.baseline.jsonc | 37 + ...referencesForIndexProperty3.baseline.jsonc | 341 ++ ...ncesForInheritedProperties3.baseline.jsonc | 399 ++ ...ncesForInheritedProperties4.baseline.jsonc | 399 ++ ...ncesForInheritedProperties9.baseline.jsonc | 284 ++ .../referencesForLabel.baseline.jsonc | 265 ++ .../referencesForLabel3.baseline.jsonc | 41 + .../referencesForLabel4.baseline.jsonc | 115 + .../referencesForLabel5.baseline.jsonc | 349 ++ .../referencesForLabel6.baseline.jsonc | 156 + ...rencesForMergedDeclarations.baseline.jsonc | 812 ++++ ...encesForMergedDeclarations2.baseline.jsonc | 715 ++++ ...encesForMergedDeclarations4.baseline.jsonc | 1781 +++++++++ ...encesForMergedDeclarations6.baseline.jsonc | 206 ++ ...encesForMergedDeclarations8.baseline.jsonc | 230 ++ ...sForObjectLiteralProperties.baseline.jsonc | 411 ++ ...sForPropertiesOfGenericType.baseline.jsonc | 425 +++ .../referencesForStatic.baseline.jsonc | 1511 ++++++++ ...ticsAndMembersWithSameNames.baseline.jsonc | 1367 +++++++ ...StringLiteralPropertyNames2.baseline.jsonc | 317 ++ ...StringLiteralPropertyNames3.baseline.jsonc | 559 +++ .../tsxFindAllReferences1.baseline.jsonc | 367 ++ .../tsxFindAllReferences11.baseline.jsonc | 82 + .../tsxFindAllReferences4.baseline.jsonc | 365 ++ .../tsxFindAllReferences5.baseline.jsonc | 1248 +++++++ .../tsxFindAllReferences6.baseline.jsonc | 75 + .../tsxFindAllReferences8.baseline.jsonc | 3035 +++++++++++++++ ...ReferencesUnionElementType1.baseline.jsonc | 847 +++++ ...ReferencesUnionElementType2.baseline.jsonc | 292 ++ .../fourslash/ambientShorthandFindAllRefs.ts | 8 +- .../esModuleInteropFindAllReferences.ts | 6 +- .../esModuleInteropFindAllReferences2.ts | 6 +- ...rPropertyAccessExpressionHeritageClause.ts | 8 +- .../findAllReferencesDynamicImport1.ts | 6 +- .../findAllReferencesDynamicImport2.ts | 6 +- .../findAllReferencesJSDocFunctionNew.ts | 15 +- .../findAllReferencesJsDocTypeLiteral.ts | 32 +- ...dAllReferencesOfConstructor_badOverload.ts | 6 +- .../findAllReferencesOfJsonModule.ts | 6 +- .../cases/fourslash/findAllRefsCatchClause.ts | 6 +- .../findAllRefsConstructorFunctions.ts | 28 +- .../fourslash/findAllRefsDeclareClass.ts | 14 +- .../fourslash/findAllRefsEnumAsNamespace.ts | 12 +- .../cases/fourslash/findAllRefsEnumMember.ts | 12 +- ...indAllRefsExportDefaultClassConstructor.ts | 4 +- .../findAllRefsExportNotAtTopLevel.ts | 16 +- .../findAllRefsForDefaultExport01.ts | 10 +- .../findAllRefsForDefaultExport02.ts | 20 +- .../findAllRefsForDefaultExport03.ts | 16 +- .../findAllRefsForDefaultExport08.ts | 6 +- .../findAllRefsForFunctionExpression01.ts | 8 +- .../findAllRefsForObjectLiteralProperties.ts | 8 +- tests/cases/fourslash/findAllRefsForRest.ts | 22 +- .../findAllRefsForStringLiteralTypes.ts | 6 +- .../findAllRefsForUMDModuleAlias1.ts | 6 +- ...findAllRefsForVariableInExtendsClause01.ts | 6 +- ...findAllRefsForVariableInExtendsClause02.ts | 6 +- .../findAllRefsGlobalModuleAugmentation.ts | 26 +- .../cases/fourslash/findAllRefsImportType.ts | 24 +- .../findAllRefsIndexedAccessTypes.ts | 11 +- .../findAllRefsInheritedProperties1.ts | 12 +- .../findAllRefsInheritedProperties2.ts | 12 +- .../fourslash/findAllRefsInsideTemplates1.ts | 6 +- .../fourslash/findAllRefsInsideTemplates2.ts | 6 +- .../fourslash/findAllRefsInsideWithBlock.ts | 8 +- .../findAllRefsJsDocTemplateTag_class.ts | 12 +- .../findAllRefsJsDocTemplateTag_class_js.ts | 32 +- .../findAllRefsJsDocTemplateTag_function.ts | 12 +- ...findAllRefsJsDocTemplateTag_function_js.ts | 24 +- .../fourslash/findAllRefsJsDocTypeDef_js.ts | 40 +- .../cases/fourslash/findAllRefsMappedType.ts | 20 +- .../findAllRefsMappedType_nonHomomorphic.ts | 20 +- .../findAllRefsModuleAugmentation.ts | 26 +- .../fourslash/findAllRefsModuleDotExports.ts | 23 +- .../fourslash/findAllRefsNoImportClause.ts | 4 +- ...lRefsObjectBindingElementPropertyName01.ts | 6 +- ...lRefsObjectBindingElementPropertyName02.ts | 6 +- ...lRefsObjectBindingElementPropertyName10.ts | 6 +- .../fourslash/findAllRefsOnDecorators.ts | 12 +- .../fourslash/findAllRefsOnDefinition.ts | 8 +- .../fourslash/findAllRefsOnDefinition2.ts | 6 +- .../findAllRefsOnPrivateParameterProperty1.ts | 6 +- tests/cases/fourslash/findAllRefsPrimitive.ts | 62 +- .../fourslash/findAllRefsPrimitiveJsDoc.ts | 22 +- .../findAllRefsPrivateNameAccessors.ts | 17 +- .../findAllRefsPrivateNameMethods.ts | 12 +- .../findAllRefsPrivateNameProperties.ts | 14 +- .../fourslash/findAllRefsReExport_broken.ts | 12 +- .../fourslash/findAllRefsReExport_broken2.ts | 12 +- .../cases/fourslash/findAllRefsThisKeyword.ts | 28 +- .../findAllRefsThisKeywordMultipleFiles.ts | 10 +- ...ndAllRefsTypeParameterInMergedInterface.ts | 12 +- tests/cases/fourslash/findAllRefsTypedef.ts | 30 +- .../findAllRefsTypedef_importType.ts | 28 +- .../fourslash/findAllRefsTypeofImport.ts | 16 +- .../findAllRefsWithLeadingUnderscoreNames1.ts | 6 +- .../findAllRefsWithLeadingUnderscoreNames2.ts | 6 +- .../findAllRefsWithLeadingUnderscoreNames3.ts | 6 +- .../findAllRefsWithLeadingUnderscoreNames4.ts | 6 +- .../findAllRefsWithLeadingUnderscoreNames5.ts | 6 +- .../findAllRefsWithLeadingUnderscoreNames6.ts | 6 +- .../findAllRefsWithLeadingUnderscoreNames7.ts | 8 +- .../findAllRefsWithLeadingUnderscoreNames8.ts | 8 +- .../findAllRefsWithLeadingUnderscoreNames9.ts | 8 +- ...indAllRefs_importType_meaningAtLocation.ts | 24 +- .../fourslash/findAllRefs_importType_named.ts | 24 +- .../findAllRefs_importType_typeofImport.ts | 20 +- tests/cases/fourslash/findAllRefs_jsEnum.ts | 28 +- .../findReferencesAcrossMultipleProjects.ts | 8 +- .../fourslash/findReferencesJSXTagName2.ts | 8 +- ...tOccurrencesIsDefinitionOfArrowFunction.ts | 10 +- .../getOccurrencesIsDefinitionOfClass.ts | 20 +- ...currencesIsDefinitionOfComputedProperty.ts | 12 +- .../getOccurrencesIsDefinitionOfEnum.ts | 16 +- .../getOccurrencesIsDefinitionOfFunction.ts | 12 +- .../getOccurrencesIsDefinitionOfInterface.ts | 14 +- ...rencesIsDefinitionOfInterfaceClassMerge.ts | 32 +- .../getOccurrencesIsDefinitionOfNamespace.ts | 14 +- ...rencesIsDefinitionOfNumberNamedProperty.ts | 10 +- .../getOccurrencesIsDefinitionOfParameter.ts | 12 +- ...rencesIsDefinitionOfStringNamedProperty.ts | 10 +- .../getOccurrencesIsDefinitionOfTypeAlias.ts | 10 +- .../getOccurrencesIsDefinitionOfVariable.ts | 28 +- .../jsdocTypedefTagSemanticMeaning0.ts | 13 +- .../jsdocTypedefTagSemanticMeaning1.ts | 8 +- .../fourslash/jsdocTypedefTagServices.ts | 58 +- .../fourslash/quickInfoUntypedModuleImport.ts | 9 +- tests/cases/fourslash/referenceToClass.ts | 16 +- .../fourslash/referencesBloomFilters3.ts | 6 +- .../cases/fourslash/referencesForAmbients.ts | 24 +- .../cases/fourslash/referencesForAmbients2.ts | 8 +- .../fourslash/referencesForClassLocal.ts | 8 +- .../fourslash/referencesForClassParameter.ts | 8 +- tests/cases/fourslash/referencesForEnums.ts | 18 +- .../fourslash/referencesForExportedValues.ts | 8 +- .../referencesForExternalModuleNames.ts | 8 +- .../referencesForFunctionOverloads.ts | 10 +- .../referencesForFunctionParameter.ts | 8 +- tests/cases/fourslash/referencesForGlobals.ts | 10 +- .../cases/fourslash/referencesForGlobals2.ts | 8 +- .../cases/fourslash/referencesForGlobals3.ts | 8 +- .../cases/fourslash/referencesForGlobals4.ts | 8 +- .../cases/fourslash/referencesForGlobals5.ts | 6 +- .../referencesForGlobalsInExternalModule.ts | 23 +- tests/cases/fourslash/referencesForImports.ts | 10 +- .../fourslash/referencesForIndexProperty.ts | 11 +- .../fourslash/referencesForIndexProperty2.ts | 4 +- .../fourslash/referencesForIndexProperty3.ts | 8 +- .../referencesForInheritedProperties3.ts | 11 +- .../referencesForInheritedProperties4.ts | 11 +- .../referencesForInheritedProperties9.ts | 10 +- tests/cases/fourslash/referencesForLabel.ts | 14 +- tests/cases/fourslash/referencesForLabel3.ts | 6 +- tests/cases/fourslash/referencesForLabel4.ts | 8 +- tests/cases/fourslash/referencesForLabel5.ts | 18 +- tests/cases/fourslash/referencesForLabel6.ts | 9 +- .../referencesForMergedDeclarations.ts | 23 +- .../referencesForMergedDeclarations2.ts | 12 +- .../referencesForMergedDeclarations4.ts | 24 +- .../referencesForMergedDeclarations6.ts | 8 +- .../referencesForMergedDeclarations8.ts | 6 +- .../referencesForObjectLiteralProperties.ts | 10 +- .../referencesForPropertiesOfGenericType.ts | 8 +- tests/cases/fourslash/referencesForStatic.ts | 18 +- ...rencesForStaticsAndMembersWithSameNames.ts | 30 +- ...eferencesForStringLiteralPropertyNames2.ts | 6 +- ...eferencesForStringLiteralPropertyNames3.ts | 8 +- .../findAllRefsForStringLiteralTypes.ts | 7 - .../shims-pp/getReferencesAtPosition.ts | 9 +- .../shims/getReferencesAtPosition.ts | 9 +- .../cases/fourslash/tsxFindAllReferences1.ts | 12 +- .../cases/fourslash/tsxFindAllReferences11.ts | 4 +- .../cases/fourslash/tsxFindAllReferences4.ts | 8 +- .../cases/fourslash/tsxFindAllReferences5.ts | 17 +- .../cases/fourslash/tsxFindAllReferences6.ts | 4 +- .../cases/fourslash/tsxFindAllReferences8.ts | 23 +- .../tsxFindAllReferencesUnionElementType1.ts | 10 +- .../tsxFindAllReferencesUnionElementType2.ts | 6 +- 295 files changed, 62661 insertions(+), 1043 deletions(-) create mode 100644 tests/baselines/reference/ambientShorthandFindAllRefs.baseline.jsonc create mode 100644 tests/baselines/reference/esModuleInteropFindAllReferences.baseline.jsonc create mode 100644 tests/baselines/reference/esModuleInteropFindAllReferences2.baseline.jsonc create mode 100644 tests/baselines/reference/findAllReferPropertyAccessExpressionHeritageClause.baseline.jsonc create mode 100644 tests/baselines/reference/findAllReferencesDynamicImport1.baseline.jsonc create mode 100644 tests/baselines/reference/findAllReferencesDynamicImport2.baseline.jsonc create mode 100644 tests/baselines/reference/findAllReferencesJSDocFunctionNew.baseline.jsonc create mode 100644 tests/baselines/reference/findAllReferencesJsDocTypeLiteral.baseline.jsonc create mode 100644 tests/baselines/reference/findAllReferencesOfConstructor_badOverload.baseline.jsonc create mode 100644 tests/baselines/reference/findAllReferencesOfJsonModule.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsCatchClause.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsConstructorFunctions.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsDeclareClass.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsEnumAsNamespace.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsEnumMember.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsExportDefaultClassConstructor.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsExportNotAtTopLevel.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForDefaultExport01.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForDefaultExport02.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForDefaultExport03.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForDefaultExport08.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForFunctionExpression01.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForObjectLiteralProperties.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForRest.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForUMDModuleAlias1.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForVariableInExtendsClause01.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsForVariableInExtendsClause02.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsGlobalModuleAugmentation.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsImportType.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsIndexedAccessTypes.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsInheritedProperties1.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsInheritedProperties2.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsInsideTemplates1.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsInsideTemplates2.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsInsideWithBlock.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsJsDocTemplateTag_class.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsJsDocTemplateTag_class_js.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsJsDocTemplateTag_function.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsJsDocTemplateTag_function_js.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsJsDocTypeDef_js.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsMappedType.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsMappedType_nonHomomorphic.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsModuleAugmentation.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsModuleDotExports.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsNoImportClause.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsObjectBindingElementPropertyName01.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsObjectBindingElementPropertyName02.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsObjectBindingElementPropertyName10.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsOnDecorators.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsOnDefinition.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsOnDefinition2.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsOnPrivateParameterProperty1.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsPrimitiveJsDoc.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsPrivateNameAccessors.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsPrivateNameMethods.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsPrivateNameProperties.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsReExport_broken.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsReExport_broken2.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsThisKeyword.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsThisKeywordMultipleFiles.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsTypeParameterInMergedInterface.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsTypedef.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsTypedef_importType.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsTypeofImport.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames8.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames9.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefs_importType_meaningAtLocation.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefs_importType_named.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefs_importType_typeofImport.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefs_jsEnum.baseline.jsonc create mode 100644 tests/baselines/reference/findReferencesAcrossMultipleProjects.baseline.jsonc create mode 100644 tests/baselines/reference/findReferencesJSXTagName2.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfClass.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfComputedProperty.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfEnum.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfFunction.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfInterface.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfNumberNamedProperty.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfParameter.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfStringNamedProperty.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc create mode 100644 tests/baselines/reference/getOccurrencesIsDefinitionOfVariable.baseline.jsonc create mode 100644 tests/baselines/reference/getReferencesAtPosition-pp.baseline.jsonc create mode 100644 tests/baselines/reference/getReferencesAtPosition.baseline.jsonc create mode 100644 tests/baselines/reference/jsdocTypedefTagSemanticMeaning0.baseline.jsonc create mode 100644 tests/baselines/reference/jsdocTypedefTagSemanticMeaning1.baseline.jsonc create mode 100644 tests/baselines/reference/quickInfoUntypedModuleImport.baseline.jsonc create mode 100644 tests/baselines/reference/referenceToClass.baseline.jsonc create mode 100644 tests/baselines/reference/referencesBloomFilters3.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForAmbients.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForAmbients2.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForClassLocal.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForClassParameter.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForEnums.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForExportedValues.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForExternalModuleNames.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForFunctionOverloads.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForFunctionParameter.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForGlobals.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForGlobals2.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForGlobals3.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForGlobals4.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForGlobals5.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForGlobalsInExternalModule.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForImports.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForIndexProperty.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForIndexProperty2.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForIndexProperty3.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForInheritedProperties3.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForInheritedProperties4.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForInheritedProperties9.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForLabel.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForLabel3.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForLabel4.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForLabel5.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForLabel6.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForMergedDeclarations.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForMergedDeclarations2.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForMergedDeclarations4.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForMergedDeclarations6.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForMergedDeclarations8.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForObjectLiteralProperties.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForPropertiesOfGenericType.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForStatic.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForStaticsAndMembersWithSameNames.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForStringLiteralPropertyNames2.baseline.jsonc create mode 100644 tests/baselines/reference/referencesForStringLiteralPropertyNames3.baseline.jsonc create mode 100644 tests/baselines/reference/tsxFindAllReferences1.baseline.jsonc create mode 100644 tests/baselines/reference/tsxFindAllReferences11.baseline.jsonc create mode 100644 tests/baselines/reference/tsxFindAllReferences4.baseline.jsonc create mode 100644 tests/baselines/reference/tsxFindAllReferences5.baseline.jsonc create mode 100644 tests/baselines/reference/tsxFindAllReferences6.baseline.jsonc create mode 100644 tests/baselines/reference/tsxFindAllReferences8.baseline.jsonc create mode 100644 tests/baselines/reference/tsxFindAllReferencesUnionElementType1.baseline.jsonc create mode 100644 tests/baselines/reference/tsxFindAllReferencesUnionElementType2.baseline.jsonc delete mode 100644 tests/cases/fourslash/server/findAllRefsForStringLiteralTypes.ts diff --git a/tests/baselines/reference/ambientShorthandFindAllRefs.baseline.jsonc b/tests/baselines/reference/ambientShorthandFindAllRefs.baseline.jsonc new file mode 100644 index 00000000000..df2fa77a88d --- /dev/null +++ b/tests/baselines/reference/ambientShorthandFindAllRefs.baseline.jsonc @@ -0,0 +1,167 @@ +// === /tests/cases/fourslash/user.ts === +// import {/*FIND ALL REFS*/[|x|]} from "jquery"; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/user.ts", + "kind": "alias", + "name": "(alias) module \"jquery\"\nimport x", + "textSpan": { + "start": 8, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"jquery\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 8, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/user.ts", + "contextSpan": { + "start": 0, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/user2.ts === +// import {/*FIND ALL REFS*/[|x|]} from "jquery"; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/user2.ts", + "kind": "alias", + "name": "(alias) module \"jquery\"\nimport x", + "textSpan": { + "start": 8, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"jquery\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 8, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/user2.ts", + "contextSpan": { + "start": 0, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/esModuleInteropFindAllReferences.baseline.jsonc b/tests/baselines/reference/esModuleInteropFindAllReferences.baseline.jsonc new file mode 100644 index 00000000000..6d8acdedca0 --- /dev/null +++ b/tests/baselines/reference/esModuleInteropFindAllReferences.baseline.jsonc @@ -0,0 +1,159 @@ +undefined + +// === /b.ts === +// import a from "a"; +// a.[|x|]; + +// === /abc.d.ts === +// declare module "a" { +// export const /*FIND ALL REFS*/[|x|]: number; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/abc.d.ts", + "kind": "const", + "name": "const x: number", + "textSpan": { + "start": 38, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 25, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 38, + "length": 1 + }, + "fileName": "/abc.d.ts", + "contextSpan": { + "start": 25, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 21, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.ts === +// import a from "a"; +// a./*FIND ALL REFS*/[|x|]; + +// === /abc.d.ts === +// declare module "a" { +// export const [|x|]: number; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/abc.d.ts", + "kind": "const", + "name": "const x: number", + "textSpan": { + "start": 38, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 25, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 38, + "length": 1 + }, + "fileName": "/abc.d.ts", + "contextSpan": { + "start": 25, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 21, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/esModuleInteropFindAllReferences2.baseline.jsonc b/tests/baselines/reference/esModuleInteropFindAllReferences2.baseline.jsonc new file mode 100644 index 00000000000..dda78ac1555 --- /dev/null +++ b/tests/baselines/reference/esModuleInteropFindAllReferences2.baseline.jsonc @@ -0,0 +1,157 @@ +undefined + +// === /b.ts === +// import a from "./a"; +// a.[|x|]; + +// === /a.d.ts === +// export as namespace abc; +// export const /*FIND ALL REFS*/[|x|]: number; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.d.ts", + "kind": "const", + "name": "const x: number", + "textSpan": { + "start": 38, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 25, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 38, + "length": 1 + }, + "fileName": "/a.d.ts", + "contextSpan": { + "start": 25, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.ts === +// import a from "./a"; +// a./*FIND ALL REFS*/[|x|]; + +// === /a.d.ts === +// export as namespace abc; +// export const [|x|]: number; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.d.ts", + "kind": "const", + "name": "const x: number", + "textSpan": { + "start": 38, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 25, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 38, + "length": 1 + }, + "fileName": "/a.d.ts", + "contextSpan": { + "start": 25, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllReferPropertyAccessExpressionHeritageClause.baseline.jsonc b/tests/baselines/reference/findAllReferPropertyAccessExpressionHeritageClause.baseline.jsonc new file mode 100644 index 00000000000..4f44d2cb719 --- /dev/null +++ b/tests/baselines/reference/findAllReferPropertyAccessExpressionHeritageClause.baseline.jsonc @@ -0,0 +1,308 @@ +// === /tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts === +// class B {} +// function foo() { +// return {/*FIND ALL REFS*/[|B|]: B}; +// } +// class C extends (foo()).[|B|] {} +// class C1 extends foo().[|B|] {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "kind": "property", + "name": "(property) B: typeof B", + "textSpan": { + "start": 40, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "className" + } + ], + "contextSpan": { + "start": 40, + "length": 4 + } + }, + "references": [ + { + "textSpan": { + "start": 40, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "contextSpan": { + "start": 40, + "length": 4 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 73, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 101, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts === +// class B {} +// function foo() { +// return {[|B|]: B}; +// } +// class C extends (foo())./*FIND ALL REFS*/[|B|] {} +// class C1 extends foo().[|B|] {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "kind": "property", + "name": "(property) B: typeof B", + "textSpan": { + "start": 40, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "className" + } + ], + "contextSpan": { + "start": 40, + "length": 4 + } + }, + "references": [ + { + "textSpan": { + "start": 40, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "contextSpan": { + "start": 40, + "length": 4 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 73, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 101, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts === +// class B {} +// function foo() { +// return {[|B|]: B}; +// } +// class C extends (foo()).[|B|] {} +// class C1 extends foo()./*FIND ALL REFS*/[|B|] {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "kind": "property", + "name": "(property) B: typeof B", + "textSpan": { + "start": 40, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "B", + "kind": "className" + } + ], + "contextSpan": { + "start": 40, + "length": 4 + } + }, + "references": [ + { + "textSpan": { + "start": 40, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "contextSpan": { + "start": 40, + "length": 4 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 73, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 101, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllReferencesDynamicImport1.baseline.jsonc b/tests/baselines/reference/findAllReferencesDynamicImport1.baseline.jsonc new file mode 100644 index 00000000000..aaf75764498 --- /dev/null +++ b/tests/baselines/reference/findAllReferencesDynamicImport1.baseline.jsonc @@ -0,0 +1,225 @@ +undefined + +// === /tests/cases/fourslash/foo.ts === +// export function foo() { return "foo"; } +// import("/*FIND ALL REFS*/[|./foo|]") +// var x = import("[|./foo|]") + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/foo.ts", + "kind": "module", + "name": "module \"/tests/cases/fourslash/foo\"", + "textSpan": { + "start": 0, + "length": 79 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"/tests/cases/fourslash/foo\"", + "kind": "stringLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 48, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "contextSpan": { + "start": 40, + "length": 15 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 72, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "contextSpan": { + "start": 56, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/foo.ts === +// export function foo() { return "foo"; } +// import("./foo") +// /*FIND ALL REFS*/var [|x|] = import("./foo") + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/foo.ts", + "kind": "var", + "name": "var x: Promise", + "textSpan": { + "start": 60, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Promise", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"/tests/cases/fourslash/foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ">", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 56, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 60, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "contextSpan": { + "start": 56, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/foo.ts === +// export function foo() { return "foo"; } +// import("[|./foo|]") +// var x = import("/*FIND ALL REFS*/[|./foo|]") + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/foo.ts", + "kind": "module", + "name": "module \"/tests/cases/fourslash/foo\"", + "textSpan": { + "start": 0, + "length": 79 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"/tests/cases/fourslash/foo\"", + "kind": "stringLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 48, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "contextSpan": { + "start": 40, + "length": 15 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 72, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "contextSpan": { + "start": 56, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllReferencesDynamicImport2.baseline.jsonc b/tests/baselines/reference/findAllReferencesDynamicImport2.baseline.jsonc new file mode 100644 index 00000000000..4b496fcc3ac --- /dev/null +++ b/tests/baselines/reference/findAllReferencesDynamicImport2.baseline.jsonc @@ -0,0 +1,169 @@ +// === /tests/cases/fourslash/foo.ts === +// export function /*FIND ALL REFS*/[|bar|]() { return "bar"; } +// var x = import("./foo"); +// x.then(foo => { +// foo.[|bar|](); +// }) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/foo.ts", + "kind": "function", + "name": "function bar(): string", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 39 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "contextSpan": { + "start": 0, + "length": 39 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 89, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/foo.ts === +// export function [|bar|]() { return "bar"; } +// var x = import("./foo"); +// x.then(foo => { +// foo./*FIND ALL REFS*/[|bar|](); +// }) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/foo.ts", + "kind": "function", + "name": "function bar(): string", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 39 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "contextSpan": { + "start": 0, + "length": 39 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 89, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/foo.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllReferencesJSDocFunctionNew.baseline.jsonc b/tests/baselines/reference/findAllReferencesJSDocFunctionNew.baseline.jsonc new file mode 100644 index 00000000000..e560d93e0d6 --- /dev/null +++ b/tests/baselines/reference/findAllReferencesJSDocFunctionNew.baseline.jsonc @@ -0,0 +1,72 @@ +// === /tests/cases/fourslash/Foo.js === +// /** @type {function (/*FIND ALL REFS*/[|new|]: string, string): string} */ +// var f; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/Foo.js", + "kind": "parameter", + "name": "(parameter) new: string", + "textSpan": { + "start": 21, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "new", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 21, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 21, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/Foo.js", + "contextSpan": { + "start": 21, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllReferencesJsDocTypeLiteral.baseline.jsonc b/tests/baselines/reference/findAllReferencesJsDocTypeLiteral.baseline.jsonc new file mode 100644 index 00000000000..7ebf95adc5f --- /dev/null +++ b/tests/baselines/reference/findAllReferencesJsDocTypeLiteral.baseline.jsonc @@ -0,0 +1,169 @@ +// === /tests/cases/fourslash/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./*FIND ALL REFS*/[|great|] - much greatness +// * @param {number} o.nested.times - twice? probably!?? +// */ +// function f(o) { return o.nested.[|great|]; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/foo.js", + "kind": "property", + "name": "(property) great: boolean", + "textSpan": { + "start": 194, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "great", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 168, + "length": 52 + } + }, + "references": [ + { + "textSpan": { + "start": 194, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/foo.js", + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 309, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/foo.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/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.[|great|] - much greatness +// * @param {number} o.nested.times - twice? probably!?? +// */ +// function f(o) { return o.nested./*FIND ALL REFS*/[|great|]; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/foo.js", + "kind": "property", + "name": "(property) great: boolean", + "textSpan": { + "start": 194, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "great", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 168, + "length": 52 + } + }, + "references": [ + { + "textSpan": { + "start": 194, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/foo.js", + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 309, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/foo.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllReferencesOfConstructor_badOverload.baseline.jsonc b/tests/baselines/reference/findAllReferencesOfConstructor_badOverload.baseline.jsonc new file mode 100644 index 00000000000..e5b9f462031 --- /dev/null +++ b/tests/baselines/reference/findAllReferencesOfConstructor_badOverload.baseline.jsonc @@ -0,0 +1,135 @@ +// === /tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts === +// class C { +// /*FIND ALL REFS*/[|constructor|](n: number); +// [|constructor|](){} +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts", + "kind": "class", + "name": "class C", + "textSpan": { + "start": 6, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 59 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts", + "contextSpan": { + "start": 14, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 42, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts", + "contextSpan": { + "start": 42, + "length": 15 + }, + "isWriteAccess": false, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts === +// class C { +// [|constructor|](n: number); +// /*FIND ALL REFS*/[|constructor|](){} +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts", + "kind": "class", + "name": "class C", + "textSpan": { + "start": 6, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 59 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts", + "contextSpan": { + "start": 14, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 42, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts", + "contextSpan": { + "start": 42, + "length": 15 + }, + "isWriteAccess": false, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllReferencesOfJsonModule.baseline.jsonc b/tests/baselines/reference/findAllReferencesOfJsonModule.baseline.jsonc new file mode 100644 index 00000000000..ae2f6a7d874 --- /dev/null +++ b/tests/baselines/reference/findAllReferencesOfJsonModule.baseline.jsonc @@ -0,0 +1,185 @@ +// === /foo.ts === +// /*FIND ALL REFS*/import [|settings|] from "./settings.json"; +// [|settings|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/foo.ts", + "kind": "alias", + "name": "import settings", + "textSpan": { + "start": 7, + "length": 8 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "settings", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 39 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 8 + }, + "fileName": "/foo.ts", + "contextSpan": { + "start": 0, + "length": 39 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 8 + }, + "fileName": "/foo.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /foo.ts === +// import /*FIND ALL REFS*/[|settings|] from "./settings.json"; +// [|settings|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/foo.ts", + "kind": "alias", + "name": "import settings", + "textSpan": { + "start": 7, + "length": 8 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "settings", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 39 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 8 + }, + "fileName": "/foo.ts", + "contextSpan": { + "start": 0, + "length": 39 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 8 + }, + "fileName": "/foo.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /foo.ts === +// import [|settings|] from "./settings.json"; +// /*FIND ALL REFS*/[|settings|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/foo.ts", + "kind": "alias", + "name": "import settings", + "textSpan": { + "start": 7, + "length": 8 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "settings", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 39 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 8 + }, + "fileName": "/foo.ts", + "contextSpan": { + "start": 0, + "length": 39 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 8 + }, + "fileName": "/foo.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsCatchClause.baseline.jsonc b/tests/baselines/reference/findAllRefsCatchClause.baseline.jsonc new file mode 100644 index 00000000000..248c135dae1 --- /dev/null +++ b/tests/baselines/reference/findAllRefsCatchClause.baseline.jsonc @@ -0,0 +1,135 @@ +// === /tests/cases/fourslash/findAllRefsCatchClause.ts === +// try { } +// catch (/*FIND ALL REFS*/[|err|]) { +// [|err|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsCatchClause.ts", + "kind": "var", + "name": "var err: any", + "textSpan": { + "start": 15, + "length": 3 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "err", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 15, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllRefsCatchClause.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllRefsCatchClause.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsCatchClause.ts === +// try { } +// catch ([|err|]) { +// /*FIND ALL REFS*/[|err|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsCatchClause.ts", + "kind": "var", + "name": "var err: any", + "textSpan": { + "start": 15, + "length": 3 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "err", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 15, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllRefsCatchClause.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllRefsCatchClause.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsConstructorFunctions.baseline.jsonc b/tests/baselines/reference/findAllRefsConstructorFunctions.baseline.jsonc new file mode 100644 index 00000000000..7c1b1f58c19 --- /dev/null +++ b/tests/baselines/reference/findAllRefsConstructorFunctions.baseline.jsonc @@ -0,0 +1,439 @@ +// === /a.js === +// function f() { +// /*FIND ALL REFS*/[|this|].x = 0; +// } +// f.prototype.setX = function() { +// this.x = 1; +// } +// f.prototype.useX = function() { this.x; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "var", + "name": "this", + "textSpan": { + "start": 19, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 4 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 19, + "length": 11 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// function f() { +// this./*FIND ALL REFS*/[|x|] = 0; +// } +// f.prototype.setX = function() { +// this.[|x|] = 1; +// } +// f.prototype.useX = function() { this.[|x|]; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "property", + "name": "(property) f.x: number", + "textSpan": { + "start": 24, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 19, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 19, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 74, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 69, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// function f() { +// this.x = 0; +// } +// f.prototype.setX = function() { +// /*FIND ALL REFS*/[|this|].x = 1; +// } +// f.prototype.useX = function() { this.x; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "var", + "name": "this", + "textSpan": { + "start": 69, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 69, + "length": 4 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 69, + "length": 11 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// function f() { +// this.[|x|] = 0; +// } +// f.prototype.setX = function() { +// this./*FIND ALL REFS*/[|x|] = 1; +// } +// f.prototype.useX = function() { this.[|x|]; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "property", + "name": "(property) f.x: number", + "textSpan": { + "start": 24, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 19, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 19, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 74, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 69, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// function f() { +// this.[|x|] = 0; +// } +// f.prototype.setX = function() { +// this.[|x|] = 1; +// } +// f.prototype.useX = function() { this./*FIND ALL REFS*/[|x|]; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "property", + "name": "(property) f.x: number", + "textSpan": { + "start": 24, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 19, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 19, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 74, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 69, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsDeclareClass.baseline.jsonc b/tests/baselines/reference/findAllRefsDeclareClass.baseline.jsonc new file mode 100644 index 00000000000..31f140f0ac7 --- /dev/null +++ b/tests/baselines/reference/findAllRefsDeclareClass.baseline.jsonc @@ -0,0 +1,107 @@ +// === /tests/cases/fourslash/findAllRefsDeclareClass.ts === +// /*FIND ALL REFS*/declare class [|C|] { +// static m(): void; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsDeclareClass.ts", + "kind": "class", + "name": "class C", + "textSpan": { + "start": 14, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 41 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsDeclareClass.ts", + "contextSpan": { + "start": 0, + "length": 41 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsDeclareClass.ts === +// declare class /*FIND ALL REFS*/[|C|] { +// static m(): void; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsDeclareClass.ts", + "kind": "class", + "name": "class C", + "textSpan": { + "start": 14, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 41 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsDeclareClass.ts", + "contextSpan": { + "start": 0, + "length": 41 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsEnumAsNamespace.baseline.jsonc b/tests/baselines/reference/findAllRefsEnumAsNamespace.baseline.jsonc new file mode 100644 index 00000000000..1df219e8476 --- /dev/null +++ b/tests/baselines/reference/findAllRefsEnumAsNamespace.baseline.jsonc @@ -0,0 +1,185 @@ +// === /tests/cases/fourslash/findAllRefsEnumAsNamespace.ts === +// /*FIND ALL REFS*/enum [|E|] { A } +// let e: [|E|].A; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "kind": "enum", + "name": "enum E", + "textSpan": { + "start": 5, + "length": 1 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + } + ], + "contextSpan": { + "start": 0, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "contextSpan": { + "start": 0, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsEnumAsNamespace.ts === +// enum /*FIND ALL REFS*/[|E|] { A } +// let e: [|E|].A; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "kind": "enum", + "name": "enum E", + "textSpan": { + "start": 5, + "length": 1 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + } + ], + "contextSpan": { + "start": 0, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "contextSpan": { + "start": 0, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsEnumAsNamespace.ts === +// enum [|E|] { A } +// let e: /*FIND ALL REFS*/[|E|].A; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "kind": "enum", + "name": "enum E", + "textSpan": { + "start": 5, + "length": 1 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + } + ], + "contextSpan": { + "start": 0, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "contextSpan": { + "start": 0, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsEnumMember.baseline.jsonc b/tests/baselines/reference/findAllRefsEnumMember.baseline.jsonc new file mode 100644 index 00000000000..f73ded75105 --- /dev/null +++ b/tests/baselines/reference/findAllRefsEnumMember.baseline.jsonc @@ -0,0 +1,284 @@ +// === /tests/cases/fourslash/findAllRefsEnumMember.ts === +// enum E { /*FIND ALL REFS*/[|A|], B } +// const e: E.[|A|] = E.[|A|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "kind": "enum member", + "name": "(enum member) E.A = 0", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "A", + "kind": "enumMemberName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "numericLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsEnumMember.ts === +// enum E { [|A|], B } +// const e: E./*FIND ALL REFS*/[|A|] = E.[|A|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "kind": "enum member", + "name": "(enum member) E.A = 0", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "A", + "kind": "enumMemberName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "numericLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsEnumMember.ts === +// enum E { [|A|], B } +// const e: E.[|A|] = E./*FIND ALL REFS*/[|A|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "kind": "enum member", + "name": "(enum member) E.A = 0", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "A", + "kind": "enumMemberName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "numericLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsEnumMember.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsExportDefaultClassConstructor.baseline.jsonc b/tests/baselines/reference/findAllRefsExportDefaultClassConstructor.baseline.jsonc new file mode 100644 index 00000000000..1032c93c93e --- /dev/null +++ b/tests/baselines/reference/findAllRefsExportDefaultClassConstructor.baseline.jsonc @@ -0,0 +1,49 @@ +// === /tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts === +// export default class { +// /*FIND ALL REFS*/[|constructor|]() {} +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts", + "kind": "class", + "name": "class default", + "textSpan": { + "start": 0, + "length": 45 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "default", + "kind": "className" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 27, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts", + "contextSpan": { + "start": 27, + "length": 16 + }, + "isWriteAccess": false, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsExportNotAtTopLevel.baseline.jsonc b/tests/baselines/reference/findAllRefsExportNotAtTopLevel.baseline.jsonc new file mode 100644 index 00000000000..3873e385108 --- /dev/null +++ b/tests/baselines/reference/findAllRefsExportNotAtTopLevel.baseline.jsonc @@ -0,0 +1,153 @@ +undefined + +// === /tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts === +// { +// export const /*FIND ALL REFS*/[|x|] = 0; +// [|x|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts", + "kind": "const", + "name": "const x: 0", + "textSpan": { + "start": 19, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 6, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts", + "contextSpan": { + "start": 6, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts === +// { +// export const [|x|] = 0; +// /*FIND ALL REFS*/[|x|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts", + "kind": "const", + "name": "const x: 0", + "textSpan": { + "start": 19, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 6, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts", + "contextSpan": { + "start": 6, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForDefaultExport01.baseline.jsonc b/tests/baselines/reference/findAllRefsForDefaultExport01.baseline.jsonc new file mode 100644 index 00000000000..ae1123fd9c3 --- /dev/null +++ b/tests/baselines/reference/findAllRefsForDefaultExport01.baseline.jsonc @@ -0,0 +1,299 @@ +// === /tests/cases/fourslash/findAllRefsForDefaultExport01.ts === +// /*FIND ALL REFS*/export default class [|DefaultExportedClass|] { +// } +// +// var x: [|DefaultExportedClass|]; +// +// var y = new [|DefaultExportedClass|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "kind": "class", + "name": "class DefaultExportedClass", + "textSpan": { + "start": 21, + "length": 20 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 45 + } + }, + "references": [ + { + "textSpan": { + "start": 21, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "contextSpan": { + "start": 0, + "length": 45 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 54, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 89, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport01.ts === +// export default class /*FIND ALL REFS*/[|DefaultExportedClass|] { +// } +// +// var x: [|DefaultExportedClass|]; +// +// var y = new [|DefaultExportedClass|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "kind": "class", + "name": "class DefaultExportedClass", + "textSpan": { + "start": 21, + "length": 20 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 45 + } + }, + "references": [ + { + "textSpan": { + "start": 21, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "contextSpan": { + "start": 0, + "length": 45 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 54, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 89, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport01.ts === +// export default class [|DefaultExportedClass|] { +// } +// +// var x: /*FIND ALL REFS*/[|DefaultExportedClass|]; +// +// var y = new [|DefaultExportedClass|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "kind": "class", + "name": "class DefaultExportedClass", + "textSpan": { + "start": 21, + "length": 20 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 45 + } + }, + "references": [ + { + "textSpan": { + "start": 21, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "contextSpan": { + "start": 0, + "length": 45 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 54, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 89, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport01.ts === +// export default class [|DefaultExportedClass|] { +// } +// +// var x: [|DefaultExportedClass|]; +// +// var y = new /*FIND ALL REFS*/[|DefaultExportedClass|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "kind": "class", + "name": "class DefaultExportedClass", + "textSpan": { + "start": 21, + "length": 20 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 45 + } + }, + "references": [ + { + "textSpan": { + "start": 21, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "contextSpan": { + "start": 0, + "length": 45 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 54, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 89, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport01.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForDefaultExport02.baseline.jsonc b/tests/baselines/reference/findAllRefsForDefaultExport02.baseline.jsonc new file mode 100644 index 00000000000..67421d9df77 --- /dev/null +++ b/tests/baselines/reference/findAllRefsForDefaultExport02.baseline.jsonc @@ -0,0 +1,801 @@ +// === /tests/cases/fourslash/findAllRefsForDefaultExport02.ts === +// /*FIND ALL REFS*/export default function [|DefaultExportedFunction|]() { +// return [|DefaultExportedFunction|]; +// } +// +// var x: typeof [|DefaultExportedFunction|]; +// +// var y = [|DefaultExportedFunction|](); +// +// namespace DefaultExportedFunction { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "kind": "function", + "name": "function DefaultExportedFunction(): () => typeof DefaultExportedFunction", + "textSpan": { + "start": 24, + "length": 23 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 0, + "length": 89 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "contextSpan": { + "start": 0, + "length": 89 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 63, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 105, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 139, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport02.ts === +// export default function /*FIND ALL REFS*/[|DefaultExportedFunction|]() { +// return [|DefaultExportedFunction|]; +// } +// +// var x: typeof [|DefaultExportedFunction|]; +// +// var y = [|DefaultExportedFunction|](); +// +// namespace DefaultExportedFunction { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "kind": "function", + "name": "function DefaultExportedFunction(): () => typeof DefaultExportedFunction", + "textSpan": { + "start": 24, + "length": 23 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 0, + "length": 89 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "contextSpan": { + "start": 0, + "length": 89 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 63, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 105, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 139, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport02.ts === +// export default function [|DefaultExportedFunction|]() { +// return /*FIND ALL REFS*/[|DefaultExportedFunction|]; +// } +// +// var x: typeof [|DefaultExportedFunction|]; +// +// var y = [|DefaultExportedFunction|](); +// +// namespace DefaultExportedFunction { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "kind": "function", + "name": "function DefaultExportedFunction(): () => typeof DefaultExportedFunction", + "textSpan": { + "start": 24, + "length": 23 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 0, + "length": 89 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "contextSpan": { + "start": 0, + "length": 89 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 63, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 105, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 139, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport02.ts === +// export default function [|DefaultExportedFunction|]() { +// return [|DefaultExportedFunction|]; +// } +// +// var x: typeof /*FIND ALL REFS*/[|DefaultExportedFunction|]; +// +// var y = [|DefaultExportedFunction|](); +// +// namespace DefaultExportedFunction { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "kind": "function", + "name": "function DefaultExportedFunction(): () => typeof DefaultExportedFunction", + "textSpan": { + "start": 24, + "length": 23 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 0, + "length": 89 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "contextSpan": { + "start": 0, + "length": 89 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 63, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 105, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 139, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport02.ts === +// export default function [|DefaultExportedFunction|]() { +// return [|DefaultExportedFunction|]; +// } +// +// var x: typeof [|DefaultExportedFunction|]; +// +// var y = /*FIND ALL REFS*/[|DefaultExportedFunction|](); +// +// namespace DefaultExportedFunction { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "kind": "function", + "name": "function DefaultExportedFunction(): () => typeof DefaultExportedFunction", + "textSpan": { + "start": 24, + "length": 23 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 0, + "length": 89 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "contextSpan": { + "start": 0, + "length": 89 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 63, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 105, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 139, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport02.ts === +// export default function DefaultExportedFunction() { +// return DefaultExportedFunction; +// } +// +// var x: typeof DefaultExportedFunction; +// +// var y = DefaultExportedFunction(); +// +// /*FIND ALL REFS*/namespace [|DefaultExportedFunction|] { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "kind": "function", + "name": "namespace DefaultExportedFunction", + "textSpan": { + "start": 24, + "length": 23 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 89 + } + }, + "references": [ + { + "textSpan": { + "start": 177, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "contextSpan": { + "start": 167, + "length": 37 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport02.ts === +// export default function DefaultExportedFunction() { +// return DefaultExportedFunction; +// } +// +// var x: typeof DefaultExportedFunction; +// +// var y = DefaultExportedFunction(); +// +// namespace /*FIND ALL REFS*/[|DefaultExportedFunction|] { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "kind": "function", + "name": "namespace DefaultExportedFunction", + "textSpan": { + "start": 24, + "length": 23 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedFunction", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 89 + } + }, + "references": [ + { + "textSpan": { + "start": 177, + "length": 23 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport02.ts", + "contextSpan": { + "start": 167, + "length": 37 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForDefaultExport03.baseline.jsonc b/tests/baselines/reference/findAllRefsForDefaultExport03.baseline.jsonc new file mode 100644 index 00000000000..afb485901b6 --- /dev/null +++ b/tests/baselines/reference/findAllRefsForDefaultExport03.baseline.jsonc @@ -0,0 +1,1151 @@ +// === /tests/cases/fourslash/findAllRefsForDefaultExport03.ts === +// /*FIND ALL REFS*/function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "kind": "function", + "name": "namespace f\nfunction f(): number", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 34, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 95, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 85, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport03.ts === +// function /*FIND ALL REFS*/[|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "kind": "function", + "name": "namespace f\nfunction f(): number", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 34, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 95, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 85, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// /*FIND ALL REFS*/export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "kind": "function", + "name": "namespace f\nfunction f(): number", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 34, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 95, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 85, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default /*FIND ALL REFS*/[|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "kind": "function", + "name": "namespace f\nfunction f(): number", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 34, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 95, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 85, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof /*FIND ALL REFS*/[|f|]; +// +// var y = [|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "kind": "function", + "name": "namespace f\nfunction f(): number", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 34, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 95, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 85, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = /*FIND ALL REFS*/[|f|](); +// +// namespace [|f|] { +// var local = 100; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "kind": "function", + "name": "namespace f\nfunction f(): number", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 34, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 95, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 85, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// /*FIND ALL REFS*/namespace [|f|] { +// var local = 100; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "kind": "function", + "name": "namespace f\nfunction f(): number", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 34, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 95, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 85, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForDefaultExport03.ts === +// function [|f|]() { +// return 100; +// } +// +// export default [|f|]; +// +// var x: typeof [|f|]; +// +// var y = [|f|](); +// +// namespace /*FIND ALL REFS*/[|f|] { +// var local = 100; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "kind": "function", + "name": "namespace f\nfunction f(): number", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 34, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 95, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport03.ts", + "contextSpan": { + "start": 85, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForDefaultExport08.baseline.jsonc b/tests/baselines/reference/findAllRefsForDefaultExport08.baseline.jsonc new file mode 100644 index 00000000000..11a41d244c2 --- /dev/null +++ b/tests/baselines/reference/findAllRefsForDefaultExport08.baseline.jsonc @@ -0,0 +1,75 @@ +// === /tests/cases/fourslash/findAllRefsForDefaultExport08.ts === +// export default class DefaultExportedClass { +// } +// +// var x: DefaultExportedClass; +// +// var y = new DefaultExportedClass; +// +// namespace /*FIND ALL REFS*/[|DefaultExportedClass|] { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport08.ts", + "kind": "class", + "name": "class DefaultExportedClass\nnamespace DefaultExportedClass", + "textSpan": { + "start": 21, + "length": 20 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedClass", + "kind": "moduleName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "DefaultExportedClass", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 45 + } + }, + "references": [ + { + "textSpan": { + "start": 122, + "length": 20 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForDefaultExport08.ts", + "contextSpan": { + "start": 112, + "length": 34 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForFunctionExpression01.baseline.jsonc b/tests/baselines/reference/findAllRefsForFunctionExpression01.baseline.jsonc new file mode 100644 index 00000000000..395538c43c7 --- /dev/null +++ b/tests/baselines/reference/findAllRefsForFunctionExpression01.baseline.jsonc @@ -0,0 +1,1840 @@ +// === /tests/cases/fourslash/file1.ts === +// var foo = /*FIND ALL REFS*/function [|foo|](a = [|foo|](), b = () => [|foo|]) { +// [|foo|]([|foo|], [|foo|]); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file1.ts", + "kind": "local function", + "name": "(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", + "textSpan": { + "start": 19, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "contextSpan": { + "start": 10, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 55, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 59, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// var foo = function /*FIND ALL REFS*/[|foo|](a = [|foo|](), b = () => [|foo|]) { +// [|foo|]([|foo|], [|foo|]); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file1.ts", + "kind": "local function", + "name": "(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", + "textSpan": { + "start": 19, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "contextSpan": { + "start": 10, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 55, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 59, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// var foo = function [|foo|](a = /*FIND ALL REFS*/[|foo|](), b = () => [|foo|]) { +// [|foo|]([|foo|], [|foo|]); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file1.ts", + "kind": "local function", + "name": "(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", + "textSpan": { + "start": 19, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "contextSpan": { + "start": 10, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 55, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 59, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// var foo = function [|foo|](a = [|foo|](), b = () => /*FIND ALL REFS*/[|foo|]) { +// [|foo|]([|foo|], [|foo|]); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file1.ts", + "kind": "local function", + "name": "(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", + "textSpan": { + "start": 19, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "contextSpan": { + "start": 10, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 55, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 59, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// var foo = function [|foo|](a = [|foo|](), b = () => [|foo|]) { +// /*FIND ALL REFS*/[|foo|]([|foo|], [|foo|]); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file1.ts", + "kind": "local function", + "name": "(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", + "textSpan": { + "start": 19, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "contextSpan": { + "start": 10, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 55, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 59, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// var foo = function [|foo|](a = [|foo|](), b = () => [|foo|]) { +// [|foo|](/*FIND ALL REFS*/[|foo|], [|foo|]); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file1.ts", + "kind": "local function", + "name": "(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", + "textSpan": { + "start": 19, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "contextSpan": { + "start": 10, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 55, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 59, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// var foo = function [|foo|](a = [|foo|](), b = () => [|foo|]) { +// [|foo|]([|foo|], /*FIND ALL REFS*/[|foo|]); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file1.ts", + "kind": "local function", + "name": "(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", + "textSpan": { + "start": 19, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "...", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "contextSpan": { + "start": 10, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 55, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 59, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForObjectLiteralProperties.baseline.jsonc b/tests/baselines/reference/findAllRefsForObjectLiteralProperties.baseline.jsonc new file mode 100644 index 00000000000..26a8d82ec21 --- /dev/null +++ b/tests/baselines/reference/findAllRefsForObjectLiteralProperties.baseline.jsonc @@ -0,0 +1,313 @@ +// === /tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts === +// var x = { +// /*FIND ALL REFS*/[|property|]: {} +// }; +// +// x.[|property|]; +// +// let {[|property|]: pVar} = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "kind": "property", + "name": "(property) property: {}", + "textSpan": { + "start": 14, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 14, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "contextSpan": { + "start": 14, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 33, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 49, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "contextSpan": { + "start": 44, + "length": 25 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts === +// var x = { +// [|property|]: {} +// }; +// +// x./*FIND ALL REFS*/[|property|]; +// +// let {[|property|]: pVar} = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "kind": "property", + "name": "(property) property: {}", + "textSpan": { + "start": 14, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 14, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "contextSpan": { + "start": 14, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 33, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 49, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "contextSpan": { + "start": 44, + "length": 25 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts === +// var x = { +// [|property|]: {} +// }; +// +// x.[|property|]; +// +// let {/*FIND ALL REFS*/[|property|]: pVar} = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "kind": "property", + "name": "(property) property: {}", + "textSpan": { + "start": 14, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "property", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 14, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "contextSpan": { + "start": 14, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 33, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 49, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts", + "contextSpan": { + "start": 44, + "length": 25 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForRest.baseline.jsonc b/tests/baselines/reference/findAllRefsForRest.baseline.jsonc new file mode 100644 index 00000000000..7e80767fbac --- /dev/null +++ b/tests/baselines/reference/findAllRefsForRest.baseline.jsonc @@ -0,0 +1,191 @@ +// === /tests/cases/fourslash/findAllRefsForRest.ts === +// interface Gen { +// x: number +// /*FIND ALL REFS*/[|parent|]: Gen; +// millenial: string; +// } +// let t: Gen; +// var { x, ...rest } = t; +// rest.[|parent|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForRest.ts", + "kind": "property", + "name": "(property) Gen.parent: Gen", + "textSpan": { + "start": 34, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Gen", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "parent", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Gen", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 34, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 34, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForRest.ts", + "contextSpan": { + "start": 34, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 113, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForRest.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForRest.ts === +// interface Gen { +// x: number +// [|parent|]: Gen; +// millenial: string; +// } +// let t: Gen; +// var { x, ...rest } = t; +// rest./*FIND ALL REFS*/[|parent|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForRest.ts", + "kind": "property", + "name": "(property) Gen.parent: Gen", + "textSpan": { + "start": 34, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Gen", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "parent", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Gen", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 34, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 34, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForRest.ts", + "contextSpan": { + "start": 34, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 113, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForRest.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForStringLiteralTypes.baseline.jsonc b/tests/baselines/reference/findAllRefsForStringLiteralTypes.baseline.jsonc index 86f8200d130..93cb0d34a7f 100644 --- a/tests/baselines/reference/findAllRefsForStringLiteralTypes.baseline.jsonc +++ b/tests/baselines/reference/findAllRefsForStringLiteralTypes.baseline.jsonc @@ -1,4 +1,4 @@ -// === /a.ts === +// === /tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts === // type Options = "/*FIND ALL REFS*/[|option 1|]" | "option 2"; // let myOption: Options = "[|option 1|]"; @@ -7,7 +7,7 @@ "definition": { "containerKind": "", "containerName": "", - "fileName": "/a.ts", + "fileName": "/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts", "kind": "var", "name": "option 1", "textSpan": { @@ -27,7 +27,7 @@ "start": 16, "length": 8 }, - "fileName": "/a.ts", + "fileName": "/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts", "isWriteAccess": false, "isDefinition": false, "isInString": true @@ -37,7 +37,7 @@ "start": 65, "length": 8 }, - "fileName": "/a.ts", + "fileName": "/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts", "isWriteAccess": false, "isDefinition": false, "isInString": true @@ -46,7 +46,7 @@ } ] -// === /a.ts === +// === /tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts === // type Options = "[|option 1|]" | "option 2"; // let myOption: Options = "/*FIND ALL REFS*/[|option 1|]"; @@ -55,7 +55,7 @@ "definition": { "containerKind": "", "containerName": "", - "fileName": "/a.ts", + "fileName": "/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts", "kind": "var", "name": "option 1", "textSpan": { @@ -75,7 +75,7 @@ "start": 16, "length": 8 }, - "fileName": "/a.ts", + "fileName": "/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts", "isWriteAccess": false, "isDefinition": false, "isInString": true @@ -85,7 +85,7 @@ "start": 65, "length": 8 }, - "fileName": "/a.ts", + "fileName": "/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts", "isWriteAccess": false, "isDefinition": false, "isInString": true diff --git a/tests/baselines/reference/findAllRefsForUMDModuleAlias1.baseline.jsonc b/tests/baselines/reference/findAllRefsForUMDModuleAlias1.baseline.jsonc new file mode 100644 index 00000000000..755e00b8af0 --- /dev/null +++ b/tests/baselines/reference/findAllRefsForUMDModuleAlias1.baseline.jsonc @@ -0,0 +1,151 @@ +undefined + +// === /tests/cases/fourslash/1.ts === +// /// +// [|myLib|].doThing(); + +// === /tests/cases/fourslash/0.d.ts === +// export function doThing(): string; +// export function doTheOtherThing(): void; +// export as namespace /*FIND ALL REFS*/[|myLib|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/0.d.ts", + "kind": "alias", + "name": "export namespace myLib", + "textSpan": { + "start": 96, + "length": 5 + }, + "displayParts": [ + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "myLib", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 76, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 96, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/0.d.ts", + "contextSpan": { + "start": 76, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 32, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/1.ts === +// /// +// /*FIND ALL REFS*/[|myLib|].doThing(); + +// === /tests/cases/fourslash/0.d.ts === +// export function doThing(): string; +// export function doTheOtherThing(): void; +// export as namespace [|myLib|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/0.d.ts", + "kind": "alias", + "name": "export namespace myLib", + "textSpan": { + "start": 96, + "length": 5 + }, + "displayParts": [ + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "myLib", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 76, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 96, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/0.d.ts", + "contextSpan": { + "start": 76, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 32, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForVariableInExtendsClause01.baseline.jsonc b/tests/baselines/reference/findAllRefsForVariableInExtendsClause01.baseline.jsonc new file mode 100644 index 00000000000..c33eb9b14cb --- /dev/null +++ b/tests/baselines/reference/findAllRefsForVariableInExtendsClause01.baseline.jsonc @@ -0,0 +1,245 @@ +// === /tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts === +// /*FIND ALL REFS*/var [|Base|] = class { }; +// class C extends [|Base|] { } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "kind": "var", + "name": "var Base: typeof Base", + "textSpan": { + "start": 4, + "length": 4 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "contextSpan": { + "start": 0, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 38, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts === +// var /*FIND ALL REFS*/[|Base|] = class { }; +// class C extends [|Base|] { } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "kind": "var", + "name": "var Base: typeof Base", + "textSpan": { + "start": 4, + "length": 4 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "contextSpan": { + "start": 0, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 38, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts === +// var [|Base|] = class { }; +// class C extends /*FIND ALL REFS*/[|Base|] { } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "kind": "var", + "name": "var Base: typeof Base", + "textSpan": { + "start": 4, + "length": 4 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "contextSpan": { + "start": 0, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 38, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsForVariableInExtendsClause02.baseline.jsonc b/tests/baselines/reference/findAllRefsForVariableInExtendsClause02.baseline.jsonc new file mode 100644 index 00000000000..12482136138 --- /dev/null +++ b/tests/baselines/reference/findAllRefsForVariableInExtendsClause02.baseline.jsonc @@ -0,0 +1,194 @@ +// === /tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts === +// /*FIND ALL REFS*/interface [|Base|] { } +// namespace n { +// var Base = class { }; +// interface I extends [|Base|] { } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "kind": "interface", + "name": "interface Base", + "textSpan": { + "start": 10, + "length": 4 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "contextSpan": { + "start": 0, + "length": 18 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 83, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts === +// interface /*FIND ALL REFS*/[|Base|] { } +// namespace n { +// var Base = class { }; +// interface I extends [|Base|] { } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "kind": "interface", + "name": "interface Base", + "textSpan": { + "start": 10, + "length": 4 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "contextSpan": { + "start": 0, + "length": 18 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 83, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts === +// interface [|Base|] { } +// namespace n { +// var Base = class { }; +// interface I extends /*FIND ALL REFS*/[|Base|] { } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "kind": "interface", + "name": "interface Base", + "textSpan": { + "start": 10, + "length": 4 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Base", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "contextSpan": { + "start": 0, + "length": 18 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 83, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsGlobalModuleAugmentation.baseline.jsonc b/tests/baselines/reference/findAllRefsGlobalModuleAugmentation.baseline.jsonc new file mode 100644 index 00000000000..540fbd0eee2 --- /dev/null +++ b/tests/baselines/reference/findAllRefsGlobalModuleAugmentation.baseline.jsonc @@ -0,0 +1,260 @@ +// === /b.ts === +// [|f|](); + +// === /a.ts === +// export {}; +// declare global { +// /*FIND ALL REFS*/function [|f|](): void; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "function", + "name": "function f(): void", + "textSpan": { + "start": 41, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 32, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 32, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 0, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.ts === +// [|f|](); + +// === /a.ts === +// export {}; +// declare global { +// function /*FIND ALL REFS*/[|f|](): void; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "function", + "name": "function f(): void", + "textSpan": { + "start": 41, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 32, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 32, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 0, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.ts === +// /*FIND ALL REFS*/[|f|](); + +// === /a.ts === +// export {}; +// declare global { +// function [|f|](): void; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "function", + "name": "function f(): void", + "textSpan": { + "start": 41, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 32, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 32, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 0, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsImportType.baseline.jsonc b/tests/baselines/reference/findAllRefsImportType.baseline.jsonc new file mode 100644 index 00000000000..c8a95dbf084 --- /dev/null +++ b/tests/baselines/reference/findAllRefsImportType.baseline.jsonc @@ -0,0 +1,242 @@ +// === /b.js === +// type T = import("./a").[|N|]; + +// === /a.js === +// module.exports = 0; +// /*FIND ALL REFS*/export type [|N|] = number; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type", + "name": "type N = number", + "textSpan": { + "start": 32, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "N", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 20, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 32, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 20, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.js === +// type T = import("./a").[|N|]; + +// === /a.js === +// module.exports = 0; +// export type /*FIND ALL REFS*/[|N|] = number; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type", + "name": "type N = number", + "textSpan": { + "start": 32, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "N", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 20, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 32, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 20, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.js === +// type T = import("./a")./*FIND ALL REFS*/[|N|]; + +// === /a.js === +// module.exports = 0; +// export type [|N|] = number; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type", + "name": "type N = number", + "textSpan": { + "start": 32, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "N", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 20, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 32, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 20, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsIndexedAccessTypes.baseline.jsonc b/tests/baselines/reference/findAllRefsIndexedAccessTypes.baseline.jsonc new file mode 100644 index 00000000000..c3343dbd25a --- /dev/null +++ b/tests/baselines/reference/findAllRefsIndexedAccessTypes.baseline.jsonc @@ -0,0 +1,391 @@ +// === /tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts === +// interface I { +// /*FIND ALL REFS*/[|0|]: number; +// s: string; +// } +// interface J { +// a: I[[|0|]], +// b: I["s"], +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "kind": "property", + "name": "(property) I[0]: number", + "textSpan": { + "start": 18, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "0", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "contextSpan": { + "start": 18, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 69, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts === +// interface I { +// 0: number; +// /*FIND ALL REFS*/[|s|]: string; +// } +// interface J { +// a: I[0], +// b: I["[|s|]"], +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "kind": "property", + "name": "(property) I.s: string", + "textSpan": { + "start": 33, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "s", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "contextSpan": { + "start": 33, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts === +// interface I { +// [|0|]: number; +// s: string; +// } +// interface J { +// a: I[/*FIND ALL REFS*/[|0|]], +// b: I["s"], +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "kind": "property", + "name": "(property) I[0]: number", + "textSpan": { + "start": 18, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "0", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "contextSpan": { + "start": 18, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 69, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts === +// interface I { +// 0: number; +// [|s|]: string; +// } +// interface J { +// a: I[0], +// b: I["/*FIND ALL REFS*/[|s|]"], +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "kind": "property", + "name": "(property) I.s: string", + "textSpan": { + "start": 33, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "s", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "contextSpan": { + "start": 33, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsInheritedProperties1.baseline.jsonc b/tests/baselines/reference/findAllRefsInheritedProperties1.baseline.jsonc new file mode 100644 index 00000000000..6ab6f24fadb --- /dev/null +++ b/tests/baselines/reference/findAllRefsInheritedProperties1.baseline.jsonc @@ -0,0 +1,399 @@ +// === /tests/cases/fourslash/findAllRefsInheritedProperties1.ts === +// class class1 extends class1 { +// /*FIND ALL REFS*/[|doStuff|]() { } +// propName: string; +// } +// +// var v: class1; +// v.[|doStuff|](); +// v.propName; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "kind": "method", + "name": "(method) class1.doStuff(): void", + "textSpan": { + "start": 33, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class1", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doStuff", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "contextSpan": { + "start": 33, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 88, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInheritedProperties1.ts === +// class class1 extends class1 { +// doStuff() { } +// /*FIND ALL REFS*/[|propName|]: string; +// } +// +// var v: class1; +// v.doStuff(); +// v.[|propName|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "kind": "property", + "name": "(property) class1.propName: string", + "textSpan": { + "start": 50, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class1", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "propName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 50, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 50, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "contextSpan": { + "start": 50, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 101, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInheritedProperties1.ts === +// class class1 extends class1 { +// [|doStuff|]() { } +// propName: string; +// } +// +// var v: class1; +// v./*FIND ALL REFS*/[|doStuff|](); +// v.propName; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "kind": "method", + "name": "(method) class1.doStuff(): void", + "textSpan": { + "start": 33, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class1", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doStuff", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "contextSpan": { + "start": 33, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 88, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInheritedProperties1.ts === +// class class1 extends class1 { +// doStuff() { } +// [|propName|]: string; +// } +// +// var v: class1; +// v.doStuff(); +// v./*FIND ALL REFS*/[|propName|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "kind": "property", + "name": "(property) class1.propName: string", + "textSpan": { + "start": 50, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class1", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "propName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 50, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 50, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "contextSpan": { + "start": 50, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 101, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsInheritedProperties2.baseline.jsonc b/tests/baselines/reference/findAllRefsInheritedProperties2.baseline.jsonc new file mode 100644 index 00000000000..7522a0f1d9d --- /dev/null +++ b/tests/baselines/reference/findAllRefsInheritedProperties2.baseline.jsonc @@ -0,0 +1,399 @@ +// === /tests/cases/fourslash/findAllRefsInheritedProperties2.ts === +// interface interface1 extends interface1 { +// /*FIND ALL REFS*/[|doStuff|](): void; // r0 +// propName: string; // r1 +// } +// +// var v: interface1; +// v.[|doStuff|](); // r2 +// v.propName; // r3 + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "kind": "method", + "name": "(method) interface1.doStuff(): void", + "textSpan": { + "start": 45, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "interface1", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doStuff", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 45, + "length": 16 + } + }, + "references": [ + { + "textSpan": { + "start": 45, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "contextSpan": { + "start": 45, + "length": 16 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 122, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInheritedProperties2.ts === +// interface interface1 extends interface1 { +// doStuff(): void; // r0 +// /*FIND ALL REFS*/[|propName|]: string; // r1 +// } +// +// var v: interface1; +// v.doStuff(); // r2 +// v.[|propName|]; // r3 + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "kind": "property", + "name": "(property) interface1.propName: string", + "textSpan": { + "start": 73, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "interface1", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "propName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 73, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 73, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "contextSpan": { + "start": 73, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 142, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInheritedProperties2.ts === +// interface interface1 extends interface1 { +// [|doStuff|](): void; // r0 +// propName: string; // r1 +// } +// +// var v: interface1; +// v./*FIND ALL REFS*/[|doStuff|](); // r2 +// v.propName; // r3 + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "kind": "method", + "name": "(method) interface1.doStuff(): void", + "textSpan": { + "start": 45, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "interface1", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doStuff", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 45, + "length": 16 + } + }, + "references": [ + { + "textSpan": { + "start": 45, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "contextSpan": { + "start": 45, + "length": 16 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 122, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInheritedProperties2.ts === +// interface interface1 extends interface1 { +// doStuff(): void; // r0 +// [|propName|]: string; // r1 +// } +// +// var v: interface1; +// v.doStuff(); // r2 +// v./*FIND ALL REFS*/[|propName|]; // r3 + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "kind": "property", + "name": "(property) interface1.propName: string", + "textSpan": { + "start": 73, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "interface1", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "propName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 73, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 73, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "contextSpan": { + "start": 73, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 142, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInheritedProperties2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsInsideTemplates1.baseline.jsonc b/tests/baselines/reference/findAllRefsInsideTemplates1.baseline.jsonc new file mode 100644 index 00000000000..e6b0a445694 --- /dev/null +++ b/tests/baselines/reference/findAllRefsInsideTemplates1.baseline.jsonc @@ -0,0 +1,331 @@ +// === /tests/cases/fourslash/findAllRefsInsideTemplates1.ts === +// /*FIND ALL REFS*/var [|x|] = 10; +// var y = `${ [|x|] } ${ [|x|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "contextSpan": { + "start": 0, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 24, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideTemplates1.ts === +// var /*FIND ALL REFS*/[|x|] = 10; +// var y = `${ [|x|] } ${ [|x|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "contextSpan": { + "start": 0, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 24, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideTemplates1.ts === +// var [|x|] = 10; +// var y = `${ /*FIND ALL REFS*/[|x|] } ${ [|x|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "contextSpan": { + "start": 0, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 24, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideTemplates1.ts === +// var [|x|] = 10; +// var y = `${ [|x|] } ${ /*FIND ALL REFS*/[|x|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "contextSpan": { + "start": 0, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 24, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsInsideTemplates2.baseline.jsonc b/tests/baselines/reference/findAllRefsInsideTemplates2.baseline.jsonc new file mode 100644 index 00000000000..2b594791c5d --- /dev/null +++ b/tests/baselines/reference/findAllRefsInsideTemplates2.baseline.jsonc @@ -0,0 +1,639 @@ +// === /tests/cases/fourslash/findAllRefsInsideTemplates2.ts === +// /*FIND ALL REFS*/function [|f|](...rest: any[]) { } +// [|f|] `${ [|f|] } ${ [|f|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "kind": "function", + "name": "function f(...rest: any[]): void", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "rest", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "contextSpan": { + "start": 0, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideTemplates2.ts === +// function /*FIND ALL REFS*/[|f|](...rest: any[]) { } +// [|f|] `${ [|f|] } ${ [|f|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "kind": "function", + "name": "function f(...rest: any[]): void", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "rest", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "contextSpan": { + "start": 0, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideTemplates2.ts === +// function [|f|](...rest: any[]) { } +// /*FIND ALL REFS*/[|f|] `${ [|f|] } ${ [|f|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "kind": "function", + "name": "function f(...rest: any[]): void", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "rest", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "contextSpan": { + "start": 0, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideTemplates2.ts === +// function [|f|](...rest: any[]) { } +// [|f|] `${ /*FIND ALL REFS*/[|f|] } ${ [|f|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "kind": "function", + "name": "function f(...rest: any[]): void", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "rest", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "contextSpan": { + "start": 0, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideTemplates2.ts === +// function [|f|](...rest: any[]) { } +// [|f|] `${ [|f|] } ${ /*FIND ALL REFS*/[|f|] }` + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "kind": "function", + "name": "function f(...rest: any[]): void", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "...", + "kind": "punctuation" + }, + { + "text": "rest", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "contextSpan": { + "start": 0, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideTemplates2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsInsideWithBlock.baseline.jsonc b/tests/baselines/reference/findAllRefsInsideWithBlock.baseline.jsonc new file mode 100644 index 00000000000..8e016cc68d4 --- /dev/null +++ b/tests/baselines/reference/findAllRefsInsideWithBlock.baseline.jsonc @@ -0,0 +1,355 @@ +// === /tests/cases/fourslash/findAllRefsInsideWithBlock.ts === +// /*FIND ALL REFS*/var [|x|] = 0; +// +// with ({}) { +// var y = x; // Reference of x here should not be picked +// y++; // also reference for y should be ignored +// } +// +// [|x|] = [|x|] + 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 145, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 149, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideWithBlock.ts === +// var /*FIND ALL REFS*/[|x|] = 0; +// +// with ({}) { +// var y = x; // Reference of x here should not be picked +// y++; // also reference for y should be ignored +// } +// +// [|x|] = [|x|] + 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 145, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 149, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideWithBlock.ts === +// var [|x|] = 0; +// +// with ({}) { +// var y = x; // Reference of x here should not be picked +// y++; // also reference for y should be ignored +// } +// +// /*FIND ALL REFS*/[|x|] = [|x|] + 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 145, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 149, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsInsideWithBlock.ts === +// var [|x|] = 0; +// +// with ({}) { +// var y = x; // Reference of x here should not be picked +// y++; // also reference for y should be ignored +// } +// +// [|x|] = /*FIND ALL REFS*/[|x|] + 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 145, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 149, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsInsideWithBlock.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsJsDocTemplateTag_class.baseline.jsonc b/tests/baselines/reference/findAllRefsJsDocTemplateTag_class.baseline.jsonc new file mode 100644 index 00000000000..a019345af6a --- /dev/null +++ b/tests/baselines/reference/findAllRefsJsDocTemplateTag_class.baseline.jsonc @@ -0,0 +1,179 @@ +// === /tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts === +// /** @template /*FIND ALL REFS*/[|T|] */ +// class C<[|T|]> {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts", + "kind": "type parameter", + "name": "(type parameter) T in C", + "textSpan": { + "start": 27, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 27, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts", + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts === +// /** @template [|T|] */ +// class C {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts", + "kind": "type parameter", + "name": "(type parameter) T in C", + "textSpan": { + "start": 27, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 27, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts", + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsJsDocTemplateTag_class_js.baseline.jsonc b/tests/baselines/reference/findAllRefsJsDocTemplateTag_class_js.baseline.jsonc new file mode 100644 index 00000000000..a6a7d95d16b --- /dev/null +++ b/tests/baselines/reference/findAllRefsJsDocTemplateTag_class_js.baseline.jsonc @@ -0,0 +1,189 @@ +// === /a.js === +// /** @template /*FIND ALL REFS*/[|T|] */ +// class C { +// constructor() { +// /** @type {[|T|]} */ +// this.x = null; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type parameter", + "name": "(type parameter) T in C", + "textSpan": { + "start": 14, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 68, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** @template [|T|] */ +// class C { +// constructor() { +// /** @type {/*FIND ALL REFS*/[|T|]} */ +// this.x = null; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type parameter", + "name": "(type parameter) T in C", + "textSpan": { + "start": 14, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 68, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsJsDocTemplateTag_function.baseline.jsonc b/tests/baselines/reference/findAllRefsJsDocTemplateTag_function.baseline.jsonc new file mode 100644 index 00000000000..622616c4790 --- /dev/null +++ b/tests/baselines/reference/findAllRefsJsDocTemplateTag_function.baseline.jsonc @@ -0,0 +1,219 @@ +// === /tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts === +// /** @template /*FIND ALL REFS*/[|T|] */ +// function f<[|T|]>() {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts", + "kind": "type parameter", + "name": "(type parameter) T in f(): void", + "textSpan": { + "start": 30, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts", + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts === +// /** @template [|T|] */ +// function f() {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts", + "kind": "type parameter", + "name": "(type parameter) T in f(): void", + "textSpan": { + "start": 30, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "functionName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts", + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsJsDocTemplateTag_function_js.baseline.jsonc b/tests/baselines/reference/findAllRefsJsDocTemplateTag_function_js.baseline.jsonc new file mode 100644 index 00000000000..571efab9d3e --- /dev/null +++ b/tests/baselines/reference/findAllRefsJsDocTemplateTag_function_js.baseline.jsonc @@ -0,0 +1,129 @@ +// === /a.js === +// /** +// * @template /*FIND ALL REFS*/[|T|] +// * @return {[|T|]} +// */ +// function f() {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type parameter", + "name": "(type parameter) T", + "textSpan": { + "start": 17, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 17, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** +// * @template [|T|] +// * @return {/*FIND ALL REFS*/[|T|]} +// */ +// function f() {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type parameter", + "name": "(type parameter) T", + "textSpan": { + "start": 17, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 17, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsJsDocTypeDef_js.baseline.jsonc b/tests/baselines/reference/findAllRefsJsDocTypeDef_js.baseline.jsonc new file mode 100644 index 00000000000..81ea0c62d22 --- /dev/null +++ b/tests/baselines/reference/findAllRefsJsDocTypeDef_js.baseline.jsonc @@ -0,0 +1,289 @@ +undefined + +// === /a.js === +// /** @typedef {number} /*FIND ALL REFS*/[|T|] */ +// +// /** +// * @return {[|T|]} +// */ +// function f(obj) { return 0; } +// +// /** +// * @return {[|T|]} +// */ +// function f2(obj) { return 0; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 22, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 4, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 4, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** @typedef {number} [|T|] */ +// +// /** +// * @return {/*FIND ALL REFS*/[|T|]} +// */ +// function f(obj) { return 0; } +// +// /** +// * @return {[|T|]} +// */ +// function f2(obj) { return 0; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 22, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 4, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 4, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** @typedef {number} [|T|] */ +// +// /** +// * @return {[|T|]} +// */ +// function f(obj) { return 0; } +// +// /** +// * @return {/*FIND ALL REFS*/[|T|]} +// */ +// function f2(obj) { return 0; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 22, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 4, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 4, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsMappedType.baseline.jsonc b/tests/baselines/reference/findAllRefsMappedType.baseline.jsonc new file mode 100644 index 00000000000..6082c7b5514 --- /dev/null +++ b/tests/baselines/reference/findAllRefsMappedType.baseline.jsonc @@ -0,0 +1,308 @@ +// === /tests/cases/fourslash/findAllRefsMappedType.ts === +// interface T { /*FIND ALL REFS*/[|a|]: number; } +// type U = { readonly [K in keyof T]?: string }; +// declare const t: T; +// t.[|a|]; +// declare const u: U; +// u.[|a|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "kind": "property", + "name": "(property) T.a: number", + "textSpan": { + "start": 14, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "contextSpan": { + "start": 14, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 96, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 121, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsMappedType.ts === +// interface T { [|a|]: number; } +// type U = { readonly [K in keyof T]?: string }; +// declare const t: T; +// t./*FIND ALL REFS*/[|a|]; +// declare const u: U; +// u.[|a|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "kind": "property", + "name": "(property) T.a: number", + "textSpan": { + "start": 14, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "contextSpan": { + "start": 14, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 96, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 121, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsMappedType.ts === +// interface T { [|a|]: number; } +// type U = { readonly [K in keyof T]?: string }; +// declare const t: T; +// t.[|a|]; +// declare const u: U; +// u./*FIND ALL REFS*/[|a|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "kind": "property", + "name": "(property) T.a: number", + "textSpan": { + "start": 14, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "a", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "contextSpan": { + "start": 14, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 96, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 121, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsMappedType_nonHomomorphic.baseline.jsonc b/tests/baselines/reference/findAllRefsMappedType_nonHomomorphic.baseline.jsonc new file mode 100644 index 00000000000..e51ce5692d1 --- /dev/null +++ b/tests/baselines/reference/findAllRefsMappedType_nonHomomorphic.baseline.jsonc @@ -0,0 +1,151 @@ +// === /tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts === +// function f(x: { [K in "m"]: number; }) { +// x./*FIND ALL REFS*/[|m|]; +// x.[|m|] +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts", + "kind": "property", + "name": "(property) m: number", + "textSpan": { + "start": 47, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "m", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 47, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 56, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts === +// function f(x: { [K in "m"]: number; }) { +// x.[|m|]; +// x./*FIND ALL REFS*/[|m|] +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts", + "kind": "property", + "name": "(property) m: number", + "textSpan": { + "start": 56, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "m", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 47, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 56, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsModuleAugmentation.baseline.jsonc b/tests/baselines/reference/findAllRefsModuleAugmentation.baseline.jsonc new file mode 100644 index 00000000000..501a5d718c6 --- /dev/null +++ b/tests/baselines/reference/findAllRefsModuleAugmentation.baseline.jsonc @@ -0,0 +1,248 @@ +// === /node_modules/foo/index.d.ts === +// /*FIND ALL REFS*/export type [|T|] = number; + +// === /a.ts === +// import * as foo from "foo"; +// declare module "foo" { +// export const x: [|T|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/node_modules/foo/index.d.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/node_modules/foo/index.d.ts", + "contextSpan": { + "start": 0, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 71, + "length": 1 + }, + "fileName": "/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /node_modules/foo/index.d.ts === +// export type /*FIND ALL REFS*/[|T|] = number; + +// === /a.ts === +// import * as foo from "foo"; +// declare module "foo" { +// export const x: [|T|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/node_modules/foo/index.d.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/node_modules/foo/index.d.ts", + "contextSpan": { + "start": 0, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 71, + "length": 1 + }, + "fileName": "/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /node_modules/foo/index.d.ts === +// export type [|T|] = number; + +// === /a.ts === +// import * as foo from "foo"; +// declare module "foo" { +// export const x: /*FIND ALL REFS*/[|T|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/node_modules/foo/index.d.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/node_modules/foo/index.d.ts", + "contextSpan": { + "start": 0, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 71, + "length": 1 + }, + "fileName": "/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsModuleDotExports.baseline.jsonc b/tests/baselines/reference/findAllRefsModuleDotExports.baseline.jsonc new file mode 100644 index 00000000000..48bf6d1babf --- /dev/null +++ b/tests/baselines/reference/findAllRefsModuleDotExports.baseline.jsonc @@ -0,0 +1,179 @@ +// === /a.js === +// /*FIND ALL REFS*/const [|b|] = require("./b"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "alias", + "name": "import b", + "textSpan": { + "start": 6, + "length": 1 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "b", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 0, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /b.js === +// [|module|].exports = 0; + +// === /a.js === +// const b = require("/*FIND ALL REFS*/[|./b|]"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/b.js", + "kind": "module", + "name": "module \"/b\"", + "textSpan": { + "start": 0, + "length": 19 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"/b\"", + "kind": "stringLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 0, + "length": 25 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 6 + }, + "fileName": "/b.js", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.js === +// /*FIND ALL REFS*/[|module|].exports = 0; + +// === /a.js === +// const b = require("[|./b|]"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/b.js", + "kind": "module", + "name": "module \"/b\"", + "textSpan": { + "start": 0, + "length": 19 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"/b\"", + "kind": "stringLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 19, + "length": 3 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 0, + "length": 25 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 6 + }, + "fileName": "/b.js", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsNoImportClause.baseline.jsonc b/tests/baselines/reference/findAllRefsNoImportClause.baseline.jsonc new file mode 100644 index 00000000000..0397e8cfd99 --- /dev/null +++ b/tests/baselines/reference/findAllRefsNoImportClause.baseline.jsonc @@ -0,0 +1,65 @@ +undefined + +// === /a.ts === +// export const /*FIND ALL REFS*/[|x|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "const", + "name": "const x: 0", + "textSpan": { + "start": 13, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName01.baseline.jsonc b/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName01.baseline.jsonc new file mode 100644 index 00000000000..cfb0e93c2f5 --- /dev/null +++ b/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName01.baseline.jsonc @@ -0,0 +1,199 @@ +// === /tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts === +// interface I { +// /*FIND ALL REFS*/[|property1|]: number; +// property2: string; +// } +// +// var foo: I; +// var { [|property1|]: prop1 } = foo; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts", + "kind": "property", + "name": "(property) I.property1: number", + "textSpan": { + "start": 18, + "length": 9 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "property1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts", + "contextSpan": { + "start": 18, + "length": 18 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 81, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts", + "contextSpan": { + "start": 75, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts === +// interface I { +// [|property1|]: number; +// property2: string; +// } +// +// var foo: I; +// var { /*FIND ALL REFS*/[|property1|]: prop1 } = foo; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts", + "kind": "property", + "name": "(property) I.property1: number", + "textSpan": { + "start": 18, + "length": 9 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "property1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts", + "contextSpan": { + "start": 18, + "length": 18 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 81, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts", + "contextSpan": { + "start": 75, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName02.baseline.jsonc b/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName02.baseline.jsonc new file mode 100644 index 00000000000..79c33c9d6c4 --- /dev/null +++ b/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName02.baseline.jsonc @@ -0,0 +1,199 @@ +// === /tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts === +// interface I { +// /*FIND ALL REFS*/[|property1|]: number; +// property2: string; +// } +// +// var foo: I; +// var { [|property1|]: {} } = foo; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts", + "kind": "property", + "name": "(property) I.property1: number", + "textSpan": { + "start": 18, + "length": 9 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "property1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts", + "contextSpan": { + "start": 18, + "length": 18 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 81, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts", + "contextSpan": { + "start": 75, + "length": 28 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts === +// interface I { +// [|property1|]: number; +// property2: string; +// } +// +// var foo: I; +// var { /*FIND ALL REFS*/[|property1|]: {} } = foo; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts", + "kind": "property", + "name": "(property) I.property1: number", + "textSpan": { + "start": 18, + "length": 9 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "property1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts", + "contextSpan": { + "start": 18, + "length": 18 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 81, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts", + "contextSpan": { + "start": 75, + "length": 28 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName10.baseline.jsonc b/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName10.baseline.jsonc new file mode 100644 index 00000000000..2a870aaebd3 --- /dev/null +++ b/tests/baselines/reference/findAllRefsObjectBindingElementPropertyName10.baseline.jsonc @@ -0,0 +1,349 @@ +// === /tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts === +// interface Recursive { +// /*FIND ALL REFS*/[|next|]?: Recursive; +// value: any; +// } +// +// function f ({ [|next|]: { [|next|]: x} }: Recursive) { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "kind": "property", + "name": "(property) Recursive.next?: Recursive", + "textSpan": { + "start": 26, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Recursive", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "next", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Recursive", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 26, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 26, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 75, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 85, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 75, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts === +// interface Recursive { +// [|next|]?: Recursive; +// value: any; +// } +// +// function f ({ /*FIND ALL REFS*/[|next|]: { [|next|]: x} }: Recursive) { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "kind": "property", + "name": "(property) Recursive.next?: Recursive", + "textSpan": { + "start": 26, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Recursive", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "next", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Recursive", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 26, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 26, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 75, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 85, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 75, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts === +// interface Recursive { +// [|next|]?: Recursive; +// value: any; +// } +// +// function f ({ [|next|]: { /*FIND ALL REFS*/[|next|]: x} }: Recursive) { +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "kind": "property", + "name": "(property) Recursive.next?: Recursive", + "textSpan": { + "start": 26, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Recursive", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "next", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Recursive", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 26, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 26, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 75, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 85, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts", + "contextSpan": { + "start": 75, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsOnDecorators.baseline.jsonc b/tests/baselines/reference/findAllRefsOnDecorators.baseline.jsonc new file mode 100644 index 00000000000..42715239405 --- /dev/null +++ b/tests/baselines/reference/findAllRefsOnDecorators.baseline.jsonc @@ -0,0 +1,803 @@ +// === /tests/cases/fourslash/b.ts === +// @[|decorator|] @[|decorator|]("again") +// class C { +// @[|decorator|] +// method() {} +// } + +// === /tests/cases/fourslash/a.ts === +// /*FIND ALL REFS*/function [|decorator|](target) { +// return target; +// } +// [|decorator|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "function", + "name": "function decorator(target: any): any", + "textSpan": { + "start": 9, + "length": 9 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decorator", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "target", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 49 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 49 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 46, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/b.ts === +// @[|decorator|] @[|decorator|]("again") +// class C { +// @[|decorator|] +// method() {} +// } + +// === /tests/cases/fourslash/a.ts === +// function /*FIND ALL REFS*/[|decorator|](target) { +// return target; +// } +// [|decorator|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "function", + "name": "function decorator(target: any): any", + "textSpan": { + "start": 9, + "length": 9 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decorator", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "target", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 49 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 49 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 46, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/b.ts === +// @[|decorator|] @[|decorator|]("again") +// class C { +// @[|decorator|] +// method() {} +// } + +// === /tests/cases/fourslash/a.ts === +// function [|decorator|](target) { +// return target; +// } +// /*FIND ALL REFS*/[|decorator|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "function", + "name": "function decorator(target: any): any", + "textSpan": { + "start": 9, + "length": 9 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decorator", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "target", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 49 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 49 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 46, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/b.ts === +// @/*FIND ALL REFS*/[|decorator|] @[|decorator|]("again") +// class C { +// @[|decorator|] +// method() {} +// } + +// === /tests/cases/fourslash/a.ts === +// function [|decorator|](target) { +// return target; +// } +// [|decorator|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "function", + "name": "function decorator(target: any): any", + "textSpan": { + "start": 9, + "length": 9 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decorator", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "target", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 49 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 49 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 46, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/b.ts === +// @[|decorator|] @/*FIND ALL REFS*/[|decorator|]("again") +// class C { +// @[|decorator|] +// method() {} +// } + +// === /tests/cases/fourslash/a.ts === +// function [|decorator|](target) { +// return target; +// } +// [|decorator|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "function", + "name": "function decorator(target: any): any", + "textSpan": { + "start": 9, + "length": 9 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decorator", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "target", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 49 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 49 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 46, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/b.ts === +// @[|decorator|] @[|decorator|]("again") +// class C { +// @/*FIND ALL REFS*/[|decorator|] +// method() {} +// } + +// === /tests/cases/fourslash/a.ts === +// function [|decorator|](target) { +// return target; +// } +// [|decorator|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "function", + "name": "function decorator(target: any): any", + "textSpan": { + "start": 9, + "length": 9 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "decorator", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "target", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 49 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 49 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 46, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsOnDefinition.baseline.jsonc b/tests/baselines/reference/findAllRefsOnDefinition.baseline.jsonc new file mode 100644 index 00000000000..a216c390598 --- /dev/null +++ b/tests/baselines/reference/findAllRefsOnDefinition.baseline.jsonc @@ -0,0 +1,350 @@ +// === /tests/cases/fourslash/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// /*FIND ALL REFS*/public [|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// public /*FIND ALL REFS*/[|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// public [|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second./*FIND ALL REFS*/[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsOnDefinition2.baseline.jsonc b/tests/baselines/reference/findAllRefsOnDefinition2.baseline.jsonc new file mode 100644 index 00000000000..8e34269d114 --- /dev/null +++ b/tests/baselines/reference/findAllRefsOnDefinition2.baseline.jsonc @@ -0,0 +1,239 @@ +// === /tests/cases/fourslash/findAllRefsOnDefinition2-import.ts === +// export module Test{ +// +// /*FIND ALL REFS*/export interface [|start|] { } +// +// export interface stop { } +// } + +// === /tests/cases/fourslash/findAllRefsOnDefinition2.ts === +// import Second = require("./findAllRefsOnDefinition2-import"); +// +// var start: Second.Test.[|start|]; +// var stop: Second.Test.stop; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2-import.ts", + "kind": "interface", + "name": "interface Test.start", + "textSpan": { + "start": 42, + "length": 5 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 25, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 42, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2-import.ts", + "contextSpan": { + "start": 25, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 86, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsOnDefinition2-import.ts === +// export module Test{ +// +// export interface /*FIND ALL REFS*/[|start|] { } +// +// export interface stop { } +// } + +// === /tests/cases/fourslash/findAllRefsOnDefinition2.ts === +// import Second = require("./findAllRefsOnDefinition2-import"); +// +// var start: Second.Test.[|start|]; +// var stop: Second.Test.stop; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2-import.ts", + "kind": "interface", + "name": "interface Test.start", + "textSpan": { + "start": 42, + "length": 5 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 25, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 42, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2-import.ts", + "contextSpan": { + "start": 25, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 86, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsOnDefinition2-import.ts === +// export module Test{ +// +// export interface [|start|] { } +// +// export interface stop { } +// } + +// === /tests/cases/fourslash/findAllRefsOnDefinition2.ts === +// import Second = require("./findAllRefsOnDefinition2-import"); +// +// var start: Second.Test./*FIND ALL REFS*/[|start|]; +// var stop: Second.Test.stop; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2-import.ts", + "kind": "interface", + "name": "interface Test.start", + "textSpan": { + "start": 42, + "length": 5 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 25, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 42, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2-import.ts", + "contextSpan": { + "start": 25, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 86, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsOnPrivateParameterProperty1.baseline.jsonc b/tests/baselines/reference/findAllRefsOnPrivateParameterProperty1.baseline.jsonc new file mode 100644 index 00000000000..e31b8e39d87 --- /dev/null +++ b/tests/baselines/reference/findAllRefsOnPrivateParameterProperty1.baseline.jsonc @@ -0,0 +1,287 @@ +// === /tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts === +// class ABCD { +// constructor(private x: number, public y: number, /*FIND ALL REFS*/private [|z|]: number) { +// } +// +// func() { +// return this.[|z|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "kind": "property", + "name": "(property) ABCD.z: number", + "textSpan": { + "start": 74, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ABCD", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "z", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 66, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 74, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "contextSpan": { + "start": 66, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 127, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts === +// class ABCD { +// constructor(private x: number, public y: number, private /*FIND ALL REFS*/[|z|]: number) { +// } +// +// func() { +// return this.[|z|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "kind": "property", + "name": "(property) ABCD.z: number", + "textSpan": { + "start": 74, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ABCD", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "z", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 66, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 74, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "contextSpan": { + "start": 66, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 127, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts === +// class ABCD { +// constructor(private x: number, public y: number, private [|z|]: number) { +// } +// +// func() { +// return this./*FIND ALL REFS*/[|z|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "kind": "property", + "name": "(property) ABCD.z: number", + "textSpan": { + "start": 74, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ABCD", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "z", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 66, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 74, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "contextSpan": { + "start": 66, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 127, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsPrimitiveJsDoc.baseline.jsonc b/tests/baselines/reference/findAllRefsPrimitiveJsDoc.baseline.jsonc new file mode 100644 index 00000000000..3d43035b168 --- /dev/null +++ b/tests/baselines/reference/findAllRefsPrimitiveJsDoc.baseline.jsonc @@ -0,0 +1,267 @@ +// === /tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts === +// /** +// * @param {/*FIND ALL REFS*/[|number|]} n +// * @returns {[|number|]} +// */ +// function f(n: [|number|]): [|number|] {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "kind": "keyword", + "name": "number", + "textSpan": { + "start": 15, + "length": 6 + }, + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 15, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 38, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 73, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts === +// /** +// * @param {[|number|]} n +// * @returns {/*FIND ALL REFS*/[|number|]} +// */ +// function f(n: [|number|]): [|number|] {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "kind": "keyword", + "name": "number", + "textSpan": { + "start": 15, + "length": 6 + }, + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 15, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 38, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 73, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts === +// /** +// * @param {[|number|]} n +// * @returns {[|number|]} +// */ +// function f(n: /*FIND ALL REFS*/[|number|]): [|number|] {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "kind": "keyword", + "name": "number", + "textSpan": { + "start": 15, + "length": 6 + }, + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 15, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 38, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 73, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts === +// /** +// * @param {[|number|]} n +// * @returns {[|number|]} +// */ +// function f(n: [|number|]): /*FIND ALL REFS*/[|number|] {} + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "kind": "keyword", + "name": "number", + "textSpan": { + "start": 15, + "length": 6 + }, + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 15, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 38, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 73, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsPrivateNameAccessors.baseline.jsonc b/tests/baselines/reference/findAllRefsPrivateNameAccessors.baseline.jsonc new file mode 100644 index 00000000000..13624979ea7 --- /dev/null +++ b/tests/baselines/reference/findAllRefsPrivateNameAccessors.baseline.jsonc @@ -0,0 +1,1209 @@ +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// /*FIND ALL REFS*/get [|#foo|](){ return 1; } +// set [|#foo|](value: number){ } +// constructor() { +// this.[|#foo|](); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) C.#foo: number", + "textSpan": { + "start": 18, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 14, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 46, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 42, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 103, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get /*FIND ALL REFS*/[|#foo|](){ return 1; } +// set [|#foo|](value: number){ } +// constructor() { +// this.[|#foo|](); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) C.#foo: number", + "textSpan": { + "start": 18, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 14, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 46, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 42, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 103, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get [|#foo|](){ return 1; } +// /*FIND ALL REFS*/set [|#foo|](value: number){ } +// constructor() { +// this.[|#foo|](); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) C.#foo: number", + "textSpan": { + "start": 18, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 14, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 46, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 42, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 103, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get [|#foo|](){ return 1; } +// set /*FIND ALL REFS*/[|#foo|](value: number){ } +// constructor() { +// this.[|#foo|](); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) C.#foo: number", + "textSpan": { + "start": 18, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 14, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 46, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 42, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 103, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get [|#foo|](){ return 1; } +// set [|#foo|](value: number){ } +// constructor() { +// this./*FIND ALL REFS*/[|#foo|](); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) C.#foo: number", + "textSpan": { + "start": 18, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 14, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 46, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 42, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 103, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// /*FIND ALL REFS*/get [|#foo|](){ return 1; } +// set [|#foo|](value: number){ } +// constructor() { +// this.[|#foo|](); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) E.#foo: number", + "textSpan": { + "start": 225, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 221, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 225, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 221, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 253, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 249, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 310, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get /*FIND ALL REFS*/[|#foo|](){ return 1; } +// set [|#foo|](value: number){ } +// constructor() { +// this.[|#foo|](); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) E.#foo: number", + "textSpan": { + "start": 225, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 221, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 225, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 221, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 253, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 249, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 310, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get [|#foo|](){ return 1; } +// /*FIND ALL REFS*/set [|#foo|](value: number){ } +// constructor() { +// this.[|#foo|](); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) E.#foo: number", + "textSpan": { + "start": 225, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 221, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 225, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 221, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 253, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 249, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 310, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get [|#foo|](){ return 1; } +// set /*FIND ALL REFS*/[|#foo|](value: number){ } +// constructor() { +// this.[|#foo|](); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) E.#foo: number", + "textSpan": { + "start": 225, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 221, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 225, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 221, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 253, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 249, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 310, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts === +// class C { +// get #foo(){ return 1; } +// set #foo(value: number){ } +// constructor() { +// this.#foo(); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// get [|#foo|](){ return 1; } +// set [|#foo|](value: number){ } +// constructor() { +// this./*FIND ALL REFS*/[|#foo|](); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "kind": "property", + "name": "(property) E.#foo: number", + "textSpan": { + "start": 225, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 221, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 225, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 221, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 253, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "contextSpan": { + "start": 249, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 310, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsPrivateNameMethods.baseline.jsonc b/tests/baselines/reference/findAllRefsPrivateNameMethods.baseline.jsonc new file mode 100644 index 00000000000..a7ad4b7d4b9 --- /dev/null +++ b/tests/baselines/reference/findAllRefsPrivateNameMethods.baseline.jsonc @@ -0,0 +1,455 @@ +// === /tests/cases/fourslash/findAllRefsPrivateNameMethods.ts === +// class C { +// /*FIND ALL REFS*/[|#foo|](){ } +// constructor() { +// this.[|#foo|](); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// #foo(){ } +// constructor() { +// this.#foo(); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "kind": "method", + "name": "(method) C.#foo(): void", + "textSpan": { + "start": 14, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "contextSpan": { + "start": 14, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 57, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameMethods.ts === +// class C { +// [|#foo|](){ } +// constructor() { +// this./*FIND ALL REFS*/[|#foo|](); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// #foo(){ } +// constructor() { +// this.#foo(); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "kind": "method", + "name": "(method) C.#foo(): void", + "textSpan": { + "start": 14, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "contextSpan": { + "start": 14, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 57, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameMethods.ts === +// class C { +// #foo(){ } +// constructor() { +// this.#foo(); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// /*FIND ALL REFS*/[|#foo|](){ } +// constructor() { +// this.[|#foo|](); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "kind": "method", + "name": "(method) E.#foo(): void", + "textSpan": { + "start": 175, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 175, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 175, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "contextSpan": { + "start": 175, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 218, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameMethods.ts === +// class C { +// #foo(){ } +// constructor() { +// this.#foo(); +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// [|#foo|](){ } +// constructor() { +// this./*FIND ALL REFS*/[|#foo|](); +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "kind": "method", + "name": "(method) E.#foo(): void", + "textSpan": { + "start": 175, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 175, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 175, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "contextSpan": { + "start": 175, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 218, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsPrivateNameProperties.baseline.jsonc b/tests/baselines/reference/findAllRefsPrivateNameProperties.baseline.jsonc new file mode 100644 index 00000000000..4c9251932de --- /dev/null +++ b/tests/baselines/reference/findAllRefsPrivateNameProperties.baseline.jsonc @@ -0,0 +1,561 @@ +// === /tests/cases/fourslash/findAllRefsPrivateNameProperties.ts === +// class C { +// /*FIND ALL REFS*/[|#foo|] = 10; +// constructor() { +// this.[|#foo|] = 20; +// [|#foo|] in this; +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// #foo: number; +// constructor() { +// this.#foo = 20; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "kind": "property", + "name": "(property) C.#foo: number", + "textSpan": { + "start": 14, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "contextSpan": { + "start": 14, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 58, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 77, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameProperties.ts === +// class C { +// [|#foo|] = 10; +// constructor() { +// this./*FIND ALL REFS*/[|#foo|] = 20; +// [|#foo|] in this; +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// #foo: number; +// constructor() { +// this.#foo = 20; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "kind": "property", + "name": "(property) C.#foo: number", + "textSpan": { + "start": 14, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "contextSpan": { + "start": 14, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 58, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 77, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameProperties.ts === +// class C { +// [|#foo|] = 10; +// constructor() { +// this.[|#foo|] = 20; +// /*FIND ALL REFS*/[|#foo|] in this; +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// #foo: number; +// constructor() { +// this.#foo = 20; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "kind": "property", + "name": "(property) C.#foo: number", + "textSpan": { + "start": 14, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 14, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 14, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "contextSpan": { + "start": 14, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 58, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 77, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameProperties.ts === +// class C { +// #foo = 10; +// constructor() { +// this.#foo = 20; +// #foo in this; +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// /*FIND ALL REFS*/[|#foo|]: number; +// constructor() { +// this.[|#foo|] = 20; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "kind": "property", + "name": "(property) E.#foo: number", + "textSpan": { + "start": 201, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 201, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 201, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "contextSpan": { + "start": 201, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 248, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsPrivateNameProperties.ts === +// class C { +// #foo = 10; +// constructor() { +// this.#foo = 20; +// #foo in this; +// } +// } +// class D extends C { +// constructor() { +// super() +// this.#foo = 20; +// } +// } +// class E { +// [|#foo|]: number; +// constructor() { +// this./*FIND ALL REFS*/[|#foo|] = 20; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "kind": "property", + "name": "(property) E.#foo: number", + "textSpan": { + "start": 201, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "#foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 201, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 201, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "contextSpan": { + "start": 201, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 248, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsReExport_broken.baseline.jsonc b/tests/baselines/reference/findAllRefsReExport_broken.baseline.jsonc new file mode 100644 index 00000000000..a1668cbd1b6 --- /dev/null +++ b/tests/baselines/reference/findAllRefsReExport_broken.baseline.jsonc @@ -0,0 +1,103 @@ +// === /a.ts === +// /*FIND ALL REFS*/export { [|x|] }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "alias", + "name": "export x", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /a.ts === +// export { /*FIND ALL REFS*/[|x|] }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "alias", + "name": "export x", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsReExport_broken2.baseline.jsonc b/tests/baselines/reference/findAllRefsReExport_broken2.baseline.jsonc new file mode 100644 index 00000000000..72d9d523c8f --- /dev/null +++ b/tests/baselines/reference/findAllRefsReExport_broken2.baseline.jsonc @@ -0,0 +1,103 @@ +// === /a.ts === +// /*FIND ALL REFS*/export { [|x|] } from "nonsense"; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "alias", + "name": "export x", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /a.ts === +// export { /*FIND ALL REFS*/[|x|] } from "nonsense"; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "alias", + "name": "export x", + "textSpan": { + "start": 9, + "length": 1 + }, + "displayParts": [ + { + "text": "export", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsThisKeyword.baseline.jsonc b/tests/baselines/reference/findAllRefsThisKeyword.baseline.jsonc new file mode 100644 index 00000000000..772cf2b07e7 --- /dev/null +++ b/tests/baselines/reference/findAllRefsThisKeyword.baseline.jsonc @@ -0,0 +1,984 @@ +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// /*FIND ALL REFS*/[|this|]; +// function f(this) { +// return this; +// function g(this) { return this; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 0, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(/*FIND ALL REFS*/[|this|]) { +// return [|this|]; +// function g(this) { return this; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 17, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 17, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 36, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f([|this|]) { +// return /*FIND ALL REFS*/[|this|]; +// function g(this) { return this; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 17, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 17, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 36, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(this) { +// return this; +// function g(/*FIND ALL REFS*/[|this|]) { return [|this|]; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 57, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 57, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 72, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(this) { +// return this; +// function g([|this|]) { return /*FIND ALL REFS*/[|this|]; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 57, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 57, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 72, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(this) { +// return this; +// function g(this) { return this; } +// } +// class C { +// static x() { +// /*FIND ALL REFS*/[|this|]; +// } +// static y() { +// () => [|this|]; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 117, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 117, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 160, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(this) { +// return this; +// function g(this) { return this; } +// } +// class C { +// static x() { +// [|this|]; +// } +// static y() { +// () => /*FIND ALL REFS*/[|this|]; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 160, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 117, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 160, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(this) { +// return this; +// function g(this) { return this; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// /*FIND ALL REFS*/[|this|]; +// } +// method() { +// () => [|this|]; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 200, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 200, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 241, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(this) { +// return this; +// function g(this) { return this; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// [|this|]; +// } +// method() { +// () => /*FIND ALL REFS*/[|this|]; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { this: 0 } +// x.this; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 241, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 200, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 241, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(this) { +// return this; +// function g(this) { return this; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { /*FIND ALL REFS*/[|this|]: 0 } +// x.[|this|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "property", + "name": "(property) this: number", + "textSpan": { + "start": 341, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 341, + "length": 7 + } + }, + "references": [ + { + "textSpan": { + "start": 341, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "contextSpan": { + "start": 341, + "length": 7 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 353, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsThisKeyword.ts === +// this; +// function f(this) { +// return this; +// function g(this) { return this; } +// } +// class C { +// static x() { +// this; +// } +// static y() { +// () => this; +// } +// constructor() { +// this; +// } +// method() { +// () => this; +// } +// } +// // These are *not* real uses of the 'this' keyword, they are identifiers. +// const x = { [|this|]: 0 } +// x./*FIND ALL REFS*/[|this|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "kind": "property", + "name": "(property) this: number", + "textSpan": { + "start": 341, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 341, + "length": 7 + } + }, + "references": [ + { + "textSpan": { + "start": 341, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "contextSpan": { + "start": 341, + "length": 7 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 353, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsThisKeyword.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsThisKeywordMultipleFiles.baseline.jsonc b/tests/baselines/reference/findAllRefsThisKeywordMultipleFiles.baseline.jsonc new file mode 100644 index 00000000000..aa24152b580 --- /dev/null +++ b/tests/baselines/reference/findAllRefsThisKeywordMultipleFiles.baseline.jsonc @@ -0,0 +1,1023 @@ +// === /tests/cases/fourslash/file1.ts === +// /*FIND ALL REFS*/[|this|]; [|this|]; + +// === /tests/cases/fourslash/file2.ts === +// [|this|]; +// [|this|]; + +// === /tests/cases/fourslash/file3.ts === +// ((x = [|this|], y) => [|this|])([|this|], [|this|]); +// // different 'this' +// function f(this) { return this; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file3.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 6, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 24, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// [|this|]; /*FIND ALL REFS*/[|this|]; + +// === /tests/cases/fourslash/file2.ts === +// [|this|]; +// [|this|]; + +// === /tests/cases/fourslash/file3.ts === +// ((x = [|this|], y) => [|this|])([|this|], [|this|]); +// // different 'this' +// function f(this) { return this; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file3.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 6, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 24, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// [|this|]; [|this|]; + +// === /tests/cases/fourslash/file2.ts === +// /*FIND ALL REFS*/[|this|]; +// [|this|]; + +// === /tests/cases/fourslash/file3.ts === +// ((x = [|this|], y) => [|this|])([|this|], [|this|]); +// // different 'this' +// function f(this) { return this; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file3.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 6, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 24, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// [|this|]; [|this|]; + +// === /tests/cases/fourslash/file2.ts === +// [|this|]; +// /*FIND ALL REFS*/[|this|]; + +// === /tests/cases/fourslash/file3.ts === +// ((x = [|this|], y) => [|this|])([|this|], [|this|]); +// // different 'this' +// function f(this) { return this; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file3.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 6, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 24, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// [|this|]; [|this|]; + +// === /tests/cases/fourslash/file2.ts === +// [|this|]; +// [|this|]; + +// === /tests/cases/fourslash/file3.ts === +// ((x = /*FIND ALL REFS*/[|this|], y) => [|this|])([|this|], [|this|]); +// // different 'this' +// function f(this) { return this; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file3.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 6, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 24, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// [|this|]; [|this|]; + +// === /tests/cases/fourslash/file2.ts === +// [|this|]; +// [|this|]; + +// === /tests/cases/fourslash/file3.ts === +// ((x = [|this|], y) => /*FIND ALL REFS*/[|this|])([|this|], [|this|]); +// // different 'this' +// function f(this) { return this; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file3.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 6, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 24, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// [|this|]; [|this|]; + +// === /tests/cases/fourslash/file2.ts === +// [|this|]; +// [|this|]; + +// === /tests/cases/fourslash/file3.ts === +// ((x = [|this|], y) => [|this|])(/*FIND ALL REFS*/[|this|], [|this|]); +// // different 'this' +// function f(this) { return this; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file3.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 6, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 24, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file1.ts === +// [|this|]; [|this|]; + +// === /tests/cases/fourslash/file2.ts === +// [|this|]; +// [|this|]; + +// === /tests/cases/fourslash/file3.ts === +// ((x = [|this|], y) => [|this|])([|this|], /*FIND ALL REFS*/[|this|]); +// // different 'this' +// function f(this) { return this; } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file3.ts", + "kind": "var", + "name": "this", + "textSpan": { + "start": 6, + "length": 4 + }, + "displayParts": [ + { + "text": "this", + "kind": "keyword" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalThis", + "kind": "moduleName" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 0, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 6, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 18, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 24, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/file3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsTypeParameterInMergedInterface.baseline.jsonc b/tests/baselines/reference/findAllRefsTypeParameterInMergedInterface.baseline.jsonc new file mode 100644 index 00000000000..1e44b09f8b9 --- /dev/null +++ b/tests/baselines/reference/findAllRefsTypeParameterInMergedInterface.baseline.jsonc @@ -0,0 +1,431 @@ +// === /tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts === +// interface I { a: [|T|] } +// interface I<[|T|]> { b: [|T|] } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "kind": "type parameter", + "name": "(type parameter) T in I", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts === +// interface I<[|T|]> { a: /*FIND ALL REFS*/[|T|] } +// interface I<[|T|]> { b: [|T|] } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "kind": "type parameter", + "name": "(type parameter) T in I", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts === +// interface I<[|T|]> { a: [|T|] } +// interface I { b: [|T|] } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "kind": "type parameter", + "name": "(type parameter) T in I", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts === +// interface I<[|T|]> { a: [|T|] } +// interface I<[|T|]> { b: /*FIND ALL REFS*/[|T|] } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "kind": "type parameter", + "name": "(type parameter) T in I", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "type parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "in", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 44, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsTypedef.baseline.jsonc b/tests/baselines/reference/findAllRefsTypedef.baseline.jsonc new file mode 100644 index 00000000000..da4a2eb8d74 --- /dev/null +++ b/tests/baselines/reference/findAllRefsTypedef.baseline.jsonc @@ -0,0 +1,177 @@ +undefined + +// === /a.js === +// /** +// * @typedef I {Object} +// * @prop /*FIND ALL REFS*/[|p|] {number} +// */ +// +// /** @type {I} */ +// let x; +// x.[|p|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "property", + "name": "(property) p: number", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "p", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 30, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 30, + "length": 18 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 78, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** +// * @typedef I {Object} +// * @prop [|p|] {number} +// */ +// +// /** @type {I} */ +// let x; +// x./*FIND ALL REFS*/[|p|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "property", + "name": "(property) p: number", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "p", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 30, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 30, + "length": 18 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 78, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsTypedef_importType.baseline.jsonc b/tests/baselines/reference/findAllRefsTypedef_importType.baseline.jsonc new file mode 100644 index 00000000000..f3e48c3079c --- /dev/null +++ b/tests/baselines/reference/findAllRefsTypedef_importType.baseline.jsonc @@ -0,0 +1,167 @@ +undefined + +// === /b.js === +// /** @type {import('./a').[|Foo|]} */ +// const x = 0; + +// === /a.js === +// module.exports = 0; +// /** @typedef {number} /*FIND ALL REFS*/[|Foo|] */ +// const dummy = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type", + "name": "type Foo = number", + "textSpan": { + "start": 42, + "length": 3 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 24, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 42, + "length": 3 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 24, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 25, + "length": 3 + }, + "fileName": "/b.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.js === +// /** @type {import('./a')./*FIND ALL REFS*/[|Foo|]} */ +// const x = 0; + +// === /a.js === +// module.exports = 0; +// /** @typedef {number} [|Foo|] */ +// const dummy = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "type", + "name": "type Foo = number", + "textSpan": { + "start": 42, + "length": 3 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 24, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 42, + "length": 3 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 24, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 25, + "length": 3 + }, + "fileName": "/b.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsTypeofImport.baseline.jsonc b/tests/baselines/reference/findAllRefsTypeofImport.baseline.jsonc new file mode 100644 index 00000000000..19d2d7d377e --- /dev/null +++ b/tests/baselines/reference/findAllRefsTypeofImport.baseline.jsonc @@ -0,0 +1,151 @@ +undefined + +// === /a.ts === +// export const /*FIND ALL REFS*/[|x|] = 0; +// declare const a: typeof import("./a"); +// a.[|x|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "const", + "name": "const x: 0", + "textSpan": { + "start": 13, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 61, + "length": 1 + }, + "fileName": "/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export const [|x|] = 0; +// declare const a: typeof import("./a"); +// a./*FIND ALL REFS*/[|x|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "const", + "name": "const x: 0", + "textSpan": { + "start": 13, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 61, + "length": 1 + }, + "fileName": "/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc new file mode 100644 index 00000000000..97213088fea --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames1.baseline.jsonc @@ -0,0 +1,305 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts === +// class Foo { +// /*FIND ALL REFS*/public [|_bar|]() { return 0; } +// } +// +// var x: Foo; +// x.[|_bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "kind": "method", + "name": "(method) Foo._bar(): number", + "textSpan": { + "start": 23, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "_bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 27 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "contextSpan": { + "start": 16, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 61, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts === +// class Foo { +// public /*FIND ALL REFS*/[|_bar|]() { return 0; } +// } +// +// var x: Foo; +// x.[|_bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "kind": "method", + "name": "(method) Foo._bar(): number", + "textSpan": { + "start": 23, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "_bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 27 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "contextSpan": { + "start": 16, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 61, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts === +// class Foo { +// public [|_bar|]() { return 0; } +// } +// +// var x: Foo; +// x./*FIND ALL REFS*/[|_bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "kind": "method", + "name": "(method) Foo._bar(): number", + "textSpan": { + "start": 23, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "_bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 27 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "contextSpan": { + "start": 16, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 61, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc new file mode 100644 index 00000000000..3d3d8850613 --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames2.baseline.jsonc @@ -0,0 +1,305 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts === +// class Foo { +// /*FIND ALL REFS*/public [|__bar|]() { return 0; } +// } +// +// var x: Foo; +// x.[|__bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "kind": "method", + "name": "(method) Foo.__bar(): number", + "textSpan": { + "start": 23, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "__bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 28 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "contextSpan": { + "start": 16, + "length": 28 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 62, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts === +// class Foo { +// public /*FIND ALL REFS*/[|__bar|]() { return 0; } +// } +// +// var x: Foo; +// x.[|__bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "kind": "method", + "name": "(method) Foo.__bar(): number", + "textSpan": { + "start": 23, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "__bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 28 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "contextSpan": { + "start": 16, + "length": 28 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 62, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts === +// class Foo { +// public [|__bar|]() { return 0; } +// } +// +// var x: Foo; +// x./*FIND ALL REFS*/[|__bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "kind": "method", + "name": "(method) Foo.__bar(): number", + "textSpan": { + "start": 23, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "__bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 28 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "contextSpan": { + "start": 16, + "length": 28 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 62, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc new file mode 100644 index 00000000000..e05a34f33da --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames3.baseline.jsonc @@ -0,0 +1,305 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts === +// class Foo { +// /*FIND ALL REFS*/public [|___bar|]() { return 0; } +// } +// +// var x: Foo; +// x.[|___bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "kind": "method", + "name": "(method) Foo.___bar(): number", + "textSpan": { + "start": 23, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "___bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "contextSpan": { + "start": 16, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 63, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts === +// class Foo { +// public /*FIND ALL REFS*/[|___bar|]() { return 0; } +// } +// +// var x: Foo; +// x.[|___bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "kind": "method", + "name": "(method) Foo.___bar(): number", + "textSpan": { + "start": 23, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "___bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "contextSpan": { + "start": 16, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 63, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts === +// class Foo { +// public [|___bar|]() { return 0; } +// } +// +// var x: Foo; +// x./*FIND ALL REFS*/[|___bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "kind": "method", + "name": "(method) Foo.___bar(): number", + "textSpan": { + "start": 23, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "___bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "contextSpan": { + "start": 16, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 63, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc new file mode 100644 index 00000000000..da6d1f83df6 --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames4.baseline.jsonc @@ -0,0 +1,305 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts === +// class Foo { +// /*FIND ALL REFS*/public [|____bar|]() { return 0; } +// } +// +// var x: Foo; +// x.[|____bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "kind": "method", + "name": "(method) Foo.____bar(): number", + "textSpan": { + "start": 23, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "____bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "contextSpan": { + "start": 16, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 64, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts === +// class Foo { +// public /*FIND ALL REFS*/[|____bar|]() { return 0; } +// } +// +// var x: Foo; +// x.[|____bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "kind": "method", + "name": "(method) Foo.____bar(): number", + "textSpan": { + "start": 23, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "____bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "contextSpan": { + "start": 16, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 64, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts === +// class Foo { +// public [|____bar|]() { return 0; } +// } +// +// var x: Foo; +// x./*FIND ALL REFS*/[|____bar|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "kind": "method", + "name": "(method) Foo.____bar(): number", + "textSpan": { + "start": 23, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "____bar", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "contextSpan": { + "start": 16, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 64, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc new file mode 100644 index 00000000000..5cc691e5044 --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames5.baseline.jsonc @@ -0,0 +1,299 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts === +// class Foo { +// public _bar; +// public __bar; +// /*FIND ALL REFS*/public [|___bar|]; +// public ____bar; +// } +// +// var x: Foo; +// x._bar; +// x.__bar; +// x.[|___bar|]; +// x.____bar; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "kind": "property", + "name": "(property) Foo.___bar: any", + "textSpan": { + "start": 58, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "___bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "contextSpan": { + "start": 51, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts === +// class Foo { +// public _bar; +// public __bar; +// public /*FIND ALL REFS*/[|___bar|]; +// public ____bar; +// } +// +// var x: Foo; +// x._bar; +// x.__bar; +// x.[|___bar|]; +// x.____bar; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "kind": "property", + "name": "(property) Foo.___bar: any", + "textSpan": { + "start": 58, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "___bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "contextSpan": { + "start": 51, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts === +// class Foo { +// public _bar; +// public __bar; +// public [|___bar|]; +// public ____bar; +// } +// +// var x: Foo; +// x._bar; +// x.__bar; +// x./*FIND ALL REFS*/[|___bar|]; +// x.____bar; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "kind": "property", + "name": "(property) Foo.___bar: any", + "textSpan": { + "start": 58, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "___bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "contextSpan": { + "start": 51, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc new file mode 100644 index 00000000000..c9b1854b710 --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames6.baseline.jsonc @@ -0,0 +1,299 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts === +// class Foo { +// public _bar; +// /*FIND ALL REFS*/public [|__bar|]; +// public ___bar; +// public ____bar; +// } +// +// var x: Foo; +// x._bar; +// x.[|__bar|]; +// x.___bar; +// x.____bar; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "kind": "property", + "name": "(property) Foo.__bar: any", + "textSpan": { + "start": 40, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "__bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 40, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "contextSpan": { + "start": 33, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 111, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts === +// class Foo { +// public _bar; +// public /*FIND ALL REFS*/[|__bar|]; +// public ___bar; +// public ____bar; +// } +// +// var x: Foo; +// x._bar; +// x.[|__bar|]; +// x.___bar; +// x.____bar; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "kind": "property", + "name": "(property) Foo.__bar: any", + "textSpan": { + "start": 40, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "__bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 40, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "contextSpan": { + "start": 33, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 111, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts === +// class Foo { +// public _bar; +// public [|__bar|]; +// public ___bar; +// public ____bar; +// } +// +// var x: Foo; +// x._bar; +// x./*FIND ALL REFS*/[|__bar|]; +// x.___bar; +// x.____bar; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "kind": "property", + "name": "(property) Foo.__bar: any", + "textSpan": { + "start": 40, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "__bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 40, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "contextSpan": { + "start": 33, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 111, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc new file mode 100644 index 00000000000..0ab9596bf62 --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames7.baseline.jsonc @@ -0,0 +1,248 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts === +// /*FIND ALL REFS*/function [|__foo|]() { +// [|__foo|](); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "kind": "function", + "name": "function __foo(): void", + "textSpan": { + "start": 9, + "length": 5 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "__foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 33 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "contextSpan": { + "start": 0, + "length": 33 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts === +// function /*FIND ALL REFS*/[|__foo|]() { +// [|__foo|](); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "kind": "function", + "name": "function __foo(): void", + "textSpan": { + "start": 9, + "length": 5 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "__foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 33 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "contextSpan": { + "start": 0, + "length": 33 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts === +// function [|__foo|]() { +// /*FIND ALL REFS*/[|__foo|](); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "kind": "function", + "name": "function __foo(): void", + "textSpan": { + "start": 9, + "length": 5 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "__foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 33 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "contextSpan": { + "start": 0, + "length": 33 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames8.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames8.baseline.jsonc new file mode 100644 index 00000000000..ad42a0a9126 --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames8.baseline.jsonc @@ -0,0 +1,272 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts === +// (/*FIND ALL REFS*/function [|__foo|]() { +// [|__foo|](); +// }) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "kind": "local function", + "name": "(local function) __foo(): void", + "textSpan": { + "start": 10, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "__foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1, + "length": 33 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "contextSpan": { + "start": 1, + "length": 33 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 24, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts === +// (function /*FIND ALL REFS*/[|__foo|]() { +// [|__foo|](); +// }) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "kind": "local function", + "name": "(local function) __foo(): void", + "textSpan": { + "start": 10, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "__foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1, + "length": 33 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "contextSpan": { + "start": 1, + "length": 33 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 24, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts === +// (function [|__foo|]() { +// /*FIND ALL REFS*/[|__foo|](); +// }) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "kind": "local function", + "name": "(local function) __foo(): void", + "textSpan": { + "start": 10, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "__foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1, + "length": 33 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "contextSpan": { + "start": 1, + "length": 33 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 24, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames9.baseline.jsonc b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames9.baseline.jsonc new file mode 100644 index 00000000000..4c324d24e2b --- /dev/null +++ b/tests/baselines/reference/findAllRefsWithLeadingUnderscoreNames9.baseline.jsonc @@ -0,0 +1,272 @@ +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts === +// (/*FIND ALL REFS*/function [|___foo|]() { +// [|___foo|](); +// }) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "kind": "local function", + "name": "(local function) ___foo(): void", + "textSpan": { + "start": 10, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "___foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1, + "length": 35 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "contextSpan": { + "start": 1, + "length": 35 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 25, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts === +// (function /*FIND ALL REFS*/[|___foo|]() { +// [|___foo|](); +// }) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "kind": "local function", + "name": "(local function) ___foo(): void", + "textSpan": { + "start": 10, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "___foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1, + "length": 35 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "contextSpan": { + "start": 1, + "length": 35 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 25, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts === +// (function [|___foo|]() { +// /*FIND ALL REFS*/[|___foo|](); +// }) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "kind": "local function", + "name": "(local function) ___foo(): void", + "textSpan": { + "start": 10, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local function", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "___foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1, + "length": 35 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "contextSpan": { + "start": 1, + "length": 35 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 25, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefs_importType_meaningAtLocation.baseline.jsonc b/tests/baselines/reference/findAllRefs_importType_meaningAtLocation.baseline.jsonc new file mode 100644 index 00000000000..12a2d5644d1 --- /dev/null +++ b/tests/baselines/reference/findAllRefs_importType_meaningAtLocation.baseline.jsonc @@ -0,0 +1,403 @@ +// === /a.ts === +// /*FIND ALL REFS*/export type [|T|] = 0; +// export const T = 0; + +// === /b.ts === +// const x: import("./a").[|T|] = 0; +// const x: typeof import("./a").T = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "const", + "name": "type T = 0", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 18 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export type /*FIND ALL REFS*/[|T|] = 0; +// export const T = 0; + +// === /b.ts === +// const x: import("./a").[|T|] = 0; +// const x: typeof import("./a").T = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "const", + "name": "type T = 0", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 18 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /a.ts === +// export type T = 0; +// export const /*FIND ALL REFS*/[|T|] = 0; + +// === /b.ts === +// const x: import("./a").T = 0; +// const x: typeof import("./a").[|T|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "const", + "name": "const T: 0", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 32, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 19, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 60, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export type [|T|] = 0; +// export const T = 0; + +// === /b.ts === +// const x: import("./a")./*FIND ALL REFS*/[|T|] = 0; +// const x: typeof import("./a").T = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "const", + "name": "type T = 0", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 18 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export type T = 0; +// export const [|T|] = 0; + +// === /b.ts === +// const x: import("./a").T = 0; +// const x: typeof import("./a")./*FIND ALL REFS*/[|T|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "const", + "name": "const T: 0", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "0", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 32, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 19, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 60, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefs_importType_named.baseline.jsonc b/tests/baselines/reference/findAllRefs_importType_named.baseline.jsonc new file mode 100644 index 00000000000..8a54c3497dc --- /dev/null +++ b/tests/baselines/reference/findAllRefs_importType_named.baseline.jsonc @@ -0,0 +1,491 @@ +// === /a.ts === +// /*FIND ALL REFS*/export type [|T|] = number; +// export type U = string; + +// === /b.ts === +// const x: import("./a").[|T|] = 0; +// const x: import("./a").U = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export type /*FIND ALL REFS*/[|T|] = number; +// export type U = string; + +// === /b.ts === +// const x: import("./a").[|T|] = 0; +// const x: import("./a").U = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export type T = number; +// /*FIND ALL REFS*/export type [|U|] = string; + +// === /b.ts === +// const x: import("./a").T = 0; +// const x: import("./a").[|U|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "type", + "name": "type U = string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 24, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 24, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 53, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export type T = number; +// export type /*FIND ALL REFS*/[|U|] = string; + +// === /b.ts === +// const x: import("./a").T = 0; +// const x: import("./a").[|U|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "type", + "name": "type U = string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 24, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 24, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 53, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export type [|T|] = number; +// export type U = string; + +// === /b.ts === +// const x: import("./a")./*FIND ALL REFS*/[|T|] = 0; +// const x: import("./a").U = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 12, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 0, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.ts === +// export type T = number; +// export type [|U|] = string; + +// === /b.ts === +// const x: import("./a").T = 0; +// const x: import("./a")./*FIND ALL REFS*/[|U|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "type", + "name": "type U = string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "U", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 24, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/a.ts", + "contextSpan": { + "start": 24, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 53, + "length": 1 + }, + "fileName": "/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefs_importType_typeofImport.baseline.jsonc b/tests/baselines/reference/findAllRefs_importType_typeofImport.baseline.jsonc new file mode 100644 index 00000000000..996b3692507 --- /dev/null +++ b/tests/baselines/reference/findAllRefs_importType_typeofImport.baseline.jsonc @@ -0,0 +1,293 @@ +// === /b.ts === +// /*FIND ALL REFS*/const [|x|]: typeof import("./a") = { x: 0 }; +// const y: typeof import("./a") = { x: 0 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/b.ts", + "kind": "const", + "name": "const x: typeof import(\"/a\")", + "textSpan": { + "start": 6, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"/a\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 0, + "length": 41 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 1 + }, + "fileName": "/b.ts", + "contextSpan": { + "start": 0, + "length": 41 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /b.ts === +// const x: typeof import("/*FIND ALL REFS*/[|./a|]") = { x: 0 }; +// const y: typeof import("[|./a|]") = { x: 0 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "module", + "name": "module \"/a\"", + "textSpan": { + "start": 0, + "length": 19 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"/a\"", + "kind": "stringLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 3 + }, + "fileName": "/b.ts", + "contextSpan": { + "start": 0, + "length": 41 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 66, + "length": 3 + }, + "fileName": "/b.ts", + "contextSpan": { + "start": 42, + "length": 41 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /b.ts === +// const x: typeof import("./a") = { x: 0 }; +// /*FIND ALL REFS*/const [|y|]: typeof import("./a") = { x: 0 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/b.ts", + "kind": "const", + "name": "const y: typeof import(\"/a\")", + "textSpan": { + "start": 48, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "y", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"/a\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 42, + "length": 41 + } + }, + "references": [ + { + "textSpan": { + "start": 48, + "length": 1 + }, + "fileName": "/b.ts", + "contextSpan": { + "start": 42, + "length": 41 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /b.ts === +// const x: typeof import("[|./a|]") = { x: 0 }; +// const y: typeof import("/*FIND ALL REFS*/[|./a|]") = { x: 0 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.ts", + "kind": "module", + "name": "module \"/a\"", + "textSpan": { + "start": 0, + "length": 19 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"/a\"", + "kind": "stringLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 3 + }, + "fileName": "/b.ts", + "contextSpan": { + "start": 0, + "length": 41 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 66, + "length": 3 + }, + "fileName": "/b.ts", + "contextSpan": { + "start": 42, + "length": 41 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefs_jsEnum.baseline.jsonc b/tests/baselines/reference/findAllRefs_jsEnum.baseline.jsonc new file mode 100644 index 00000000000..f57201e3940 --- /dev/null +++ b/tests/baselines/reference/findAllRefs_jsEnum.baseline.jsonc @@ -0,0 +1,814 @@ +// === /a.js === +// /** @enum {string} */ +// /*FIND ALL REFS*/const [|E|] = { A: "" }; +// [|E|]["A"]; +// /** @type {[|E|]} */ +// const e = [|E|].A; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "const", + "name": "type E = string\nconst E: {\n A: string;\n}", + "textSpan": { + "start": 28, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 22, + "length": 20 + } + }, + "references": [ + { + "textSpan": { + "start": 28, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 22, + "length": 20 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 43, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 62, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 78, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** @enum {string} */ +// const /*FIND ALL REFS*/[|E|] = { A: "" }; +// [|E|]["A"]; +// /** @type {[|E|]} */ +// const e = [|E|].A; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "const", + "name": "type E = string\nconst E: {\n A: string;\n}", + "textSpan": { + "start": 28, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 22, + "length": 20 + } + }, + "references": [ + { + "textSpan": { + "start": 28, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 22, + "length": 20 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 43, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 62, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 78, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** @enum {string} */ +// const [|E|] = { A: "" }; +// /*FIND ALL REFS*/[|E|]["A"]; +// /** @type {[|E|]} */ +// const e = [|E|].A; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "const", + "name": "type E = string\nconst E: {\n A: string;\n}", + "textSpan": { + "start": 28, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 22, + "length": 20 + } + }, + "references": [ + { + "textSpan": { + "start": 28, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 22, + "length": 20 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 43, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 62, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 78, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** @enum {string} */ +// const [|E|] = { A: "" }; +// [|E|]["A"]; +// /** @type {/*FIND ALL REFS*/[|E|]} */ +// const e = [|E|].A; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "const", + "name": "type E = string\nconst E: {\n A: string;\n}", + "textSpan": { + "start": 28, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 22, + "length": 20 + } + }, + "references": [ + { + "textSpan": { + "start": 28, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 22, + "length": 20 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 43, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 62, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 78, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.js === +// /** @enum {string} */ +// const [|E|] = { A: "" }; +// [|E|]["A"]; +// /** @type {[|E|]} */ +// const e = /*FIND ALL REFS*/[|E|].A; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.js", + "kind": "const", + "name": "type E = string\nconst E: {\n A: string;\n}", + "textSpan": { + "start": 28, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 22, + "length": 20 + } + }, + "references": [ + { + "textSpan": { + "start": 28, + "length": 1 + }, + "fileName": "/a.js", + "contextSpan": { + "start": 22, + "length": 20 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 43, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 62, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 78, + "length": 1 + }, + "fileName": "/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findReferencesAcrossMultipleProjects.baseline.jsonc b/tests/baselines/reference/findReferencesAcrossMultipleProjects.baseline.jsonc new file mode 100644 index 00000000000..796790c1863 --- /dev/null +++ b/tests/baselines/reference/findReferencesAcrossMultipleProjects.baseline.jsonc @@ -0,0 +1,359 @@ +// === /tests/cases/fourslash/a.ts === +// /*FIND ALL REFS*/var [|x|]: number; + +// === /tests/cases/fourslash/b.ts === +// /// +// [|x|]++; + +// === /tests/cases/fourslash/c.ts === +// /// +// [|x|]++; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/c.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// var /*FIND ALL REFS*/[|x|]: number; + +// === /tests/cases/fourslash/b.ts === +// /// +// [|x|]++; + +// === /tests/cases/fourslash/c.ts === +// /// +// [|x|]++; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/c.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// var [|x|]: number; + +// === /tests/cases/fourslash/b.ts === +// /// +// /*FIND ALL REFS*/[|x|]++; + +// === /tests/cases/fourslash/c.ts === +// /// +// [|x|]++; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/c.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// var [|x|]: number; + +// === /tests/cases/fourslash/b.ts === +// /// +// [|x|]++; + +// === /tests/cases/fourslash/c.ts === +// /// +// /*FIND ALL REFS*/[|x|]++; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 30, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/c.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findReferencesJSXTagName2.baseline.jsonc b/tests/baselines/reference/findReferencesJSXTagName2.baseline.jsonc new file mode 100644 index 00000000000..bf537696b87 --- /dev/null +++ b/tests/baselines/reference/findReferencesJSXTagName2.baseline.jsonc @@ -0,0 +1,389 @@ +// === /tests/cases/fourslash/index.tsx === +// /*FIND ALL REFS*/const [|obj|] = {Component: () =>
}; +// const element = <[|obj|].Component/>; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/index.tsx", + "kind": "const", + "name": "const obj: {\n Component: () => any;\n}", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Component", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 0, + "length": 38 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/index.tsx", + "contextSpan": { + "start": 0, + "length": 38 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 56, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/index.tsx", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/index.tsx === +// const /*FIND ALL REFS*/[|obj|] = {Component: () =>
}; +// const element = <[|obj|].Component/>; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/index.tsx", + "kind": "const", + "name": "const obj: {\n Component: () => any;\n}", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Component", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 0, + "length": 38 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/index.tsx", + "contextSpan": { + "start": 0, + "length": 38 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 56, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/index.tsx", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/index.tsx === +// const [|obj|] = {Component: () =>
}; +// const element = ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/index.tsx", + "kind": "const", + "name": "const obj: {\n Component: () => any;\n}", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "obj", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Component", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 0, + "length": 38 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/index.tsx", + "contextSpan": { + "start": 0, + "length": 38 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 56, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/index.tsx", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc new file mode 100644 index 00000000000..8fef6383f7c --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfArrowFunction.baseline.jsonc @@ -0,0 +1,329 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts === +// /*FIND ALL REFS*/var [|f|] = x => x + 1; +// [|f|](12); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "kind": "var", + "name": "var f: (x: any) => any", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts === +// var /*FIND ALL REFS*/[|f|] = x => x + 1; +// [|f|](12); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "kind": "var", + "name": "var f: (x: any) => any", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts === +// var [|f|] = x => x + 1; +// /*FIND ALL REFS*/[|f|](12); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "kind": "var", + "name": "var f: (x: any) => any", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfClass.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfClass.baseline.jsonc new file mode 100644 index 00000000000..21bc8b4984f --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfClass.baseline.jsonc @@ -0,0 +1,200 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts === +// /*FIND ALL REFS*/class [|C|] { +// n: number; +// constructor() { +// this.n = 12; +// } +// } +// let c = new [|C|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "kind": "class", + "name": "class C", + "textSpan": { + "start": 6, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 73 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "contextSpan": { + "start": 0, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 86, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts === +// class /*FIND ALL REFS*/[|C|] { +// n: number; +// constructor() { +// this.n = 12; +// } +// } +// let c = new [|C|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "kind": "class", + "name": "class C", + "textSpan": { + "start": 6, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 73 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "contextSpan": { + "start": 0, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 86, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts === +// class [|C|] { +// n: number; +// constructor() { +// this.n = 12; +// } +// } +// let c = new /*FIND ALL REFS*/[|C|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "kind": "class", + "name": "class C", + "textSpan": { + "start": 6, + "length": 1 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 73 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "contextSpan": { + "start": 0, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 86, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfComputedProperty.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfComputedProperty.baseline.jsonc new file mode 100644 index 00000000000..1e5b67f504e --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfComputedProperty.baseline.jsonc @@ -0,0 +1,277 @@ +undefined + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts === +// let o = { ["/*FIND ALL REFS*/[|foo|]"]: 12 }; +// let y = o.[|foo|]; +// let z = o['[|foo|]']; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "kind": "property", + "name": "(property) [\"foo\"]: number", + "textSpan": { + "start": 12, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[\"foo\"]", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "contextSpan": { + "start": 10, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 35, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 51, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts === +// let o = { ["[|foo|]"]: 12 }; +// let y = o./*FIND ALL REFS*/[|foo|]; +// let z = o['[|foo|]']; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "kind": "property", + "name": "(property) [\"foo\"]: number", + "textSpan": { + "start": 12, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[\"foo\"]", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "contextSpan": { + "start": 10, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 35, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 51, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts === +// let o = { ["[|foo|]"]: 12 }; +// let y = o.[|foo|]; +// let z = o['/*FIND ALL REFS*/[|foo|]']; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "kind": "property", + "name": "(property) [\"foo\"]: number", + "textSpan": { + "start": 12, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "[\"foo\"]", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 12, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "contextSpan": { + "start": 10, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 35, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 51, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfEnum.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfEnum.baseline.jsonc new file mode 100644 index 00000000000..73da7db9f23 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfEnum.baseline.jsonc @@ -0,0 +1,194 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts === +// /*FIND ALL REFS*/enum [|E|] { +// First, +// Second +// } +// let first = [|E|].First; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "kind": "enum", + "name": "enum E", + "textSpan": { + "start": 5, + "length": 1 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 45, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts === +// enum /*FIND ALL REFS*/[|E|] { +// First, +// Second +// } +// let first = [|E|].First; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "kind": "enum", + "name": "enum E", + "textSpan": { + "start": 5, + "length": 1 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 45, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts === +// enum [|E|] { +// First, +// Second +// } +// let first = /*FIND ALL REFS*/[|E|].First; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "kind": "enum", + "name": "enum E", + "textSpan": { + "start": 5, + "length": 1 + }, + "displayParts": [ + { + "text": "enum", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 45, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfFunction.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfFunction.baseline.jsonc new file mode 100644 index 00000000000..942b703f677 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfFunction.baseline.jsonc @@ -0,0 +1,296 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts === +// /*FIND ALL REFS*/function [|func|](x: number) { +// } +// [|func|](x) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "kind": "function", + "name": "function func(x: number): void", + "textSpan": { + "start": 9, + "length": 4 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "func", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 28 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "contextSpan": { + "start": 0, + "length": 28 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 29, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts === +// function /*FIND ALL REFS*/[|func|](x: number) { +// } +// [|func|](x) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "kind": "function", + "name": "function func(x: number): void", + "textSpan": { + "start": 9, + "length": 4 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "func", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 28 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "contextSpan": { + "start": 0, + "length": 28 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 29, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts === +// function [|func|](x: number) { +// } +// /*FIND ALL REFS*/[|func|](x) + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "kind": "function", + "name": "function func(x: number): void", + "textSpan": { + "start": 9, + "length": 4 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "func", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 28 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "contextSpan": { + "start": 0, + "length": 28 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 29, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfInterface.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfInterface.baseline.jsonc new file mode 100644 index 00000000000..99150fd8954 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfInterface.baseline.jsonc @@ -0,0 +1,191 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts === +// /*FIND ALL REFS*/interface [|I|] { +// p: number; +// } +// let i: [|I|] = { p: 12 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "kind": "interface", + "name": "interface I", + "textSpan": { + "start": 10, + "length": 1 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "contextSpan": { + "start": 0, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 38, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts === +// interface /*FIND ALL REFS*/[|I|] { +// p: number; +// } +// let i: [|I|] = { p: 12 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "kind": "interface", + "name": "interface I", + "textSpan": { + "start": 10, + "length": 1 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "contextSpan": { + "start": 0, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 38, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts === +// interface [|I|] { +// p: number; +// } +// let i: /*FIND ALL REFS*/[|I|] = { p: 12 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "kind": "interface", + "name": "interface I", + "textSpan": { + "start": 10, + "length": 1 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 30 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "contextSpan": { + "start": 0, + "length": 30 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 38, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc new file mode 100644 index 00000000000..1fcde92de59 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfInterfaceClassMerge.baseline.jsonc @@ -0,0 +1,991 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === +// /*FIND ALL REFS*/interface [|Numbers|] { +// p: number; +// } +// interface [|Numbers|] { +// m: number; +// } +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "kind": "class", + "name": "class Numbers\ninterface Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 36 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 0, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 47, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 37, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 80, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 74, + "length": 78 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 160, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 174, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === +// interface /*FIND ALL REFS*/[|Numbers|] { +// p: number; +// } +// interface [|Numbers|] { +// m: number; +// } +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "kind": "class", + "name": "class Numbers\ninterface Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 36 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 0, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 47, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 37, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 80, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 74, + "length": 78 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 160, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 174, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === +// interface [|Numbers|] { +// p: number; +// } +// /*FIND ALL REFS*/interface [|Numbers|] { +// m: number; +// } +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "kind": "class", + "name": "class Numbers\ninterface Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 36 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 0, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 47, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 37, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 80, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 74, + "length": 78 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 160, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 174, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === +// interface [|Numbers|] { +// p: number; +// } +// interface /*FIND ALL REFS*/[|Numbers|] { +// m: number; +// } +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "kind": "class", + "name": "class Numbers\ninterface Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 36 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 0, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 47, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 37, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 80, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 74, + "length": 78 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 160, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 174, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === +// interface [|Numbers|] { +// p: number; +// } +// interface [|Numbers|] { +// m: number; +// } +// /*FIND ALL REFS*/class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "kind": "class", + "name": "class Numbers\ninterface Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 36 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 0, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 47, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 37, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 80, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 74, + "length": 78 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 160, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 174, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === +// interface [|Numbers|] { +// p: number; +// } +// interface [|Numbers|] { +// m: number; +// } +// class /*FIND ALL REFS*/[|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "kind": "class", + "name": "class Numbers\ninterface Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 36 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 0, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 47, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 37, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 80, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 74, + "length": 78 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 160, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 174, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === +// interface [|Numbers|] { +// p: number; +// } +// interface [|Numbers|] { +// m: number; +// } +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: /*FIND ALL REFS*/[|Numbers|] = new [|Numbers|](); +// let x = i.f(i.p + i.m); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "kind": "class", + "name": "class Numbers\ninterface Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 36 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 0, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 47, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 37, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 80, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 74, + "length": 78 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 160, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 174, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts === +// interface [|Numbers|] { +// p: number; +// } +// interface [|Numbers|] { +// m: number; +// } +// class [|Numbers|] { +// f(n: number) { +// return this.p + this.m + n; +// } +// } +// let i: [|Numbers|] = new /*FIND ALL REFS*/[|Numbers|](); +// let x = i.f(i.p + i.m); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "kind": "class", + "name": "class Numbers\ninterface Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 36 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 0, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 47, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 37, + "length": 36 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 80, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "contextSpan": { + "start": 74, + "length": 78 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 160, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 174, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc new file mode 100644 index 00000000000..83b83ad76b1 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfNamespace.baseline.jsonc @@ -0,0 +1,191 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts === +// /*FIND ALL REFS*/namespace [|Numbers|] { +// export var n = 12; +// } +// let x = [|Numbers|].n + 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "kind": "module", + "name": "namespace Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 44 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "contextSpan": { + "start": 0, + "length": 44 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 53, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts === +// namespace /*FIND ALL REFS*/[|Numbers|] { +// export var n = 12; +// } +// let x = [|Numbers|].n + 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "kind": "module", + "name": "namespace Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 44 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "contextSpan": { + "start": 0, + "length": 44 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 53, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts === +// namespace [|Numbers|] { +// export var n = 12; +// } +// let x = /*FIND ALL REFS*/[|Numbers|].n + 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "kind": "module", + "name": "namespace Numbers", + "textSpan": { + "start": 10, + "length": 7 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Numbers", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 44 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "contextSpan": { + "start": 0, + "length": 44 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 53, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfNumberNamedProperty.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfNumberNamedProperty.baseline.jsonc new file mode 100644 index 00000000000..8a6e74e26b5 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfNumberNamedProperty.baseline.jsonc @@ -0,0 +1,163 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts === +// let o = { /*FIND ALL REFS*/[|1|]: 12 }; +// let y = o[[|1|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts", + "kind": "property", + "name": "(property) 1: number", + "textSpan": { + "start": 10, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 5 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts", + "contextSpan": { + "start": 10, + "length": 5 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 29, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts === +// let o = { [|1|]: 12 }; +// let y = o[/*FIND ALL REFS*/[|1|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts", + "kind": "property", + "name": "(property) 1: number", + "textSpan": { + "start": 10, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 5 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts", + "contextSpan": { + "start": 10, + "length": 5 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 29, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfParameter.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfParameter.baseline.jsonc new file mode 100644 index 00000000000..0a4d300848a --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfParameter.baseline.jsonc @@ -0,0 +1,165 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts === +// function f(/*FIND ALL REFS*/[|x|]: number) { +// return [|x|] + 1 +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts", + "kind": "parameter", + "name": "(parameter) x: number", + "textSpan": { + "start": 11, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 11, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 11, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts", + "contextSpan": { + "start": 11, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts === +// function f([|x|]: number) { +// return /*FIND ALL REFS*/[|x|] + 1 +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts", + "kind": "parameter", + "name": "(parameter) x: number", + "textSpan": { + "start": 11, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 11, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 11, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts", + "contextSpan": { + "start": 11, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfStringNamedProperty.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfStringNamedProperty.baseline.jsonc new file mode 100644 index 00000000000..86066787a69 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfStringNamedProperty.baseline.jsonc @@ -0,0 +1,245 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts === +// let o = { /*FIND ALL REFS*/"[|x|]": 12 }; +// let y = o.[|x|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "kind": "property", + "name": "(property) \"x\": number", + "textSpan": { + "start": 11, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"x\"", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 7 + } + }, + "references": [ + { + "textSpan": { + "start": 11, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "contextSpan": { + "start": 10, + "length": 7 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts === +// let o = { "/*FIND ALL REFS*/[|x|]": 12 }; +// let y = o.[|x|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "kind": "property", + "name": "(property) \"x\": number", + "textSpan": { + "start": 11, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"x\"", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 7 + } + }, + "references": [ + { + "textSpan": { + "start": 11, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "contextSpan": { + "start": 10, + "length": 7 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts === +// let o = { "[|x|]": 12 }; +// let y = o./*FIND ALL REFS*/[|x|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "kind": "property", + "name": "(property) \"x\": number", + "textSpan": { + "start": 11, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"x\"", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 7 + } + }, + "references": [ + { + "textSpan": { + "start": 11, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "contextSpan": { + "start": 10, + "length": 7 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc new file mode 100644 index 00000000000..f9e9e88404b --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfTypeAlias.baseline.jsonc @@ -0,0 +1,233 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts === +// /*FIND ALL REFS*/type [|Alias|]= number; +// let n: [|Alias|] = 12; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "kind": "type", + "name": "type Alias = number", + "textSpan": { + "start": 5, + "length": 5 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Alias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts === +// type /*FIND ALL REFS*/[|Alias|]= number; +// let n: [|Alias|] = 12; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "kind": "type", + "name": "type Alias = number", + "textSpan": { + "start": 5, + "length": 5 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Alias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts === +// type [|Alias|]= number; +// let n: /*FIND ALL REFS*/[|Alias|] = 12; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "kind": "type", + "name": "type Alias = number", + "textSpan": { + "start": 5, + "length": 5 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Alias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 5, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "contextSpan": { + "start": 0, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 27, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesIsDefinitionOfVariable.baseline.jsonc b/tests/baselines/reference/getOccurrencesIsDefinitionOfVariable.baseline.jsonc new file mode 100644 index 00000000000..c5d2b4e6168 --- /dev/null +++ b/tests/baselines/reference/getOccurrencesIsDefinitionOfVariable.baseline.jsonc @@ -0,0 +1,3295 @@ +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// /*FIND ALL REFS*/var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var /*FIND ALL REFS*/[|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = /*FIND ALL REFS*/[|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + /*FIND ALL REFS*/[|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// /*FIND ALL REFS*/[|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// /*FIND ALL REFS*/[|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = /*FIND ALL REFS*/[|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + /*FIND ALL REFS*/[|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// /*FIND ALL REFS*/[|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// /*FIND ALL REFS*/[|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++/*FIND ALL REFS*/[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = /*FIND ALL REFS*/[|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --/*FIND ALL REFS*/[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = /*FIND ALL REFS*/[|x|]--; +// +// [|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// /*FIND ALL REFS*/[|x|] += 1; +// [|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts === +// var [|x|] = 0; +// var assignmentRightHandSide = [|x|]; +// var assignmentRightHandSide2 = 1 + [|x|]; +// +// [|x|] = 1; +// [|x|] = [|x|] + [|x|]; +// +// [|x|] == 1; +// [|x|] <= 1; +// +// var preIncrement = ++[|x|]; +// var postIncrement = [|x|]++; +// var preDecrement = --[|x|]; +// var postDecrement = [|x|]--; +// +// [|x|] += 1; +// /*FIND ALL REFS*/[|x|] <<= 1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "kind": "var", + "name": "var x: number", + "textSpan": { + "start": 4, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "contextSpan": { + "start": 0, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 41, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 90, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 94, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 98, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 102, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 110, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 140, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 163, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 212, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 218, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 226, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getReferencesAtPosition-pp.baseline.jsonc b/tests/baselines/reference/getReferencesAtPosition-pp.baseline.jsonc new file mode 100644 index 00000000000..7682d6ee5bc --- /dev/null +++ b/tests/baselines/reference/getReferencesAtPosition-pp.baseline.jsonc @@ -0,0 +1,350 @@ +// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// /*FIND ALL REFS*/public [|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// public /*FIND ALL REFS*/[|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// public [|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second./*FIND ALL REFS*/[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/getReferencesAtPosition.baseline.jsonc b/tests/baselines/reference/getReferencesAtPosition.baseline.jsonc new file mode 100644 index 00000000000..4736559ee34 --- /dev/null +++ b/tests/baselines/reference/getReferencesAtPosition.baseline.jsonc @@ -0,0 +1,350 @@ +// === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// /*FIND ALL REFS*/public [|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/shims/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// public /*FIND ALL REFS*/[|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/shims/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// public [|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/shims/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second./*FIND ALL REFS*/[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/shims/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTypedefTagSemanticMeaning0.baseline.jsonc b/tests/baselines/reference/jsdocTypedefTagSemanticMeaning0.baseline.jsonc new file mode 100644 index 00000000000..87be90a968c --- /dev/null +++ b/tests/baselines/reference/jsdocTypedefTagSemanticMeaning0.baseline.jsonc @@ -0,0 +1,389 @@ +undefined + +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} /*FIND ALL REFS*/[|T|] */ +// const T = 1; +// /** @type {[|T|]} */ +// const n = T; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "type T = number", + "textSpan": { + "start": 33, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 27, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 4, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 51, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} T */ +// /*FIND ALL REFS*/const [|T|] = 1; +// /** @type {T} */ +// const n = [|T|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "const T: 1", + "textSpan": { + "start": 33, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 27, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 27, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} T */ +// const /*FIND ALL REFS*/[|T|] = 1; +// /** @type {T} */ +// const n = [|T|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "const T: 1", + "textSpan": { + "start": 33, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 27, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 27, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} [|T|] */ +// const T = 1; +// /** @type {/*FIND ALL REFS*/[|T|]} */ +// const n = T; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "type T = number", + "textSpan": { + "start": 33, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 27, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 4, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 51, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} T */ +// const [|T|] = 1; +// /** @type {T} */ +// const n = /*FIND ALL REFS*/[|T|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "const T: 1", + "textSpan": { + "start": 33, + "length": 1 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 27, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 27, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTypedefTagSemanticMeaning1.baseline.jsonc b/tests/baselines/reference/jsdocTypedefTagSemanticMeaning1.baseline.jsonc new file mode 100644 index 00000000000..eb06e3b4897 --- /dev/null +++ b/tests/baselines/reference/jsdocTypedefTagSemanticMeaning1.baseline.jsonc @@ -0,0 +1,467 @@ +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} */ +// /*FIND ALL REFS*/const [|T|] = 1; +// /** @type {[|T|]} */ +// const n = [|T|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "type T = number\nconst T: 1", + "textSpan": { + "start": 31, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 25, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 25, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 65, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} */ +// const /*FIND ALL REFS*/[|T|] = 1; +// /** @type {[|T|]} */ +// const n = [|T|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "type T = number\nconst T: 1", + "textSpan": { + "start": 31, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 25, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 25, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 65, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} */ +// const [|T|] = 1; +// /** @type {/*FIND ALL REFS*/[|T|]} */ +// const n = [|T|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "type T = number\nconst T: 1", + "textSpan": { + "start": 31, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 25, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 25, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 65, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.js === +// /** @typedef {number} */ +// const [|T|] = 1; +// /** @type {[|T|]} */ +// const n = /*FIND ALL REFS*/[|T|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "const", + "name": "type T = number\nconst T: 1", + "textSpan": { + "start": 31, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 25, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 25, + "length": 12 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 49, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 65, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoUntypedModuleImport.baseline.jsonc b/tests/baselines/reference/quickInfoUntypedModuleImport.baseline.jsonc new file mode 100644 index 00000000000..ce4e79d8a7a --- /dev/null +++ b/tests/baselines/reference/quickInfoUntypedModuleImport.baseline.jsonc @@ -0,0 +1,165 @@ +// === /tests/cases/fourslash/a.ts === +// import /*FIND ALL REFS*/[|foo|] from "foo"; +// [|foo|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "alias", + "name": "import foo", + "textSpan": { + "start": 7, + "length": 3 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 22 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 22 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// import foo from /*FIND ALL REFS*/"[|foo|]"; +// foo(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "var", + "name": "foo", + "textSpan": { + "start": 17, + "length": 3 + }, + "displayParts": [ + { + "text": "\"foo\"", + "kind": "stringLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 17, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 22 + }, + "isWriteAccess": false, + "isDefinition": false, + "isInString": true + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// import [|foo|] from "foo"; +// /*FIND ALL REFS*/[|foo|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "alias", + "name": "import foo", + "textSpan": { + "start": 7, + "length": 3 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "aliasName" + } + ], + "contextSpan": { + "start": 0, + "length": 22 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 0, + "length": 22 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 23, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referenceToClass.baseline.jsonc b/tests/baselines/reference/referenceToClass.baseline.jsonc new file mode 100644 index 00000000000..929c54ee213 --- /dev/null +++ b/tests/baselines/reference/referenceToClass.baseline.jsonc @@ -0,0 +1,671 @@ +// === /tests/cases/fourslash/referenceToClass_1.ts === +// class /*FIND ALL REFS*/[|foo|] { +// public n: [|foo|]; +// public foo: number; +// } +// +// class bar { +// public n: [|foo|]; +// public k = new [|foo|](); +// } +// +// module mod { +// var k: [|foo|] = null; +// } + +// === /tests/cases/fourslash/referenceToClass_2.ts === +// var k: [|foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "kind": "class", + "name": "class foo", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 56 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "contextSpan": { + "start": 0, + "length": 56 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 84, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 108, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 142, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 7, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referenceToClass_1.ts === +// class [|foo|] { +// public n: /*FIND ALL REFS*/[|foo|]; +// public foo: number; +// } +// +// class bar { +// public n: [|foo|]; +// public k = new [|foo|](); +// } +// +// module mod { +// var k: [|foo|] = null; +// } + +// === /tests/cases/fourslash/referenceToClass_2.ts === +// var k: [|foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "kind": "class", + "name": "class foo", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 56 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "contextSpan": { + "start": 0, + "length": 56 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 84, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 108, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 142, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 7, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referenceToClass_1.ts === +// class [|foo|] { +// public n: [|foo|]; +// public foo: number; +// } +// +// class bar { +// public n: /*FIND ALL REFS*/[|foo|]; +// public k = new [|foo|](); +// } +// +// module mod { +// var k: [|foo|] = null; +// } + +// === /tests/cases/fourslash/referenceToClass_2.ts === +// var k: [|foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "kind": "class", + "name": "class foo", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 56 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "contextSpan": { + "start": 0, + "length": 56 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 84, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 108, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 142, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 7, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referenceToClass_1.ts === +// class [|foo|] { +// public n: [|foo|]; +// public foo: number; +// } +// +// class bar { +// public n: [|foo|]; +// public k = new /*FIND ALL REFS*/[|foo|](); +// } +// +// module mod { +// var k: [|foo|] = null; +// } + +// === /tests/cases/fourslash/referenceToClass_2.ts === +// var k: [|foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "kind": "class", + "name": "class foo", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 56 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "contextSpan": { + "start": 0, + "length": 56 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 84, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 108, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 142, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 7, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referenceToClass_1.ts === +// class [|foo|] { +// public n: [|foo|]; +// public foo: number; +// } +// +// class bar { +// public n: [|foo|]; +// public k = new [|foo|](); +// } +// +// module mod { +// var k: /*FIND ALL REFS*/[|foo|] = null; +// } + +// === /tests/cases/fourslash/referenceToClass_2.ts === +// var k: [|foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "kind": "class", + "name": "class foo", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 56 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "contextSpan": { + "start": 0, + "length": 56 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 84, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 108, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 142, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 7, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referenceToClass_1.ts === +// class [|foo|] { +// public n: [|foo|]; +// public foo: number; +// } +// +// class bar { +// public n: [|foo|]; +// public k = new [|foo|](); +// } +// +// module mod { +// var k: [|foo|] = null; +// } + +// === /tests/cases/fourslash/referenceToClass_2.ts === +// var k: /*FIND ALL REFS*/[|foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "kind": "class", + "name": "class foo", + "textSpan": { + "start": 6, + "length": 3 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 56 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "contextSpan": { + "start": 0, + "length": 56 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 84, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 108, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 142, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 7, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referenceToClass_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesBloomFilters3.baseline.jsonc b/tests/baselines/reference/referencesBloomFilters3.baseline.jsonc new file mode 100644 index 00000000000..6a6e17fd1e7 --- /dev/null +++ b/tests/baselines/reference/referencesBloomFilters3.baseline.jsonc @@ -0,0 +1,299 @@ +// === /tests/cases/fourslash/expression.ts === +// (Test[[|42|]]); + +// === /tests/cases/fourslash/declaration.ts === +// enum Test { /*FIND ALL REFS*/"[|42|]" = 1 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/declaration.ts", + "kind": "enum member", + "name": "(enum member) Test[\"42\"] = 1", + "textSpan": { + "start": 13, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"42\"", + "kind": "enumMemberName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 12, + "length": 8 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/declaration.ts", + "contextSpan": { + "start": 12, + "length": 8 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 6, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/expression.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/expression.ts === +// (Test[[|42|]]); + +// === /tests/cases/fourslash/declaration.ts === +// enum Test { "/*FIND ALL REFS*/[|42|]" = 1 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/declaration.ts", + "kind": "enum member", + "name": "(enum member) Test[\"42\"] = 1", + "textSpan": { + "start": 13, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"42\"", + "kind": "enumMemberName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 12, + "length": 8 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/declaration.ts", + "contextSpan": { + "start": 12, + "length": 8 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 6, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/expression.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/expression.ts === +// (Test[/*FIND ALL REFS*/[|42|]]); + +// === /tests/cases/fourslash/declaration.ts === +// enum Test { "[|42|]" = 1 }; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/declaration.ts", + "kind": "enum member", + "name": "(enum member) Test[\"42\"] = 1", + "textSpan": { + "start": 13, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"42\"", + "kind": "enumMemberName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 12, + "length": 8 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/declaration.ts", + "contextSpan": { + "start": 12, + "length": 8 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 6, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/expression.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForAmbients.baseline.jsonc b/tests/baselines/reference/referencesForAmbients.baseline.jsonc new file mode 100644 index 00000000000..43dc9ef6251 --- /dev/null +++ b/tests/baselines/reference/referencesForAmbients.baseline.jsonc @@ -0,0 +1,1417 @@ +// === /tests/cases/fourslash/referencesForAmbients.ts === +// /*FIND ALL REFS*/declare module "[|foo|]" { +// var f: number; +// } +// +// declare module "bar" { +// export import foo = require("[|foo|]"); +// var f2: typeof foo.f; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "module", + "name": "module \"foo\"", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 0, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 101, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 72, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "/*FIND ALL REFS*/[|foo|]" { +// var f: number; +// } +// +// declare module "bar" { +// export import foo = require("[|foo|]"); +// var f2: typeof foo.f; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "module", + "name": "module \"foo\"", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 0, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 101, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 72, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// /*FIND ALL REFS*/var [|f|]: number; +// } +// +// declare module "bar" { +// export import foo = require("foo"); +// var f2: typeof foo.[|f|]; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "var", + "name": "var f: number", + "textSpan": { + "start": 31, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 27, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 27, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 131, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var /*FIND ALL REFS*/[|f|]: number; +// } +// +// declare module "bar" { +// export import foo = require("foo"); +// var f2: typeof foo.[|f|]; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "var", + "name": "var f: number", + "textSpan": { + "start": 31, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 27, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 27, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 131, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var f: number; +// } +// +// /*FIND ALL REFS*/declare module "[|bar|]" { +// export import foo = require("foo"); +// var f2: typeof foo.f; +// } +// +// declare module "baz" { +// import bar = require("[|bar|]"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "module", + "name": "module \"bar\"", + "textSpan": { + "start": 61, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"bar\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 45, + "length": 90 + } + }, + "references": [ + { + "textSpan": { + "start": 61, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 45, + "length": 90 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 186, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 164, + "length": 28 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var f: number; +// } +// +// declare module "/*FIND ALL REFS*/[|bar|]" { +// export import foo = require("foo"); +// var f2: typeof foo.f; +// } +// +// declare module "baz" { +// import bar = require("[|bar|]"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "module", + "name": "module \"bar\"", + "textSpan": { + "start": 61, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"bar\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 45, + "length": 90 + } + }, + "references": [ + { + "textSpan": { + "start": 61, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 45, + "length": 90 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 186, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 164, + "length": 28 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var f: number; +// } +// +// declare module "bar" { +// /*FIND ALL REFS*/export import [|foo|] = require("foo"); +// var f2: typeof [|foo|].f; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.[|foo|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "alias", + "name": "(alias) module \"foo\"\nimport foo = require(\"foo\")", + "textSpan": { + "start": 86, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 72, + "length": 35 + } + }, + "references": [ + { + "textSpan": { + "start": 86, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 72, + "length": 35 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 127, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 216, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var f: number; +// } +// +// declare module "bar" { +// export import /*FIND ALL REFS*/[|foo|] = require("foo"); +// var f2: typeof [|foo|].f; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.[|foo|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "alias", + "name": "(alias) module \"foo\"\nimport foo = require(\"foo\")", + "textSpan": { + "start": 86, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 72, + "length": 35 + } + }, + "references": [ + { + "textSpan": { + "start": 86, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 72, + "length": 35 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 127, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 216, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "[|foo|]" { +// var f: number; +// } +// +// declare module "bar" { +// export import foo = require("/*FIND ALL REFS*/[|foo|]"); +// var f2: typeof foo.f; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "module", + "name": "module \"foo\"", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 0, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 101, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 72, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var f: number; +// } +// +// declare module "bar" { +// export import [|foo|] = require("foo"); +// var f2: typeof /*FIND ALL REFS*/[|foo|].f; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.[|foo|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "alias", + "name": "(alias) module \"foo\"\nimport foo = require(\"foo\")", + "textSpan": { + "start": 86, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 72, + "length": 35 + } + }, + "references": [ + { + "textSpan": { + "start": 86, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 72, + "length": 35 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 127, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 216, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var [|f|]: number; +// } +// +// declare module "bar" { +// export import foo = require("foo"); +// var f2: typeof foo./*FIND ALL REFS*/[|f|]; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "var", + "name": "var f: number", + "textSpan": { + "start": 31, + "length": 1 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 27, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 27, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 131, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var f: number; +// } +// +// declare module "bar" { +// export import foo = require("foo"); +// var f2: typeof foo.f; +// } +// +// declare module "baz" { +// /*FIND ALL REFS*/import [|bar|] = require("bar"); +// var f2: typeof [|bar|].foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "alias", + "name": "(alias) module \"bar\"\nimport bar = require(\"bar\")", + "textSpan": { + "start": 171, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"bar\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "bar", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"bar\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 164, + "length": 28 + } + }, + "references": [ + { + "textSpan": { + "start": 171, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 164, + "length": 28 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 212, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var f: number; +// } +// +// declare module "[|bar|]" { +// export import foo = require("foo"); +// var f2: typeof foo.f; +// } +// +// declare module "baz" { +// import bar = require("/*FIND ALL REFS*/[|bar|]"); +// var f2: typeof bar.foo; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "module", + "name": "module \"bar\"", + "textSpan": { + "start": 61, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"bar\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 45, + "length": 90 + } + }, + "references": [ + { + "textSpan": { + "start": 61, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 45, + "length": 90 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 186, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 164, + "length": 28 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForAmbients.ts === +// declare module "foo" { +// var f: number; +// } +// +// declare module "bar" { +// export import [|foo|] = require("foo"); +// var f2: typeof [|foo|].f; +// } +// +// declare module "baz" { +// import bar = require("bar"); +// var f2: typeof bar./*FIND ALL REFS*/[|foo|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "kind": "alias", + "name": "(alias) module \"foo\"\nimport foo = require(\"foo\")", + "textSpan": { + "start": 86, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 72, + "length": 35 + } + }, + "references": [ + { + "textSpan": { + "start": 86, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "contextSpan": { + "start": 72, + "length": 35 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 127, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 216, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForAmbients.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForAmbients2.baseline.jsonc b/tests/baselines/reference/referencesForAmbients2.baseline.jsonc new file mode 100644 index 00000000000..da4b32a8fcf --- /dev/null +++ b/tests/baselines/reference/referencesForAmbients2.baseline.jsonc @@ -0,0 +1,399 @@ +// === /defA.ts === +// declare module "a" { +// /*FIND ALL REFS*/export type [|T|] = number; +// } + +// === /defC.ts === +// declare module "c" { +// import b = require("b"); +// const x: b.a.[|T|]; +// } + +// === /defB.ts === +// declare module "b" { +// export import a = require("a"); +// export const x: a.[|T|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/defA.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 25, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/defA.ts", + "contextSpan": { + "start": 25, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/defB.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/defC.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /defA.ts === +// declare module "a" { +// export type /*FIND ALL REFS*/[|T|] = number; +// } + +// === /defC.ts === +// declare module "c" { +// import b = require("b"); +// const x: b.a.[|T|]; +// } + +// === /defB.ts === +// declare module "b" { +// export import a = require("a"); +// export const x: a.[|T|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/defA.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 25, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/defA.ts", + "contextSpan": { + "start": 25, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/defB.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/defC.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /defA.ts === +// declare module "a" { +// export type [|T|] = number; +// } + +// === /defC.ts === +// declare module "c" { +// import b = require("b"); +// const x: b.a.[|T|]; +// } + +// === /defB.ts === +// declare module "b" { +// export import a = require("a"); +// export const x: a./*FIND ALL REFS*/[|T|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/defA.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 25, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/defA.ts", + "contextSpan": { + "start": 25, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/defB.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/defC.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /defA.ts === +// declare module "a" { +// export type [|T|] = number; +// } + +// === /defC.ts === +// declare module "c" { +// import b = require("b"); +// const x: b.a./*FIND ALL REFS*/[|T|]; +// } + +// === /defB.ts === +// declare module "b" { +// export import a = require("a"); +// export const x: a.[|T|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/defA.ts", + "kind": "type", + "name": "type T = number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 25, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/defA.ts", + "contextSpan": { + "start": 25, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 79, + "length": 1 + }, + "fileName": "/defB.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 67, + "length": 1 + }, + "fileName": "/defC.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForClassLocal.baseline.jsonc b/tests/baselines/reference/referencesForClassLocal.baseline.jsonc new file mode 100644 index 00000000000..f42c6a3c22e --- /dev/null +++ b/tests/baselines/reference/referencesForClassLocal.baseline.jsonc @@ -0,0 +1,455 @@ +// === /tests/cases/fourslash/referencesForClassLocal.ts === +// var n = 14; +// +// class foo { +// /*FIND ALL REFS*/private [|n|] = 0; +// +// public bar() { +// this.[|n|] = 9; +// } +// +// constructor() { +// this.[|n|] = 4; +// } +// +// public bar2() { +// var n = 12; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "kind": "property", + "name": "(property) foo.n: number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 124, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForClassLocal.ts === +// var n = 14; +// +// class foo { +// private /*FIND ALL REFS*/[|n|] = 0; +// +// public bar() { +// this.[|n|] = 9; +// } +// +// constructor() { +// this.[|n|] = 4; +// } +// +// public bar2() { +// var n = 12; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "kind": "property", + "name": "(property) foo.n: number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 124, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForClassLocal.ts === +// var n = 14; +// +// class foo { +// private [|n|] = 0; +// +// public bar() { +// this./*FIND ALL REFS*/[|n|] = 9; +// } +// +// constructor() { +// this.[|n|] = 4; +// } +// +// public bar2() { +// var n = 12; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "kind": "property", + "name": "(property) foo.n: number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 124, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForClassLocal.ts === +// var n = 14; +// +// class foo { +// private [|n|] = 0; +// +// public bar() { +// this.[|n|] = 9; +// } +// +// constructor() { +// this./*FIND ALL REFS*/[|n|] = 4; +// } +// +// public bar2() { +// var n = 12; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "kind": "property", + "name": "(property) foo.n: number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 124, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassLocal.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForClassParameter.baseline.jsonc b/tests/baselines/reference/referencesForClassParameter.baseline.jsonc new file mode 100644 index 00000000000..cdbf592a787 --- /dev/null +++ b/tests/baselines/reference/referencesForClassParameter.baseline.jsonc @@ -0,0 +1,451 @@ +// === /tests/cases/fourslash/referencesForClassParameter.ts === +// var p = 2; +// +// class p { } +// +// class foo { +// constructor (/*FIND ALL REFS*/public [|p|]: any) { +// } +// +// public f(p) { +// this.[|p|] = p; +// } +// +// } +// +// var n = new foo(undefined); +// n.[|p|] = null; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "kind": "property", + "name": "(property) foo.p: any", + "textSpan": { + "start": 61, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "p", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 54, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 61, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "contextSpan": { + "start": 54, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 109, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 156, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForClassParameter.ts === +// var p = 2; +// +// class p { } +// +// class foo { +// constructor (public /*FIND ALL REFS*/[|p|]: any) { +// } +// +// public f(p) { +// this.[|p|] = p; +// } +// +// } +// +// var n = new foo(undefined); +// n.[|p|] = null; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "kind": "property", + "name": "(property) foo.p: any", + "textSpan": { + "start": 61, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "p", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 54, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 61, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "contextSpan": { + "start": 54, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 109, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 156, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForClassParameter.ts === +// var p = 2; +// +// class p { } +// +// class foo { +// constructor (public [|p|]: any) { +// } +// +// public f(p) { +// this./*FIND ALL REFS*/[|p|] = p; +// } +// +// } +// +// var n = new foo(undefined); +// n.[|p|] = null; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "kind": "property", + "name": "(property) foo.p: any", + "textSpan": { + "start": 61, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "p", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 54, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 61, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "contextSpan": { + "start": 54, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 109, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 156, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForClassParameter.ts === +// var p = 2; +// +// class p { } +// +// class foo { +// constructor (public [|p|]: any) { +// } +// +// public f(p) { +// this.[|p|] = p; +// } +// +// } +// +// var n = new foo(undefined); +// n./*FIND ALL REFS*/[|p|] = null; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "kind": "property", + "name": "(property) foo.p: any", + "textSpan": { + "start": 61, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "p", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 54, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 61, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "contextSpan": { + "start": 54, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 109, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 156, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForClassParameter.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForEnums.baseline.jsonc b/tests/baselines/reference/referencesForEnums.baseline.jsonc new file mode 100644 index 00000000000..ee2ff14dfcb --- /dev/null +++ b/tests/baselines/reference/referencesForEnums.baseline.jsonc @@ -0,0 +1,1004 @@ +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// /*FIND ALL REFS*/[|value1|] = 1, +// "value2" = [|value1|], +// 111 = 11 +// } +// +// E.[|value1|]; +// E["value2"]; +// E.value2; +// E[111]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E.value1 = 1", + "textSpan": { + "start": 13, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "value1", + "kind": "enumMemberName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 13, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 13, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 66, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// value1 = 1, +// /*FIND ALL REFS*/"[|value2|]" = value1, +// 111 = 11 +// } +// +// E.value1; +// E["[|value2|]"]; +// E.[|value2|]; +// E[111]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E[\"value2\"] = 1", + "textSpan": { + "start": 30, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"value2\"", + "kind": "enumMemberName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 29, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 30, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 29, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 89, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// value1 = 1, +// "/*FIND ALL REFS*/[|value2|]" = value1, +// 111 = 11 +// } +// +// E.value1; +// E["[|value2|]"]; +// E.[|value2|]; +// E[111]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E[\"value2\"] = 1", + "textSpan": { + "start": 30, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"value2\"", + "kind": "enumMemberName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 29, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 30, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 29, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 89, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// [|value1|] = 1, +// "value2" = /*FIND ALL REFS*/[|value1|], +// 111 = 11 +// } +// +// E.[|value1|]; +// E["value2"]; +// E.value2; +// E[111]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E.value1 = 1", + "textSpan": { + "start": 13, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "value1", + "kind": "enumMemberName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 13, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 13, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 66, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// value1 = 1, +// "value2" = value1, +// /*FIND ALL REFS*/[|111|] = 11 +// } +// +// E.value1; +// E["value2"]; +// E.value2; +// E[[|111|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E[111] = 11", + "textSpan": { + "start": 52, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "111", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "11", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 52, + "length": 8 + } + }, + "references": [ + { + "textSpan": { + "start": 52, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 52, + "length": 8 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 99, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// [|value1|] = 1, +// "value2" = [|value1|], +// 111 = 11 +// } +// +// E./*FIND ALL REFS*/[|value1|]; +// E["value2"]; +// E.value2; +// E[111]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E.value1 = 1", + "textSpan": { + "start": 13, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "value1", + "kind": "enumMemberName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 13, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 13, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 13, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 66, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// value1 = 1, +// "[|value2|]" = value1, +// 111 = 11 +// } +// +// E.value1; +// E["/*FIND ALL REFS*/[|value2|]"]; +// E.[|value2|]; +// E[111]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E[\"value2\"] = 1", + "textSpan": { + "start": 30, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"value2\"", + "kind": "enumMemberName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 29, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 30, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 29, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 89, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// value1 = 1, +// "[|value2|]" = value1, +// 111 = 11 +// } +// +// E.value1; +// E["[|value2|]"]; +// E./*FIND ALL REFS*/[|value2|]; +// E[111]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E[\"value2\"] = 1", + "textSpan": { + "start": 30, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"value2\"", + "kind": "enumMemberName" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "1", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 29, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 30, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 29, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 77, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 89, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForEnums.ts === +// enum E { +// value1 = 1, +// "value2" = value1, +// [|111|] = 11 +// } +// +// E.value1; +// E["value2"]; +// E.value2; +// E[/*FIND ALL REFS*/[|111|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "kind": "enum member", + "name": "(enum member) E[111] = 11", + "textSpan": { + "start": 52, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "enum member", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "E", + "kind": "enumName" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "111", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "11", + "kind": "numericLiteral" + } + ], + "contextSpan": { + "start": 52, + "length": 8 + } + }, + "references": [ + { + "textSpan": { + "start": 52, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "contextSpan": { + "start": 52, + "length": 8 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 99, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForEnums.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForExportedValues.baseline.jsonc b/tests/baselines/reference/referencesForExportedValues.baseline.jsonc new file mode 100644 index 00000000000..d39c52a3704 --- /dev/null +++ b/tests/baselines/reference/referencesForExportedValues.baseline.jsonc @@ -0,0 +1,295 @@ +undefined + +// === /tests/cases/fourslash/referencesForExportedValues.ts === +// module M { +// export var /*FIND ALL REFS*/[|variable|] = 0; +// +// // local use +// var x = [|variable|]; +// } +// +// // external use +// M.[|variable|] + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "kind": "var", + "name": "var M.variable: number", + "textSpan": { + "start": 26, + "length": 8 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "M", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "variable", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 15, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "contextSpan": { + "start": 15, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 70, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 101, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForExportedValues.ts === +// module M { +// export var [|variable|] = 0; +// +// // local use +// var x = /*FIND ALL REFS*/[|variable|]; +// } +// +// // external use +// M.[|variable|] + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "kind": "var", + "name": "var M.variable: number", + "textSpan": { + "start": 26, + "length": 8 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "M", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "variable", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 15, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "contextSpan": { + "start": 15, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 70, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 101, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForExportedValues.ts === +// module M { +// export var [|variable|] = 0; +// +// // local use +// var x = [|variable|]; +// } +// +// // external use +// M./*FIND ALL REFS*/[|variable|] + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "kind": "var", + "name": "var M.variable: number", + "textSpan": { + "start": 26, + "length": 8 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "M", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "variable", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 15, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "contextSpan": { + "start": 15, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 70, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 101, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForExportedValues.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForExternalModuleNames.baseline.jsonc b/tests/baselines/reference/referencesForExternalModuleNames.baseline.jsonc new file mode 100644 index 00000000000..16b49d2a269 --- /dev/null +++ b/tests/baselines/reference/referencesForExternalModuleNames.baseline.jsonc @@ -0,0 +1,321 @@ +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// /*FIND ALL REFS*/declare module "[|foo|]" { +// var f: number; +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// import f = require("[|foo|]"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "module", + "name": "module \"foo\"", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "contextSpan": { + "start": 0, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// declare module "/*FIND ALL REFS*/[|foo|]" { +// var f: number; +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// import f = require("[|foo|]"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "module", + "name": "module \"foo\"", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "contextSpan": { + "start": 0, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// /*FIND ALL REFS*/import [|f|] = require("foo"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "kind": "alias", + "name": "(alias) module \"foo\"\nimport f = require(\"foo\")", + "textSpan": { + "start": 7, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "f", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 0, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "contextSpan": { + "start": 0, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// declare module "[|foo|]" { +// var f: number; +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// import f = require("/*FIND ALL REFS*/[|foo|]"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "module", + "name": "module \"foo\"", + "textSpan": { + "start": 16, + "length": 3 + }, + "displayParts": [ + { + "text": "module", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "\"foo\"", + "kind": "stringLiteral" + } + ], + "contextSpan": { + "start": 0, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 20, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "contextSpan": { + "start": 0, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForFunctionOverloads.baseline.jsonc b/tests/baselines/reference/referencesForFunctionOverloads.baseline.jsonc new file mode 100644 index 00000000000..12dd6d6d292 --- /dev/null +++ b/tests/baselines/reference/referencesForFunctionOverloads.baseline.jsonc @@ -0,0 +1,564 @@ +// === /tests/cases/fourslash/referencesForFunctionOverloads.ts === +// /*FIND ALL REFS*/function [|foo|](x: string); +// function [|foo|](x: string, y: number) { +// [|foo|]('', 43); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "kind": "function", + "name": "function foo(x: string): any", + "textSpan": { + "start": 9, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 0, + "length": 24 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 34, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 25, + "length": 55 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 66, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForFunctionOverloads.ts === +// function /*FIND ALL REFS*/[|foo|](x: string); +// function [|foo|](x: string, y: number) { +// [|foo|]('', 43); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "kind": "function", + "name": "function foo(x: string): any", + "textSpan": { + "start": 9, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 0, + "length": 24 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 34, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 25, + "length": 55 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 66, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForFunctionOverloads.ts === +// function [|foo|](x: string); +// /*FIND ALL REFS*/function [|foo|](x: string, y: number) { +// [|foo|]('', 43); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "kind": "function", + "name": "function foo(x: string): any", + "textSpan": { + "start": 9, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 0, + "length": 24 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 34, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 25, + "length": 55 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 66, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForFunctionOverloads.ts === +// function [|foo|](x: string); +// function /*FIND ALL REFS*/[|foo|](x: string, y: number) { +// [|foo|]('', 43); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "kind": "function", + "name": "function foo(x: string): any", + "textSpan": { + "start": 9, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 0, + "length": 24 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 34, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 25, + "length": 55 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 66, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForFunctionOverloads.ts === +// function [|foo|](x: string); +// function [|foo|](x: string, y: number) { +// /*FIND ALL REFS*/[|foo|]('', 43); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "kind": "function", + "name": "function foo(x: string): any", + "textSpan": { + "start": 9, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 0, + "length": 24 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 34, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "contextSpan": { + "start": 25, + "length": 55 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 66, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionOverloads.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForFunctionParameter.baseline.jsonc b/tests/baselines/reference/referencesForFunctionParameter.baseline.jsonc new file mode 100644 index 00000000000..6c7703fc881 --- /dev/null +++ b/tests/baselines/reference/referencesForFunctionParameter.baseline.jsonc @@ -0,0 +1,287 @@ +// === /tests/cases/fourslash/referencesForFunctionParameter.ts === +// var x; +// var n; +// +// function n(x: number, /*FIND ALL REFS*/[|n|]: number) { +// [|n|] = 32; +// x = [|n|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "kind": "parameter", + "name": "(parameter) n: number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "n", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 37, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "contextSpan": { + "start": 37, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 54, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 70, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForFunctionParameter.ts === +// var x; +// var n; +// +// function n(x: number, [|n|]: number) { +// /*FIND ALL REFS*/[|n|] = 32; +// x = [|n|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "kind": "parameter", + "name": "(parameter) n: number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "n", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 37, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "contextSpan": { + "start": 37, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 54, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 70, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForFunctionParameter.ts === +// var x; +// var n; +// +// function n(x: number, [|n|]: number) { +// [|n|] = 32; +// x = /*FIND ALL REFS*/[|n|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "kind": "parameter", + "name": "(parameter) n: number", + "textSpan": { + "start": 37, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "n", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 37, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 37, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "contextSpan": { + "start": 37, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 54, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 70, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForFunctionParameter.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForGlobals.baseline.jsonc b/tests/baselines/reference/referencesForGlobals.baseline.jsonc new file mode 100644 index 00000000000..b7466bf6af2 --- /dev/null +++ b/tests/baselines/reference/referencesForGlobals.baseline.jsonc @@ -0,0 +1,554 @@ +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// /*FIND ALL REFS*/var [|global|] = 2; +// +// class foo { +// constructor (public global) { } +// public f(global) { } +// public f2(global) { } +// } +// +// class bar { +// constructor () { +// var n = [|global|]; +// +// var f = new foo(''); +// f.global = ''; +// } +// } +// +// var k = [|global|]; + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = [|global|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "var", + "name": "var global: number", + "textSpan": { + "start": 4, + "length": 6 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "global", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 15 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 15 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 168, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 246, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 8, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// var /*FIND ALL REFS*/[|global|] = 2; +// +// class foo { +// constructor (public global) { } +// public f(global) { } +// public f2(global) { } +// } +// +// class bar { +// constructor () { +// var n = [|global|]; +// +// var f = new foo(''); +// f.global = ''; +// } +// } +// +// var k = [|global|]; + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = [|global|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "var", + "name": "var global: number", + "textSpan": { + "start": 4, + "length": 6 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "global", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 15 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 15 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 168, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 246, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 8, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// var [|global|] = 2; +// +// class foo { +// constructor (public global) { } +// public f(global) { } +// public f2(global) { } +// } +// +// class bar { +// constructor () { +// var n = /*FIND ALL REFS*/[|global|]; +// +// var f = new foo(''); +// f.global = ''; +// } +// } +// +// var k = [|global|]; + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = [|global|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "var", + "name": "var global: number", + "textSpan": { + "start": 4, + "length": 6 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "global", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 15 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 15 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 168, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 246, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 8, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// var [|global|] = 2; +// +// class foo { +// constructor (public global) { } +// public f(global) { } +// public f2(global) { } +// } +// +// class bar { +// constructor () { +// var n = [|global|]; +// +// var f = new foo(''); +// f.global = ''; +// } +// } +// +// var k = /*FIND ALL REFS*/[|global|]; + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = [|global|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "var", + "name": "var global: number", + "textSpan": { + "start": 4, + "length": 6 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "global", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 15 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 15 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 168, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 246, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 8, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// var [|global|] = 2; +// +// class foo { +// constructor (public global) { } +// public f(global) { } +// public f2(global) { } +// } +// +// class bar { +// constructor () { +// var n = [|global|]; +// +// var f = new foo(''); +// f.global = ''; +// } +// } +// +// var k = [|global|]; + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = /*FIND ALL REFS*/[|global|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "var", + "name": "var global: number", + "textSpan": { + "start": 4, + "length": 6 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "global", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 15 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 15 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 168, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 246, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 8, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForGlobals2.baseline.jsonc b/tests/baselines/reference/referencesForGlobals2.baseline.jsonc new file mode 100644 index 00000000000..37bd74595d0 --- /dev/null +++ b/tests/baselines/reference/referencesForGlobals2.baseline.jsonc @@ -0,0 +1,197 @@ +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// /*FIND ALL REFS*/class [|globalClass|] { +// public f() { } +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var c = [|globalClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "class", + "name": "class globalClass", + "textSpan": { + "start": 6, + "length": 11 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 40 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 40 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// class /*FIND ALL REFS*/[|globalClass|] { +// public f() { } +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var c = [|globalClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "class", + "name": "class globalClass", + "textSpan": { + "start": 6, + "length": 11 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 40 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 40 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// class [|globalClass|] { +// public f() { } +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var c = /*FIND ALL REFS*/[|globalClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "class", + "name": "class globalClass", + "textSpan": { + "start": 6, + "length": 11 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 40 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 40 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForGlobals3.baseline.jsonc b/tests/baselines/reference/referencesForGlobals3.baseline.jsonc new file mode 100644 index 00000000000..4a3c4344f19 --- /dev/null +++ b/tests/baselines/reference/referencesForGlobals3.baseline.jsonc @@ -0,0 +1,197 @@ +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var i: [|globalInterface|]; + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// /*FIND ALL REFS*/interface [|globalInterface|] { +// f(); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "interface", + "name": "interface globalInterface", + "textSpan": { + "start": 10, + "length": 15 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalInterface", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 39 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 39 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 7, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var i: [|globalInterface|]; + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// interface /*FIND ALL REFS*/[|globalInterface|] { +// f(); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "interface", + "name": "interface globalInterface", + "textSpan": { + "start": 10, + "length": 15 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalInterface", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 39 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 39 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 7, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var i: /*FIND ALL REFS*/[|globalInterface|]; + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// interface [|globalInterface|] { +// f(); +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "interface", + "name": "interface globalInterface", + "textSpan": { + "start": 10, + "length": 15 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalInterface", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 39 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 39 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 7, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForGlobals4.baseline.jsonc b/tests/baselines/reference/referencesForGlobals4.baseline.jsonc new file mode 100644 index 00000000000..e910d96b43f --- /dev/null +++ b/tests/baselines/reference/referencesForGlobals4.baseline.jsonc @@ -0,0 +1,197 @@ +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// /*FIND ALL REFS*/module [|globalModule|] { +// export f() { }; +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = [|globalModule|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "module", + "name": "namespace globalModule", + "textSpan": { + "start": 7, + "length": 12 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 44 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 44 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// module /*FIND ALL REFS*/[|globalModule|] { +// export f() { }; +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = [|globalModule|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "module", + "name": "namespace globalModule", + "textSpan": { + "start": 7, + "length": 12 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 44 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 44 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// module [|globalModule|] { +// export f() { }; +// } + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = /*FIND ALL REFS*/[|globalModule|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "module", + "name": "namespace globalModule", + "textSpan": { + "start": 7, + "length": 12 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 44 + } + }, + "references": [ + { + "textSpan": { + "start": 7, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 0, + "length": 44 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForGlobals5.baseline.jsonc b/tests/baselines/reference/referencesForGlobals5.baseline.jsonc new file mode 100644 index 00000000000..a62a3d7986a --- /dev/null +++ b/tests/baselines/reference/referencesForGlobals5.baseline.jsonc @@ -0,0 +1,347 @@ +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = [|globalAlias|]; + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// module globalModule { +// export var x; +// } +// +// /*FIND ALL REFS*/import [|globalAlias|] = globalModule; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "alias", + "name": "(alias) namespace globalAlias\nimport globalAlias = globalModule", + "textSpan": { + "start": 50, + "length": 11 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalAlias", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalAlias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 43, + "length": 34 + } + }, + "references": [ + { + "textSpan": { + "start": 50, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 43, + "length": 34 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = [|globalAlias|]; + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// module globalModule { +// export var x; +// } +// +// import /*FIND ALL REFS*/[|globalAlias|] = globalModule; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "alias", + "name": "(alias) namespace globalAlias\nimport globalAlias = globalModule", + "textSpan": { + "start": 50, + "length": 11 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalAlias", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalAlias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 43, + "length": 34 + } + }, + "references": [ + { + "textSpan": { + "start": 50, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 43, + "length": 34 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobals_2.ts === +// var m = /*FIND ALL REFS*/[|globalAlias|]; + +// === /tests/cases/fourslash/referencesForGlobals_1.ts === +// module globalModule { +// export var x; +// } +// +// import [|globalAlias|] = globalModule; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "kind": "alias", + "name": "(alias) namespace globalAlias\nimport globalAlias = globalModule", + "textSpan": { + "start": 50, + "length": 11 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalAlias", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalAlias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 43, + "length": 34 + } + }, + "references": [ + { + "textSpan": { + "start": 50, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_1.ts", + "contextSpan": { + "start": 43, + "length": 34 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 8, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobals_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForGlobalsInExternalModule.baseline.jsonc b/tests/baselines/reference/referencesForGlobalsInExternalModule.baseline.jsonc new file mode 100644 index 00000000000..81a9c5a15f8 --- /dev/null +++ b/tests/baselines/reference/referencesForGlobalsInExternalModule.baseline.jsonc @@ -0,0 +1,935 @@ +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// /*FIND ALL REFS*/var [|topLevelVar|] = 2; +// var topLevelVar2 = [|topLevelVar|]; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "var", + "name": "var topLevelVar: number", + "textSpan": { + "start": 4, + "length": 11 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 20 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 0, + "length": 20 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var /*FIND ALL REFS*/[|topLevelVar|] = 2; +// var topLevelVar2 = [|topLevelVar|]; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "var", + "name": "var topLevelVar: number", + "textSpan": { + "start": 4, + "length": 11 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 20 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 0, + "length": 20 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var [|topLevelVar|] = 2; +// var topLevelVar2 = /*FIND ALL REFS*/[|topLevelVar|]; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "var", + "name": "var topLevelVar: number", + "textSpan": { + "start": 4, + "length": 11 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 20 + } + }, + "references": [ + { + "textSpan": { + "start": 4, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 0, + "length": 20 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 40, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// /*FIND ALL REFS*/class [|topLevelClass|] { } +// var c = new [|topLevelClass|](); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "class", + "name": "class topLevelClass", + "textSpan": { + "start": 60, + "length": 13 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 54, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 60, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 54, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 90, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// class /*FIND ALL REFS*/[|topLevelClass|] { } +// var c = new [|topLevelClass|](); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "class", + "name": "class topLevelClass", + "textSpan": { + "start": 60, + "length": 13 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 54, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 60, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 54, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 90, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// class [|topLevelClass|] { } +// var c = new /*FIND ALL REFS*/[|topLevelClass|](); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "class", + "name": "class topLevelClass", + "textSpan": { + "start": 60, + "length": 13 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 54, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 60, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 54, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 90, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// /*FIND ALL REFS*/interface [|topLevelInterface|] { } +// var i: [|topLevelInterface|]; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "interface", + "name": "interface topLevelInterface", + "textSpan": { + "start": 118, + "length": 17 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelInterface", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 108, + "length": 31 + } + }, + "references": [ + { + "textSpan": { + "start": 118, + "length": 17 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 108, + "length": 31 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 147, + "length": 17 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// interface /*FIND ALL REFS*/[|topLevelInterface|] { } +// var i: [|topLevelInterface|]; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "interface", + "name": "interface topLevelInterface", + "textSpan": { + "start": 118, + "length": 17 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelInterface", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 108, + "length": 31 + } + }, + "references": [ + { + "textSpan": { + "start": 118, + "length": 17 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 108, + "length": 31 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 147, + "length": 17 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// interface [|topLevelInterface|] { } +// var i: /*FIND ALL REFS*/[|topLevelInterface|]; +// +// module topLevelModule { +// export var x; +// } +// var x = topLevelModule.x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "interface", + "name": "interface topLevelInterface", + "textSpan": { + "start": 118, + "length": 17 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelInterface", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 108, + "length": 31 + } + }, + "references": [ + { + "textSpan": { + "start": 118, + "length": 17 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 108, + "length": 31 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 147, + "length": 17 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// /*FIND ALL REFS*/module [|topLevelModule|] { +// export var x; +// } +// var x = [|topLevelModule|].x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "module", + "name": "namespace topLevelModule", + "textSpan": { + "start": 174, + "length": 14 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 167, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 174, + "length": 14 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 167, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 219, + "length": 14 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// module /*FIND ALL REFS*/[|topLevelModule|] { +// export var x; +// } +// var x = [|topLevelModule|].x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "module", + "name": "namespace topLevelModule", + "textSpan": { + "start": 174, + "length": 14 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 167, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 174, + "length": 14 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 167, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 219, + "length": 14 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForGlobalsInExternalModule.ts === +// var topLevelVar = 2; +// var topLevelVar2 = topLevelVar; +// +// class topLevelClass { } +// var c = new topLevelClass(); +// +// interface topLevelInterface { } +// var i: topLevelInterface; +// +// module [|topLevelModule|] { +// export var x; +// } +// var x = /*FIND ALL REFS*/[|topLevelModule|].x; +// +// export = x; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "kind": "module", + "name": "namespace topLevelModule", + "textSpan": { + "start": 174, + "length": 14 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "topLevelModule", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 167, + "length": 43 + } + }, + "references": [ + { + "textSpan": { + "start": 174, + "length": 14 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "contextSpan": { + "start": 167, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 219, + "length": 14 + }, + "fileName": "/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForImports.baseline.jsonc b/tests/baselines/reference/referencesForImports.baseline.jsonc new file mode 100644 index 00000000000..b2b3cf6e0b6 --- /dev/null +++ b/tests/baselines/reference/referencesForImports.baseline.jsonc @@ -0,0 +1,456 @@ +// === /tests/cases/fourslash/referencesForImports.ts === +// declare module "jquery" { +// function $(s: string): any; +// export = $; +// } +// /*FIND ALL REFS*/import [|$|] = require("jquery"); +// [|$|]("a"); +// import $ = require("jquery"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "kind": "alias", + "name": "import $ = require(\"jquery\")", + "textSpan": { + "start": 83, + "length": 1 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "$", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"jquery\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 76, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "contextSpan": { + "start": 76, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 106, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForImports.ts === +// declare module "jquery" { +// function $(s: string): any; +// export = $; +// } +// import /*FIND ALL REFS*/[|$|] = require("jquery"); +// [|$|]("a"); +// import $ = require("jquery"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "kind": "alias", + "name": "import $ = require(\"jquery\")", + "textSpan": { + "start": 83, + "length": 1 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "$", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"jquery\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 76, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "contextSpan": { + "start": 76, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 106, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForImports.ts === +// declare module "jquery" { +// function $(s: string): any; +// export = $; +// } +// import [|$|] = require("jquery"); +// /*FIND ALL REFS*/[|$|]("a"); +// import $ = require("jquery"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "kind": "alias", + "name": "import $ = require(\"jquery\")", + "textSpan": { + "start": 83, + "length": 1 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "$", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"jquery\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 76, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 83, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "contextSpan": { + "start": 76, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 106, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForImports.ts === +// declare module "jquery" { +// function $(s: string): any; +// export = $; +// } +// import $ = require("jquery"); +// $("a"); +// /*FIND ALL REFS*/import [|$|] = require("jquery"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "kind": "alias", + "name": "import $ = require(\"jquery\")", + "textSpan": { + "start": 121, + "length": 1 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "$", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"jquery\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 114, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 121, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "contextSpan": { + "start": 114, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/referencesForImports.ts === +// declare module "jquery" { +// function $(s: string): any; +// export = $; +// } +// import $ = require("jquery"); +// $("a"); +// import /*FIND ALL REFS*/[|$|] = require("jquery"); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "kind": "alias", + "name": "import $ = require(\"jquery\")", + "textSpan": { + "start": 121, + "length": 1 + }, + "displayParts": [ + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "$", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "require", + "kind": "keyword" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "\"jquery\"", + "kind": "stringLiteral" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 114, + "length": 29 + } + }, + "references": [ + { + "textSpan": { + "start": 121, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesForImports.ts", + "contextSpan": { + "start": 114, + "length": 29 + }, + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForIndexProperty.baseline.jsonc b/tests/baselines/reference/referencesForIndexProperty.baseline.jsonc new file mode 100644 index 00000000000..968f8c17d64 --- /dev/null +++ b/tests/baselines/reference/referencesForIndexProperty.baseline.jsonc @@ -0,0 +1,399 @@ +// === /tests/cases/fourslash/referencesForIndexProperty.ts === +// class Foo { +// /*FIND ALL REFS*/[|property|]: number; +// method(): void { } +// } +// +// var f: Foo; +// f["[|property|]"]; +// f["method"]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "kind": "property", + "name": "(property) Foo.property: number", + "textSpan": { + "start": 16, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "contextSpan": { + "start": 16, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForIndexProperty.ts === +// class Foo { +// property: number; +// /*FIND ALL REFS*/[|method|](): void { } +// } +// +// var f: Foo; +// f["property"]; +// f["[|method|]"]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "kind": "method", + "name": "(method) Foo.method(): void", + "textSpan": { + "start": 38, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 38, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 38, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "contextSpan": { + "start": 38, + "length": 18 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 90, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForIndexProperty.ts === +// class Foo { +// [|property|]: number; +// method(): void { } +// } +// +// var f: Foo; +// f["/*FIND ALL REFS*/[|property|]"]; +// f["method"]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "kind": "property", + "name": "(property) Foo.property: number", + "textSpan": { + "start": 16, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 16, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "contextSpan": { + "start": 16, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForIndexProperty.ts === +// class Foo { +// property: number; +// [|method|](): void { } +// } +// +// var f: Foo; +// f["property"]; +// f["/*FIND ALL REFS*/[|method|]"]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "kind": "method", + "name": "(method) Foo.method(): void", + "textSpan": { + "start": 38, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 38, + "length": 18 + } + }, + "references": [ + { + "textSpan": { + "start": 38, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "contextSpan": { + "start": 38, + "length": 18 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 90, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForIndexProperty2.baseline.jsonc b/tests/baselines/reference/referencesForIndexProperty2.baseline.jsonc new file mode 100644 index 00000000000..dda52b1615f --- /dev/null +++ b/tests/baselines/reference/referencesForIndexProperty2.baseline.jsonc @@ -0,0 +1,37 @@ +// === /tests/cases/fourslash/referencesForIndexProperty2.ts === +// var a; +// a["/*FIND ALL REFS*/[|blah|]"]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForIndexProperty2.ts", + "kind": "var", + "name": "blah", + "textSpan": { + "start": 10, + "length": 4 + }, + "displayParts": [ + { + "text": "\"blah\"", + "kind": "stringLiteral" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty2.ts", + "isWriteAccess": false, + "isDefinition": false, + "isInString": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForIndexProperty3.baseline.jsonc b/tests/baselines/reference/referencesForIndexProperty3.baseline.jsonc new file mode 100644 index 00000000000..f1d3d574795 --- /dev/null +++ b/tests/baselines/reference/referencesForIndexProperty3.baseline.jsonc @@ -0,0 +1,341 @@ +// === /tests/cases/fourslash/referencesForIndexProperty3.ts === +// interface Object { +// /*FIND ALL REFS*/[|toMyString|](); +// } +// +// var y: Object; +// y.[|toMyString|](); +// +// var x = {}; +// x["[|toMyString|]"](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "kind": "method", + "name": "(method) Object.toMyString(): any", + "textSpan": { + "start": 23, + "length": 10 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "toMyString", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 23, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "contextSpan": { + "start": 23, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 57, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 87, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForIndexProperty3.ts === +// interface Object { +// [|toMyString|](); +// } +// +// var y: Object; +// y./*FIND ALL REFS*/[|toMyString|](); +// +// var x = {}; +// x["[|toMyString|]"](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "kind": "method", + "name": "(method) Object.toMyString(): any", + "textSpan": { + "start": 23, + "length": 10 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "toMyString", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 23, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "contextSpan": { + "start": 23, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 57, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 87, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForIndexProperty3.ts === +// interface Object { +// [|toMyString|](); +// } +// +// var y: Object; +// y.[|toMyString|](); +// +// var x = {}; +// x["/*FIND ALL REFS*/[|toMyString|]"](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "kind": "method", + "name": "(method) Object.toMyString(): any", + "textSpan": { + "start": 23, + "length": 10 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Object", + "kind": "localName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "toMyString", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 23, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "contextSpan": { + "start": 23, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 57, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 87, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/referencesForIndexProperty3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForInheritedProperties3.baseline.jsonc b/tests/baselines/reference/referencesForInheritedProperties3.baseline.jsonc new file mode 100644 index 00000000000..cdb7a705b33 --- /dev/null +++ b/tests/baselines/reference/referencesForInheritedProperties3.baseline.jsonc @@ -0,0 +1,399 @@ +// === /tests/cases/fourslash/referencesForInheritedProperties3.ts === +// interface interface1 extends interface1 { +// /*FIND ALL REFS*/[|doStuff|](): void; +// propName: string; +// } +// +// var v: interface1; +// v.propName; +// v.[|doStuff|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "kind": "method", + "name": "(method) interface1.doStuff(): void", + "textSpan": { + "start": 45, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "interface1", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doStuff", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 45, + "length": 16 + } + }, + "references": [ + { + "textSpan": { + "start": 45, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "contextSpan": { + "start": 45, + "length": 16 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 119, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForInheritedProperties3.ts === +// interface interface1 extends interface1 { +// doStuff(): void; +// /*FIND ALL REFS*/[|propName|]: string; +// } +// +// var v: interface1; +// v.[|propName|]; +// v.doStuff(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "kind": "property", + "name": "(property) interface1.propName: string", + "textSpan": { + "start": 65, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "interface1", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "propName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 65, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 65, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "contextSpan": { + "start": 65, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 107, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForInheritedProperties3.ts === +// interface interface1 extends interface1 { +// doStuff(): void; +// [|propName|]: string; +// } +// +// var v: interface1; +// v./*FIND ALL REFS*/[|propName|]; +// v.doStuff(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "kind": "property", + "name": "(property) interface1.propName: string", + "textSpan": { + "start": 65, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "interface1", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "propName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 65, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 65, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "contextSpan": { + "start": 65, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 107, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForInheritedProperties3.ts === +// interface interface1 extends interface1 { +// [|doStuff|](): void; +// propName: string; +// } +// +// var v: interface1; +// v.propName; +// v./*FIND ALL REFS*/[|doStuff|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "kind": "method", + "name": "(method) interface1.doStuff(): void", + "textSpan": { + "start": 45, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "interface1", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doStuff", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 45, + "length": 16 + } + }, + "references": [ + { + "textSpan": { + "start": 45, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "contextSpan": { + "start": 45, + "length": 16 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 119, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForInheritedProperties4.baseline.jsonc b/tests/baselines/reference/referencesForInheritedProperties4.baseline.jsonc new file mode 100644 index 00000000000..48d1fc5b7bf --- /dev/null +++ b/tests/baselines/reference/referencesForInheritedProperties4.baseline.jsonc @@ -0,0 +1,399 @@ +// === /tests/cases/fourslash/referencesForInheritedProperties4.ts === +// class class1 extends class1 { +// /*FIND ALL REFS*/[|doStuff|]() { } +// propName: string; +// } +// +// var c: class1; +// c.[|doStuff|](); +// c.propName; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "kind": "method", + "name": "(method) class1.doStuff(): void", + "textSpan": { + "start": 33, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class1", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doStuff", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "contextSpan": { + "start": 33, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 88, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForInheritedProperties4.ts === +// class class1 extends class1 { +// doStuff() { } +// /*FIND ALL REFS*/[|propName|]: string; +// } +// +// var c: class1; +// c.doStuff(); +// c.[|propName|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "kind": "property", + "name": "(property) class1.propName: string", + "textSpan": { + "start": 50, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class1", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "propName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 50, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 50, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "contextSpan": { + "start": 50, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 101, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForInheritedProperties4.ts === +// class class1 extends class1 { +// [|doStuff|]() { } +// propName: string; +// } +// +// var c: class1; +// c./*FIND ALL REFS*/[|doStuff|](); +// c.propName; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "kind": "method", + "name": "(method) class1.doStuff(): void", + "textSpan": { + "start": 33, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class1", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doStuff", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 33, + "length": 13 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "contextSpan": { + "start": 33, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 88, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForInheritedProperties4.ts === +// class class1 extends class1 { +// doStuff() { } +// [|propName|]: string; +// } +// +// var c: class1; +// c.doStuff(); +// c./*FIND ALL REFS*/[|propName|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "kind": "property", + "name": "(property) class1.propName: string", + "textSpan": { + "start": 50, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "class1", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "propName", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 50, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 50, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "contextSpan": { + "start": 50, + "length": 17 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 101, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForInheritedProperties9.baseline.jsonc b/tests/baselines/reference/referencesForInheritedProperties9.baseline.jsonc new file mode 100644 index 00000000000..8cf3bf75255 --- /dev/null +++ b/tests/baselines/reference/referencesForInheritedProperties9.baseline.jsonc @@ -0,0 +1,284 @@ +// === /tests/cases/fourslash/referencesForInheritedProperties9.ts === +// class D extends C { +// /*FIND ALL REFS*/[|prop1|]: string; +// } +// +// class C extends D { +// prop1: string; +// } +// +// var c: C; +// c.prop1; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties9.ts", + "kind": "property", + "name": "(property) D.prop1: string", + "textSpan": { + "start": 24, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "D", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 24, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties9.ts", + "contextSpan": { + "start": 24, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + } + ] + } +] + +// === /tests/cases/fourslash/referencesForInheritedProperties9.ts === +// class D extends C { +// prop1: string; +// } +// +// class C extends D { +// /*FIND ALL REFS*/[|prop1|]: string; +// } +// +// var c: C; +// c.[|prop1|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties9.ts", + "kind": "property", + "name": "(property) C.prop1: string", + "textSpan": { + "start": 66, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 66, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 66, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties9.ts", + "contextSpan": { + "start": 66, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 96, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties9.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForInheritedProperties9.ts === +// class D extends C { +// prop1: string; +// } +// +// class C extends D { +// [|prop1|]: string; +// } +// +// var c: C; +// c./*FIND ALL REFS*/[|prop1|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties9.ts", + "kind": "property", + "name": "(property) C.prop1: string", + "textSpan": { + "start": 66, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "prop1", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 66, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 66, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties9.ts", + "contextSpan": { + "start": 66, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 96, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForInheritedProperties9.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForLabel.baseline.jsonc b/tests/baselines/reference/referencesForLabel.baseline.jsonc new file mode 100644 index 00000000000..db4be2bb414 --- /dev/null +++ b/tests/baselines/reference/referencesForLabel.baseline.jsonc @@ -0,0 +1,265 @@ +// === /tests/cases/fourslash/referencesForLabel.ts === +// /*FIND ALL REFS*/[|label|]: while (true) { +// if (false) break [|label|]; +// if (true) continue [|label|]; +// } +// +// label: while (false) { } +// var label = "label"; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 0, + "length": 81 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 43, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 37, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 73, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 64, + "length": 15 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/referencesForLabel.ts === +// [|label|]: while (true) { +// if (false) break /*FIND ALL REFS*/[|label|]; +// if (true) continue [|label|]; +// } +// +// label: while (false) { } +// var label = "label"; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 0, + "length": 81 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 43, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 37, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 73, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 64, + "length": 15 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/referencesForLabel.ts === +// [|label|]: while (true) { +// if (false) break [|label|]; +// if (true) continue /*FIND ALL REFS*/[|label|]; +// } +// +// label: while (false) { } +// var label = "label"; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 0, + "length": 81 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 43, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 37, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 73, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 64, + "length": 15 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForLabel.ts === +// label: while (true) { +// if (false) break label; +// if (true) continue label; +// } +// +// /*FIND ALL REFS*/[|label|]: while (false) { } +// var label = "label"; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 83, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 83, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel.ts", + "contextSpan": { + "start": 83, + "length": 24 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForLabel3.baseline.jsonc b/tests/baselines/reference/referencesForLabel3.baseline.jsonc new file mode 100644 index 00000000000..4b6fa88c060 --- /dev/null +++ b/tests/baselines/reference/referencesForLabel3.baseline.jsonc @@ -0,0 +1,41 @@ +// === /tests/cases/fourslash/referencesForLabel3.ts === +// /*FIND ALL REFS*/[|label|]: while (true) { +// var label = "label"; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel3.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel3.ts", + "contextSpan": { + "start": 0, + "length": 48 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForLabel4.baseline.jsonc b/tests/baselines/reference/referencesForLabel4.baseline.jsonc new file mode 100644 index 00000000000..e6a2a18e55f --- /dev/null +++ b/tests/baselines/reference/referencesForLabel4.baseline.jsonc @@ -0,0 +1,115 @@ +// === /tests/cases/fourslash/referencesForLabel4.ts === +// /*FIND ALL REFS*/[|label|]: function foo(label) { +// while (true) { +// break [|label|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel4.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel4.ts", + "contextSpan": { + "start": 0, + "length": 76 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 62, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel4.ts", + "contextSpan": { + "start": 56, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/referencesForLabel4.ts === +// [|label|]: function foo(label) { +// while (true) { +// break /*FIND ALL REFS*/[|label|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel4.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel4.ts", + "contextSpan": { + "start": 0, + "length": 76 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 62, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel4.ts", + "contextSpan": { + "start": 56, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForLabel5.baseline.jsonc b/tests/baselines/reference/referencesForLabel5.baseline.jsonc new file mode 100644 index 00000000000..43e99c8f3b4 --- /dev/null +++ b/tests/baselines/reference/referencesForLabel5.baseline.jsonc @@ -0,0 +1,349 @@ +// === /tests/cases/fourslash/referencesForLabel5.ts === +// /*FIND ALL REFS*/[|label|]: while (true) { +// if (false) break [|label|]; +// function blah() { +// label: while (true) { +// if (false) break label; +// } +// } +// if (false) break [|label|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 0, + "length": 241 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 52, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 46, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 225, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 219, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/referencesForLabel5.ts === +// [|label|]: while (true) { +// if (false) break /*FIND ALL REFS*/[|label|]; +// function blah() { +// label: while (true) { +// if (false) break label; +// } +// } +// if (false) break [|label|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 0, + "length": 241 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 52, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 46, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 225, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 219, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForLabel5.ts === +// label: while (true) { +// if (false) break label; +// function blah() { +// /*FIND ALL REFS*/[|label|]: while (true) { +// if (false) break [|label|]; +// } +// } +// if (false) break label; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 89, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 89, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 89, + "length": 92 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 157, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 151, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/referencesForLabel5.ts === +// label: while (true) { +// if (false) break label; +// function blah() { +// [|label|]: while (true) { +// if (false) break /*FIND ALL REFS*/[|label|]; +// } +// } +// if (false) break label; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 89, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 89, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 89, + "length": 92 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 157, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 151, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/referencesForLabel5.ts === +// [|label|]: while (true) { +// if (false) break [|label|]; +// function blah() { +// label: while (true) { +// if (false) break label; +// } +// } +// if (false) break /*FIND ALL REFS*/[|label|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "kind": "label", + "name": "label", + "textSpan": { + "start": 0, + "length": 5 + }, + "displayParts": [ + { + "text": "label", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 0, + "length": 241 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 52, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 46, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 225, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel5.ts", + "contextSpan": { + "start": 219, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForLabel6.baseline.jsonc b/tests/baselines/reference/referencesForLabel6.baseline.jsonc new file mode 100644 index 00000000000..22d958e0d3d --- /dev/null +++ b/tests/baselines/reference/referencesForLabel6.baseline.jsonc @@ -0,0 +1,156 @@ +// === /tests/cases/fourslash/referencesForLabel6.ts === +// /*FIND ALL REFS*/[|labela|]: while (true) { +// labelb: while (false) { break labelb; } +// break labelc; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel6.ts", + "kind": "label", + "name": "labela", + "textSpan": { + "start": 0, + "length": 6 + }, + "displayParts": [ + { + "text": "labela", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 0, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel6.ts", + "contextSpan": { + "start": 0, + "length": 94 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForLabel6.ts === +// labela: while (true) { +// /*FIND ALL REFS*/[|labelb|]: while (false) { break [|labelb|]; } +// break labelc; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel6.ts", + "kind": "label", + "name": "labelb", + "textSpan": { + "start": 23, + "length": 6 + }, + "displayParts": [ + { + "text": "labelb", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel6.ts", + "contextSpan": { + "start": 23, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 57, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel6.ts", + "contextSpan": { + "start": 51, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/referencesForLabel6.ts === +// labela: while (true) { +// [|labelb|]: while (false) { break /*FIND ALL REFS*/[|labelb|]; } +// break labelc; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForLabel6.ts", + "kind": "label", + "name": "labelb", + "textSpan": { + "start": 23, + "length": 6 + }, + "displayParts": [ + { + "text": "labelb", + "kind": "text" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 23, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel6.ts", + "contextSpan": { + "start": 23, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 57, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/referencesForLabel6.ts", + "contextSpan": { + "start": 51, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForMergedDeclarations.baseline.jsonc b/tests/baselines/reference/referencesForMergedDeclarations.baseline.jsonc new file mode 100644 index 00000000000..392daae97fe --- /dev/null +++ b/tests/baselines/reference/referencesForMergedDeclarations.baseline.jsonc @@ -0,0 +1,812 @@ +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// /*FIND ALL REFS*/interface [|Foo|] { +// } +// +// module Foo { +// export interface Bar { } +// } +// +// function Foo(): void { +// } +// +// var f1: Foo.Bar; +// var f2: [|Foo|]; +// Foo.bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "interface Foo\nnamespace Foo", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 0, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 115, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// interface /*FIND ALL REFS*/[|Foo|] { +// } +// +// module Foo { +// export interface Bar { } +// } +// +// function Foo(): void { +// } +// +// var f1: Foo.Bar; +// var f2: [|Foo|]; +// Foo.bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "interface Foo\nnamespace Foo", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 0, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 115, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// interface Foo { +// } +// +// /*FIND ALL REFS*/module [|Foo|] { +// export interface Bar { } +// } +// +// function Foo(): void { +// } +// +// var f1: [|Foo|].Bar; +// var f2: Foo; +// Foo.bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "namespace Foo", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 19, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 98, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// interface Foo { +// } +// +// module /*FIND ALL REFS*/[|Foo|] { +// export interface Bar { } +// } +// +// function Foo(): void { +// } +// +// var f1: [|Foo|].Bar; +// var f2: Foo; +// Foo.bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "namespace Foo", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 19, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 98, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// interface Foo { +// } +// +// module Foo { +// export interface Bar { } +// } +// +// /*FIND ALL REFS*/function [|Foo|](): void { +// } +// +// var f1: Foo.Bar; +// var f2: Foo; +// [|Foo|].bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "namespace Foo\nfunction Foo(): void", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 73, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 64, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// interface Foo { +// } +// +// module Foo { +// export interface Bar { } +// } +// +// function /*FIND ALL REFS*/[|Foo|](): void { +// } +// +// var f1: Foo.Bar; +// var f2: Foo; +// [|Foo|].bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "namespace Foo\nfunction Foo(): void", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 73, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 64, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// interface Foo { +// } +// +// module [|Foo|] { +// export interface Bar { } +// } +// +// function Foo(): void { +// } +// +// var f1: /*FIND ALL REFS*/[|Foo|].Bar; +// var f2: Foo; +// Foo.bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "namespace Foo", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 26, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 19, + "length": 43 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 98, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// interface [|Foo|] { +// } +// +// module Foo { +// export interface Bar { } +// } +// +// function Foo(): void { +// } +// +// var f1: Foo.Bar; +// var f2: /*FIND ALL REFS*/[|Foo|]; +// Foo.bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "interface Foo\nnamespace Foo", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "interface", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 0, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 115, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations.ts === +// interface Foo { +// } +// +// module Foo { +// export interface Bar { } +// } +// +// function [|Foo|](): void { +// } +// +// var f1: Foo.Bar; +// var f2: Foo; +// /*FIND ALL REFS*/[|Foo|].bind(this); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "kind": "function", + "name": "namespace Foo\nfunction Foo(): void", + "textSpan": { + "start": 73, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 64, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 73, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "contextSpan": { + "start": 64, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 120, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForMergedDeclarations2.baseline.jsonc b/tests/baselines/reference/referencesForMergedDeclarations2.baseline.jsonc new file mode 100644 index 00000000000..9119bb3ab14 --- /dev/null +++ b/tests/baselines/reference/referencesForMergedDeclarations2.baseline.jsonc @@ -0,0 +1,715 @@ +// === /tests/cases/fourslash/referencesForMergedDeclarations2.ts === +// module ATest { +// export interface Bar { } +// } +// +// function ATest() { } +// +// /*FIND ALL REFS*/import [|alias|] = ATest; // definition +// +// var a: [|alias|].Bar; // namespace +// [|alias|].call(this); // value + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "kind": "alias", + "name": "(alias) function alias(): void\n(alias) namespace alias\nimport alias = ATest", + "textSpan": { + "start": 76, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ATest", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 69, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 76, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "contextSpan": { + "start": 69, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 113, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 137, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations2.ts === +// module ATest { +// export interface Bar { } +// } +// +// function ATest() { } +// +// import /*FIND ALL REFS*/[|alias|] = ATest; // definition +// +// var a: [|alias|].Bar; // namespace +// [|alias|].call(this); // value + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "kind": "alias", + "name": "(alias) function alias(): void\n(alias) namespace alias\nimport alias = ATest", + "textSpan": { + "start": 76, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ATest", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 69, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 76, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "contextSpan": { + "start": 69, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 113, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 137, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations2.ts === +// module ATest { +// export interface Bar { } +// } +// +// function ATest() { } +// +// import [|alias|] = ATest; // definition +// +// var a: /*FIND ALL REFS*/[|alias|].Bar; // namespace +// [|alias|].call(this); // value + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "kind": "alias", + "name": "(alias) function alias(): void\n(alias) namespace alias\nimport alias = ATest", + "textSpan": { + "start": 76, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ATest", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 69, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 76, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "contextSpan": { + "start": 69, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 113, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 137, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations2.ts === +// module ATest { +// export interface Bar { } +// } +// +// function ATest() { } +// +// import [|alias|] = ATest; // definition +// +// var a: [|alias|].Bar; // namespace +// /*FIND ALL REFS*/[|alias|].call(this); // value + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "kind": "alias", + "name": "(alias) function alias(): void\n(alias) namespace alias\nimport alias = ATest", + "textSpan": { + "start": 76, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "alias", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "import", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "alias", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ATest", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 69, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 76, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "contextSpan": { + "start": 69, + "length": 21 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 113, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 137, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForMergedDeclarations4.baseline.jsonc b/tests/baselines/reference/referencesForMergedDeclarations4.baseline.jsonc new file mode 100644 index 00000000000..b4ae4cb8253 --- /dev/null +++ b/tests/baselines/reference/referencesForMergedDeclarations4.baseline.jsonc @@ -0,0 +1,1781 @@ +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// /*FIND ALL REFS*/class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class /*FIND ALL REFS*/[|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// /*FIND ALL REFS*/module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module /*FIND ALL REFS*/[|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: /*FIND ALL REFS*/[|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: /*FIND ALL REFS*/[|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// /*FIND ALL REFS*/[|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// /*FIND ALL REFS*/[|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// /*FIND ALL REFS*/[|testClass|].bind(this); +// [|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// /*FIND ALL REFS*/[|testClass|].s; +// new [|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations4.ts === +// class [|testClass|] { +// static staticMethod() { } +// method() { } +// } +// +// module [|testClass|] { +// export interface Bar { +// +// } +// export var s = 0; +// } +// +// var c1: [|testClass|]; +// var c2: [|testClass|].Bar; +// [|testClass|].staticMethod(); +// [|testClass|].prototype.method(); +// [|testClass|].bind(this); +// [|testClass|].s; +// new /*FIND ALL REFS*/[|testClass|](); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "kind": "class", + "name": "class testClass\nnamespace testClass", + "textSpan": { + "start": 6, + "length": 9 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "testClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 0, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 6, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 0, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 75, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "contextSpan": { + "start": 68, + "length": 76 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 154, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 173, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 188, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 214, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 244, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 283, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations4.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForMergedDeclarations6.baseline.jsonc b/tests/baselines/reference/referencesForMergedDeclarations6.baseline.jsonc new file mode 100644 index 00000000000..66e1d83b09b --- /dev/null +++ b/tests/baselines/reference/referencesForMergedDeclarations6.baseline.jsonc @@ -0,0 +1,206 @@ +// === /tests/cases/fourslash/referencesForMergedDeclarations6.ts === +// interface Foo { } +// /*FIND ALL REFS*/module [|Foo|] { +// export interface Bar { } +// export module Bar { export interface Baz { } } +// export function Bar() { } +// } +// +// // module +// import a1 = [|Foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "kind": "interface", + "name": "namespace Foo", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 25, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "contextSpan": { + "start": 18, + "length": 124 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 166, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations6.ts === +// interface Foo { } +// module /*FIND ALL REFS*/[|Foo|] { +// export interface Bar { } +// export module Bar { export interface Baz { } } +// export function Bar() { } +// } +// +// // module +// import a1 = [|Foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "kind": "interface", + "name": "namespace Foo", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 25, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "contextSpan": { + "start": 18, + "length": 124 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 166, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations6.ts === +// interface Foo { } +// module [|Foo|] { +// export interface Bar { } +// export module Bar { export interface Baz { } } +// export function Bar() { } +// } +// +// // module +// import a1 = /*FIND ALL REFS*/[|Foo|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "kind": "interface", + "name": "namespace Foo", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 0, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 25, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "contextSpan": { + "start": 18, + "length": 124 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 166, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations6.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForMergedDeclarations8.baseline.jsonc b/tests/baselines/reference/referencesForMergedDeclarations8.baseline.jsonc new file mode 100644 index 00000000000..22affb2396b --- /dev/null +++ b/tests/baselines/reference/referencesForMergedDeclarations8.baseline.jsonc @@ -0,0 +1,230 @@ +// === /tests/cases/fourslash/referencesForMergedDeclarations8.ts === +// interface Foo { } +// module Foo { +// export interface Bar { } +// /*FIND ALL REFS*/export module [|Bar|] { export interface Baz { } } +// export function Bar() { } +// } +// +// // module +// import a3 = Foo.[|Bar|].Baz; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "kind": "function", + "name": "namespace Foo.Bar", + "textSpan": { + "start": 131, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Bar", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 115, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 78, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "contextSpan": { + "start": 64, + "length": 46 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 170, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations8.ts === +// interface Foo { } +// module Foo { +// export interface Bar { } +// export module /*FIND ALL REFS*/[|Bar|] { export interface Baz { } } +// export function Bar() { } +// } +// +// // module +// import a3 = Foo.[|Bar|].Baz; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "kind": "function", + "name": "namespace Foo.Bar", + "textSpan": { + "start": 131, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Bar", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 115, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 78, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "contextSpan": { + "start": 64, + "length": 46 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 170, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForMergedDeclarations8.ts === +// interface Foo { } +// module Foo { +// export interface Bar { } +// export module [|Bar|] { export interface Baz { } } +// export function Bar() { } +// } +// +// // module +// import a3 = Foo./*FIND ALL REFS*/[|Bar|].Baz; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "kind": "function", + "name": "namespace Foo.Bar", + "textSpan": { + "start": 131, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Bar", + "kind": "functionName" + } + ], + "contextSpan": { + "start": 115, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 78, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "contextSpan": { + "start": 64, + "length": 46 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 170, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForMergedDeclarations8.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForObjectLiteralProperties.baseline.jsonc b/tests/baselines/reference/referencesForObjectLiteralProperties.baseline.jsonc new file mode 100644 index 00000000000..5138a542032 --- /dev/null +++ b/tests/baselines/reference/referencesForObjectLiteralProperties.baseline.jsonc @@ -0,0 +1,411 @@ +// === /tests/cases/fourslash/referencesForObjectLiteralProperties.ts === +// var x = { /*FIND ALL REFS*/[|add|]: 0, b: "string" }; +// x["[|add|]"]; +// x.[|add|]; +// var y = x; +// y.[|add|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "kind": "property", + "name": "(property) add: number", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "add", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 6 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "contextSpan": { + "start": 10, + "length": 6 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 36, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 45, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 63, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForObjectLiteralProperties.ts === +// var x = { [|add|]: 0, b: "string" }; +// x["/*FIND ALL REFS*/[|add|]"]; +// x.[|add|]; +// var y = x; +// y.[|add|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "kind": "property", + "name": "(property) add: number", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "add", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 6 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "contextSpan": { + "start": 10, + "length": 6 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 36, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 45, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 63, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForObjectLiteralProperties.ts === +// var x = { [|add|]: 0, b: "string" }; +// x["[|add|]"]; +// x./*FIND ALL REFS*/[|add|]; +// var y = x; +// y.[|add|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "kind": "property", + "name": "(property) add: number", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "add", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 6 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "contextSpan": { + "start": 10, + "length": 6 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 36, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 45, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 63, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForObjectLiteralProperties.ts === +// var x = { [|add|]: 0, b: "string" }; +// x["[|add|]"]; +// x.[|add|]; +// var y = x; +// y./*FIND ALL REFS*/[|add|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "kind": "property", + "name": "(property) add: number", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "add", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 10, + "length": 6 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "contextSpan": { + "start": 10, + "length": 6 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 36, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 45, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 63, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForObjectLiteralProperties.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForPropertiesOfGenericType.baseline.jsonc b/tests/baselines/reference/referencesForPropertiesOfGenericType.baseline.jsonc new file mode 100644 index 00000000000..6d73f31b15d --- /dev/null +++ b/tests/baselines/reference/referencesForPropertiesOfGenericType.baseline.jsonc @@ -0,0 +1,425 @@ +// === /tests/cases/fourslash/referencesForPropertiesOfGenericType.ts === +// interface IFoo { +// /*FIND ALL REFS*/[|doSomething|](v: T): T; +// } +// +// var x: IFoo; +// x.[|doSomething|]("ss"); +// +// var y: IFoo; +// y.[|doSomething|](12); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "kind": "method", + "name": "(method) IFoo.doSomething(v: T): T", + "textSpan": { + "start": 24, + "length": 11 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "IFoo", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doSomething", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "v", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + } + ], + "contextSpan": { + "start": 24, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "contextSpan": { + "start": 24, + "length": 21 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 72, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 115, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForPropertiesOfGenericType.ts === +// interface IFoo { +// [|doSomething|](v: T): T; +// } +// +// var x: IFoo; +// x./*FIND ALL REFS*/[|doSomething|]("ss"); +// +// var y: IFoo; +// y.[|doSomething|](12); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "kind": "method", + "name": "(method) IFoo.doSomething(v: T): T", + "textSpan": { + "start": 24, + "length": 11 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "IFoo", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doSomething", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "v", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + } + ], + "contextSpan": { + "start": 24, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "contextSpan": { + "start": 24, + "length": 21 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 72, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 115, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForPropertiesOfGenericType.ts === +// interface IFoo { +// [|doSomething|](v: T): T; +// } +// +// var x: IFoo; +// x.[|doSomething|]("ss"); +// +// var y: IFoo; +// y./*FIND ALL REFS*/[|doSomething|](12); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "kind": "method", + "name": "(method) IFoo.doSomething(v: T): T", + "textSpan": { + "start": 24, + "length": 11 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "IFoo", + "kind": "interfaceName" + }, + { + "text": "<", + "kind": "punctuation" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ">", + "kind": "punctuation" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "doSomething", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "v", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "T", + "kind": "typeParameterName" + } + ], + "contextSpan": { + "start": 24, + "length": 21 + } + }, + "references": [ + { + "textSpan": { + "start": 24, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "contextSpan": { + "start": 24, + "length": 21 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 72, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 115, + "length": 11 + }, + "fileName": "/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForStatic.baseline.jsonc b/tests/baselines/reference/referencesForStatic.baseline.jsonc new file mode 100644 index 00000000000..225f8bc9872 --- /dev/null +++ b/tests/baselines/reference/referencesForStatic.baseline.jsonc @@ -0,0 +1,1511 @@ +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo.[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// /*FIND ALL REFS*/static [|n|] = ''; +// +// public bar() { +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo.[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// static /*FIND ALL REFS*/[|n|] = ''; +// +// public bar() { +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo.[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// static [|n|] = ''; +// +// public bar() { +// foo./*FIND ALL REFS*/[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo.[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// static [|n|] = ''; +// +// public bar() { +// foo.[|n|] = "'"; +// if(foo./*FIND ALL REFS*/[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo.[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// static [|n|] = ''; +// +// public bar() { +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo./*FIND ALL REFS*/[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo.[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// static [|n|] = ''; +// +// public bar() { +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo./*FIND ALL REFS*/[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo.[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// static [|n|] = ''; +// +// public bar() { +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo./*FIND ALL REFS*/[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo.[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// static [|n|] = ''; +// +// public bar() { +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo./*FIND ALL REFS*/[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesOnStatic_2.ts === +// var q = foo./*FIND ALL REFS*/[|n|]; + +// === /tests/cases/fourslash/referencesOnStatic_1.ts === +// var n = 43; +// +// class foo { +// static [|n|] = ''; +// +// public bar() { +// foo.[|n|] = "'"; +// if(foo.[|n|]) { +// var x = foo.[|n|]; +// } +// } +// } +// +// class foo2 { +// private x = foo.[|n|]; +// constructor() { +// foo.[|n|] = x; +// } +// +// function b(n) { +// n = foo.[|n|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "kind": "property", + "name": "(property) foo.n: string", + "textSpan": { + "start": 36, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "n", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 29, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 36, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "contextSpan": { + "start": 29, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 76, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 100, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 129, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 184, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 269, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 12, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/referencesOnStatic_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForStaticsAndMembersWithSameNames.baseline.jsonc b/tests/baselines/reference/referencesForStaticsAndMembersWithSameNames.baseline.jsonc new file mode 100644 index 00000000000..b2531a9bcd4 --- /dev/null +++ b/tests/baselines/reference/referencesForStaticsAndMembersWithSameNames.baseline.jsonc @@ -0,0 +1,1367 @@ +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// /*FIND ALL REFS*/[|bar|]: Foo; +// static bar: Foo; +// +// public foo(): void { +// } +// public static foo(): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.foo(); +// x.[|bar|]; +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.bar; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "property", + "name": "(property) MixedStaticsClassTest.Foo.bar: Foo", + "textSpan": { + "start": 74, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 74, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 74, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 74, + "length": 9 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 278, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// /*FIND ALL REFS*/static [|bar|]: Foo; +// +// public foo(): void { +// } +// public static foo(): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.foo(); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.[|bar|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "property", + "name": "(property) MixedStaticsClassTest.Foo.bar: Foo", + "textSpan": { + "start": 94, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 87, + "length": 16 + } + }, + "references": [ + { + "textSpan": { + "start": 94, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 87, + "length": 16 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// static /*FIND ALL REFS*/[|bar|]: Foo; +// +// public foo(): void { +// } +// public static foo(): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.foo(); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.[|bar|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "property", + "name": "(property) MixedStaticsClassTest.Foo.bar: Foo", + "textSpan": { + "start": 94, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 87, + "length": 16 + } + }, + "references": [ + { + "textSpan": { + "start": 94, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 87, + "length": 16 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// static bar: Foo; +// +// /*FIND ALL REFS*/public [|foo|](): void { +// } +// public static foo(): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.[|foo|](); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.bar; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "method", + "name": "(method) MixedStaticsClassTest.Foo.foo(): void", + "textSpan": { + "start": 115, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 108, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 115, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 108, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 267, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// static bar: Foo; +// +// public /*FIND ALL REFS*/[|foo|](): void { +// } +// public static foo(): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.[|foo|](); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.bar; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "method", + "name": "(method) MixedStaticsClassTest.Foo.foo(): void", + "textSpan": { + "start": 115, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 108, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 115, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 108, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 267, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// static bar: Foo; +// +// public foo(): void { +// } +// /*FIND ALL REFS*/public static [|foo|](): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.foo(); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.[|foo|](); +// MixedStaticsClassTest.Foo.bar; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "method", + "name": "(method) MixedStaticsClassTest.Foo.foo(): void", + "textSpan": { + "start": 151, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 137, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 151, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 137, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 333, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// static bar: Foo; +// +// public foo(): void { +// } +// public static /*FIND ALL REFS*/[|foo|](): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.foo(); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.[|foo|](); +// MixedStaticsClassTest.Foo.bar; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "method", + "name": "(method) MixedStaticsClassTest.Foo.foo(): void", + "textSpan": { + "start": 151, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 137, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 151, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 137, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 333, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// static bar: Foo; +// +// public [|foo|](): void { +// } +// public static foo(): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x./*FIND ALL REFS*/[|foo|](); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.bar; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "method", + "name": "(method) MixedStaticsClassTest.Foo.foo(): void", + "textSpan": { + "start": 115, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 108, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 115, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 108, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 267, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// [|bar|]: Foo; +// static bar: Foo; +// +// public foo(): void { +// } +// public static foo(): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.foo(); +// x./*FIND ALL REFS*/[|bar|]; +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo.bar; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "property", + "name": "(property) MixedStaticsClassTest.Foo.bar: Foo", + "textSpan": { + "start": 74, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 74, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 74, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 74, + "length": 9 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 278, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// static bar: Foo; +// +// public foo(): void { +// } +// public static [|foo|](): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.foo(); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo./*FIND ALL REFS*/[|foo|](); +// MixedStaticsClassTest.Foo.bar; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "method", + "name": "(method) MixedStaticsClassTest.Foo.foo(): void", + "textSpan": { + "start": 151, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 137, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 151, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 137, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 333, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts === +// module FindRef4 { +// module MixedStaticsClassTest { +// export class Foo { +// bar: Foo; +// static [|bar|]: Foo; +// +// public foo(): void { +// } +// public static foo(): void { +// } +// } +// } +// +// function test() { +// // instance function +// var x = new MixedStaticsClassTest.Foo(); +// x.foo(); +// x.bar; +// +// // static function +// MixedStaticsClassTest.Foo.foo(); +// MixedStaticsClassTest.Foo./*FIND ALL REFS*/[|bar|]; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "kind": "property", + "name": "(property) MixedStaticsClassTest.Foo.bar: Foo", + "textSpan": { + "start": 94, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MixedStaticsClassTest", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "bar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + } + ], + "contextSpan": { + "start": 87, + "length": 16 + } + }, + "references": [ + { + "textSpan": { + "start": 94, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "contextSpan": { + "start": 87, + "length": 16 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForStringLiteralPropertyNames2.baseline.jsonc b/tests/baselines/reference/referencesForStringLiteralPropertyNames2.baseline.jsonc new file mode 100644 index 00000000000..d0311444e07 --- /dev/null +++ b/tests/baselines/reference/referencesForStringLiteralPropertyNames2.baseline.jsonc @@ -0,0 +1,317 @@ +// === /tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts === +// class Foo { +// /*FIND ALL REFS*/"[|blah|]"() { return 0; } +// } +// +// var x: Foo; +// x.[|blah|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "kind": "method", + "name": "(method) Foo[\"blah\"](): number", + "textSpan": { + "start": 17, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"blah\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 22 + } + }, + "references": [ + { + "textSpan": { + "start": 17, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "contextSpan": { + "start": 16, + "length": 22 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 56, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts === +// class Foo { +// "/*FIND ALL REFS*/[|blah|]"() { return 0; } +// } +// +// var x: Foo; +// x.[|blah|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "kind": "method", + "name": "(method) Foo[\"blah\"](): number", + "textSpan": { + "start": 17, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"blah\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 22 + } + }, + "references": [ + { + "textSpan": { + "start": 17, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "contextSpan": { + "start": 16, + "length": 22 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 56, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts === +// class Foo { +// "[|blah|]"() { return 0; } +// } +// +// var x: Foo; +// x./*FIND ALL REFS*/[|blah|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "kind": "method", + "name": "(method) Foo[\"blah\"](): number", + "textSpan": { + "start": 17, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo", + "kind": "className" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"blah\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 16, + "length": 22 + } + }, + "references": [ + { + "textSpan": { + "start": 17, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "contextSpan": { + "start": 16, + "length": 22 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 56, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/referencesForStringLiteralPropertyNames3.baseline.jsonc b/tests/baselines/reference/referencesForStringLiteralPropertyNames3.baseline.jsonc new file mode 100644 index 00000000000..5c2bad6c4aa --- /dev/null +++ b/tests/baselines/reference/referencesForStringLiteralPropertyNames3.baseline.jsonc @@ -0,0 +1,559 @@ +// === /tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts === +// class Foo2 { +// /*FIND ALL REFS*/get "[|42|]"() { return 0; } +// set [|42|](n) { } +// } +// +// var y: Foo2; +// y[[|42|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "kind": "property", + "name": "(property) Foo2[\"42\"]: number", + "textSpan": { + "start": 22, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo2", + "kind": "className" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"42\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 17, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 17, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 46, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 78, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts === +// class Foo2 { +// get "/*FIND ALL REFS*/[|42|]"() { return 0; } +// set [|42|](n) { } +// } +// +// var y: Foo2; +// y[[|42|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "kind": "property", + "name": "(property) Foo2[\"42\"]: number", + "textSpan": { + "start": 22, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo2", + "kind": "className" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"42\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 17, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 17, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 46, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 78, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts === +// class Foo2 { +// get "[|42|]"() { return 0; } +// /*FIND ALL REFS*/set [|42|](n) { } +// } +// +// var y: Foo2; +// y[[|42|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "kind": "property", + "name": "(property) Foo2[\"42\"]: number", + "textSpan": { + "start": 22, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo2", + "kind": "className" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"42\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 17, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 17, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 46, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 78, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts === +// class Foo2 { +// get "[|42|]"() { return 0; } +// set /*FIND ALL REFS*/[|42|](n) { } +// } +// +// var y: Foo2; +// y[[|42|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "kind": "property", + "name": "(property) Foo2[\"42\"]: number", + "textSpan": { + "start": 22, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo2", + "kind": "className" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"42\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 17, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 17, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 46, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 78, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts === +// class Foo2 { +// get "[|42|]"() { return 0; } +// set [|42|](n) { } +// } +// +// var y: Foo2; +// y[/*FIND ALL REFS*/[|42|]]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "kind": "property", + "name": "(property) Foo2[\"42\"]: number", + "textSpan": { + "start": 22, + "length": 2 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Foo2", + "kind": "className" + }, + { + "text": "[", + "kind": "punctuation" + }, + { + "text": "\"42\"", + "kind": "stringLiteral" + }, + { + "text": "]", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 17, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 22, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 17, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 50, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "contextSpan": { + "start": 46, + "length": 13 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 78, + "length": 2 + }, + "fileName": "/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsxFindAllReferences1.baseline.jsonc b/tests/baselines/reference/tsxFindAllReferences1.baseline.jsonc new file mode 100644 index 00000000000..0b5c5f4cb03 --- /dev/null +++ b/tests/baselines/reference/tsxFindAllReferences1.baseline.jsonc @@ -0,0 +1,367 @@ +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// /*FIND ALL REFS*/[|div|]: { +// name?: string; +// isOpen?: boolean; +// }; +// span: { n: string; }; +// } +// } +// var x = <[|div|] />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "property", + "name": "(property) JSX.IntrinsicElements.div: {\n name?: string;\n isOpen?: boolean;\n}", + "textSpan": { + "start": 89, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "IntrinsicElements", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "div", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "name", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isOpen", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 89, + "length": 74 + } + }, + "references": [ + { + "textSpan": { + "start": 89, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 89, + "length": 74 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 211, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 210, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// [|div|]: { +// name?: string; +// isOpen?: boolean; +// }; +// span: { n: string; }; +// } +// } +// var x = ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "property", + "name": "(property) JSX.IntrinsicElements.div: {\n name?: string;\n isOpen?: boolean;\n}", + "textSpan": { + "start": 89, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "IntrinsicElements", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "div", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "name", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "isOpen", + "kind": "propertyName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 89, + "length": 74 + } + }, + "references": [ + { + "textSpan": { + "start": 89, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 89, + "length": 74 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 211, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 210, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsxFindAllReferences11.baseline.jsonc b/tests/baselines/reference/tsxFindAllReferences11.baseline.jsonc new file mode 100644 index 00000000000..0a83ad664e8 --- /dev/null +++ b/tests/baselines/reference/tsxFindAllReferences11.baseline.jsonc @@ -0,0 +1,82 @@ +// === /tests/cases/fourslash/file.tsx === +// 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 = ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "property", + "name": "(property) wrong: true", + "textSpan": { + "start": 622, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "wrong", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "true", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 622, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsxFindAllReferences4.baseline.jsonc b/tests/baselines/reference/tsxFindAllReferences4.baseline.jsonc new file mode 100644 index 00000000000..e2e3299f567 --- /dev/null +++ b/tests/baselines/reference/tsxFindAllReferences4.baseline.jsonc @@ -0,0 +1,365 @@ +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props } +// } +// /*FIND ALL REFS*/class [|MyClass|] { +// props: { +// name?: string; +// size?: number; +// } +// +// +// var x = <[|MyClass|] name='hello'>; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "class", + "name": "class MyClass", + "textSpan": { + "start": 145, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MyClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 139, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 145, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 139, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 217, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 216, + "length": 32 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 240, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 216, + "length": 32 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props } +// } +// class /*FIND ALL REFS*/[|MyClass|] { +// props: { +// name?: string; +// size?: number; +// } +// +// +// var x = <[|MyClass|] name='hello'>; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "class", + "name": "class MyClass", + "textSpan": { + "start": 145, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MyClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 139, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 145, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 139, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 217, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 216, + "length": 32 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 240, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 216, + "length": 32 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props } +// } +// class [|MyClass|] { +// props: { +// name?: string; +// size?: number; +// } +// +// +// var x = ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "class", + "name": "class MyClass", + "textSpan": { + "start": 145, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MyClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 139, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 145, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 139, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 217, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 216, + "length": 32 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 240, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 216, + "length": 32 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props } +// } +// class [|MyClass|] { +// props: { +// name?: string; +// size?: number; +// } +// +// +// var x = <[|MyClass|] name='hello'>; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "class", + "name": "class MyClass", + "textSpan": { + "start": 145, + "length": 7 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MyClass", + "kind": "className" + } + ], + "contextSpan": { + "start": 139, + "length": 66 + } + }, + "references": [ + { + "textSpan": { + "start": 145, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 139, + "length": 66 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 217, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 216, + "length": 32 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 240, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 216, + "length": 32 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsxFindAllReferences5.baseline.jsonc b/tests/baselines/reference/tsxFindAllReferences5.baseline.jsonc new file mode 100644 index 00000000000..3841f4991e6 --- /dev/null +++ b/tests/baselines/reference/tsxFindAllReferences5.baseline.jsonc @@ -0,0 +1,1248 @@ +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props; } +// } +// interface OptionPropBag { +// propx: number +// propString: string +// optional?: boolean +// } +// /*FIND ALL REFS*/declare function [|Opt|](attributes: OptionPropBag): JSX.Element; +// let opt = <[|Opt|] />; +// let opt1 = <[|Opt|] propx={100} propString />; +// let opt2 = <[|Opt|] propx={100} optional/>; +// let opt3 = <[|Opt|] wrong />; +// let opt4 = <[|Opt|] propx={100} propString="hi" />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function Opt(attributes: OptionPropBag): JSX.Element", + "textSpan": { + "start": 249, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "attributes", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OptionPropBag", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + } + ], + "contextSpan": { + "start": 232, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 249, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 232, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 305, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 304, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 325, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 324, + "length": 30 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 367, + "length": 27 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 408, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 407, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 434, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 433, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props; } +// } +// interface OptionPropBag { +// propx: number +// propString: string +// optional?: boolean +// } +// declare function /*FIND ALL REFS*/[|Opt|](attributes: OptionPropBag): JSX.Element; +// let opt = <[|Opt|] />; +// let opt1 = <[|Opt|] propx={100} propString />; +// let opt2 = <[|Opt|] propx={100} optional/>; +// let opt3 = <[|Opt|] wrong />; +// let opt4 = <[|Opt|] propx={100} propString="hi" />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function Opt(attributes: OptionPropBag): JSX.Element", + "textSpan": { + "start": 249, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "attributes", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OptionPropBag", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + } + ], + "contextSpan": { + "start": 232, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 249, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 232, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 305, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 304, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 325, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 324, + "length": 30 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 367, + "length": 27 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 408, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 407, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 434, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 433, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = ; +// let opt1 = <[|Opt|] propx={100} propString />; +// let opt2 = <[|Opt|] propx={100} optional/>; +// let opt3 = <[|Opt|] wrong />; +// let opt4 = <[|Opt|] propx={100} propString="hi" />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function Opt(attributes: OptionPropBag): JSX.Element", + "textSpan": { + "start": 249, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "attributes", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OptionPropBag", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + } + ], + "contextSpan": { + "start": 232, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 249, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 232, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 305, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 304, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 325, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 324, + "length": 30 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 367, + "length": 27 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 408, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 407, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 434, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 433, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|Opt|] />; +// let opt1 = ; +// let opt2 = <[|Opt|] propx={100} optional/>; +// let opt3 = <[|Opt|] wrong />; +// let opt4 = <[|Opt|] propx={100} propString="hi" />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function Opt(attributes: OptionPropBag): JSX.Element", + "textSpan": { + "start": 249, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "attributes", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OptionPropBag", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + } + ], + "contextSpan": { + "start": 232, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 249, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 232, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 305, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 304, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 325, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 324, + "length": 30 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 367, + "length": 27 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 408, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 407, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 434, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 433, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|Opt|] />; +// let opt1 = <[|Opt|] propx={100} propString />; +// let opt2 = ; +// let opt3 = <[|Opt|] wrong />; +// let opt4 = <[|Opt|] propx={100} propString="hi" />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function Opt(attributes: OptionPropBag): JSX.Element", + "textSpan": { + "start": 249, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "attributes", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OptionPropBag", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + } + ], + "contextSpan": { + "start": 232, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 249, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 232, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 305, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 304, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 325, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 324, + "length": 30 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 367, + "length": 27 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 408, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 407, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 434, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 433, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|Opt|] />; +// let opt1 = <[|Opt|] propx={100} propString />; +// let opt2 = <[|Opt|] propx={100} optional/>; +// let opt3 = ; +// let opt4 = <[|Opt|] propx={100} propString="hi" />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function Opt(attributes: OptionPropBag): JSX.Element", + "textSpan": { + "start": 249, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "attributes", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OptionPropBag", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + } + ], + "contextSpan": { + "start": 232, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 249, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 232, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 305, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 304, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 325, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 324, + "length": 30 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 367, + "length": 27 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 408, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 407, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 434, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 433, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|Opt|] />; +// let opt1 = <[|Opt|] propx={100} propString />; +// let opt2 = <[|Opt|] propx={100} optional/>; +// let opt3 = <[|Opt|] wrong />; +// let opt4 = ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function Opt(attributes: OptionPropBag): JSX.Element", + "textSpan": { + "start": 249, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Opt", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "attributes", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "OptionPropBag", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + } + ], + "contextSpan": { + "start": 232, + "length": 61 + } + }, + "references": [ + { + "textSpan": { + "start": 249, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 232, + "length": 61 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 305, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 304, + "length": 7 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 325, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 324, + "length": 30 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 368, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 367, + "length": 27 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 408, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 407, + "length": 13 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 434, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 433, + "length": 35 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsxFindAllReferences6.baseline.jsonc b/tests/baselines/reference/tsxFindAllReferences6.baseline.jsonc new file mode 100644 index 00000000000..18cd7d6300f --- /dev/null +++ b/tests/baselines/reference/tsxFindAllReferences6.baseline.jsonc @@ -0,0 +1,75 @@ +// === /tests/cases/fourslash/file.tsx === +// 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 = ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "property", + "name": "(property) wrong: true", + "textSpan": { + "start": 309, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "wrong", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "true", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 309, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "isWriteAccess": true, + "isDefinition": true + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsxFindAllReferences8.baseline.jsonc b/tests/baselines/reference/tsxFindAllReferences8.baseline.jsonc new file mode 100644 index 00000000000..163c162399e --- /dev/null +++ b/tests/baselines/reference/tsxFindAllReferences8.baseline.jsonc @@ -0,0 +1,3035 @@ +// === /tests/cases/fourslash/file.tsx === +// 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; +// } +// /*FIND ALL REFS*/declare function [|MainButton|](buttonProps: ButtonProps): JSX.Element; +// declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// 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 /*FIND ALL REFS*/[|MainButton|](buttonProps: ButtonProps): JSX.Element; +// declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// 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; +// /*FIND ALL REFS*/declare function [|MainButton|](linkProps: LinkProps): JSX.Element; +// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// 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 /*FIND ALL REFS*/[|MainButton|](linkProps: LinkProps): JSX.Element; +// declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// 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; +// /*FIND ALL REFS*/declare function [|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// 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 /*FIND ALL REFS*/[|MainButton|](props: ButtonProps | LinkProps): JSX.Element; +// let opt = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = ; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|MainButton|] />; +// let opt = ; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = {}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = {}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = ; +// let opt = <[|MainButton|] wrong />; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// 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 = <[|MainButton|] />; +// let opt = <[|MainButton|] children="chidlren" />; +// let opt = <[|MainButton|] onClick={()=>{}} />; +// let opt = <[|MainButton|] onClick={()=>{}} ignore-prop />; +// let opt = <[|MainButton|] goTo="goTo" />; +// let opt = ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "function", + "name": "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", + "textSpan": { + "start": 411, + "length": 10 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "MainButton", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "buttonProps", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "ButtonProps", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "text" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "+", + "kind": "operator" + }, + { + "text": "2", + "kind": "numericLiteral" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "overloads", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 394, + "length": 67 + } + }, + "references": [ + { + "textSpan": { + "start": 411, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 394, + "length": 67 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 479, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 462, + "length": 63 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 543, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 526, + "length": 73 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 611, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 610, + "length": 14 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 637, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 636, + "length": 34 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 683, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 682, + "length": 31 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 726, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 725, + "length": 43 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 781, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 780, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 819, + "length": 10 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 818, + "length": 20 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsxFindAllReferencesUnionElementType1.baseline.jsonc b/tests/baselines/reference/tsxFindAllReferencesUnionElementType1.baseline.jsonc new file mode 100644 index 00000000000..68ec6c3f3a4 --- /dev/null +++ b/tests/baselines/reference/tsxFindAllReferencesUnionElementType1.baseline.jsonc @@ -0,0 +1,847 @@ +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props; } +// } +// function SFC1(prop: { x: number }) { +// return
hello
; +// }; +// function SFC2(prop: { x: boolean }) { +// return

World

; +// } +// /*FIND ALL REFS*/var [|SFCComp|] = SFC1 || SFC2; +// <[|SFCComp|] x={ "hi" } /> + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "var", + "name": "var SFCComp: ((prop: {\n x: number;\n}) => JSX.Element) | ((prop: {\n x: boolean;\n}) => JSX.Element)", + "textSpan": { + "start": 282, + "length": 7 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SFCComp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "prop", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "prop", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 278, + "length": 27 + } + }, + "references": [ + { + "textSpan": { + "start": 282, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 278, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 307, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 306, + "length": 22 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props; } +// } +// function SFC1(prop: { x: number }) { +// return
hello
; +// }; +// function SFC2(prop: { x: boolean }) { +// return

World

; +// } +// var /*FIND ALL REFS*/[|SFCComp|] = SFC1 || SFC2; +// <[|SFCComp|] x={ "hi" } /> + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "var", + "name": "var SFCComp: ((prop: {\n x: number;\n}) => JSX.Element) | ((prop: {\n x: boolean;\n}) => JSX.Element)", + "textSpan": { + "start": 282, + "length": 7 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SFCComp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "prop", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "prop", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 278, + "length": 27 + } + }, + "references": [ + { + "textSpan": { + "start": 282, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 278, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 307, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 306, + "length": 22 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// declare module JSX { +// interface Element { } +// interface IntrinsicElements { +// } +// interface ElementAttributesProperty { props; } +// } +// function SFC1(prop: { x: number }) { +// return
hello
; +// }; +// function SFC2(prop: { x: boolean }) { +// return

World

; +// } +// var [|SFCComp|] = SFC1 || SFC2; +// + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "var", + "name": "var SFCComp: ((prop: {\n x: number;\n}) => JSX.Element) | ((prop: {\n x: boolean;\n}) => JSX.Element)", + "textSpan": { + "start": 282, + "length": 7 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "SFCComp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "prop", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "prop", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "boolean", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 278, + "length": 27 + } + }, + "references": [ + { + "textSpan": { + "start": 282, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 278, + "length": 27 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 307, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 306, + "length": 22 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tsxFindAllReferencesUnionElementType2.baseline.jsonc b/tests/baselines/reference/tsxFindAllReferencesUnionElementType2.baseline.jsonc new file mode 100644 index 00000000000..529de842c3c --- /dev/null +++ b/tests/baselines/reference/tsxFindAllReferencesUnionElementType2.baseline.jsonc @@ -0,0 +1,292 @@ +// === /tests/cases/fourslash/file.tsx === +// class RC1 extends React.Component<{}, {}> { +// render() { +// return null; +// } +// } +// class RC2 extends React.Component<{}, {}> { +// render() { +// return null; +// } +// private method() { } +// } +// /*FIND ALL REFS*/var [|RCComp|] = RC1 || RC2; +// <[|RCComp|] /> + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "var", + "name": "var RCComp: typeof RC1", + "textSpan": { + "start": 205, + "length": 6 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RCComp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RC1", + "kind": "className" + } + ], + "contextSpan": { + "start": 201, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 205, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 201, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 227, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 226, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/file.tsx === +// class RC1 extends React.Component<{}, {}> { +// render() { +// return null; +// } +// } +// class RC2 extends React.Component<{}, {}> { +// render() { +// return null; +// } +// private method() { } +// } +// var /*FIND ALL REFS*/[|RCComp|] = RC1 || RC2; +// <[|RCComp|] /> + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "var", + "name": "var RCComp: typeof RC1", + "textSpan": { + "start": 205, + "length": 6 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RCComp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RC1", + "kind": "className" + } + ], + "contextSpan": { + "start": 201, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 205, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 201, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 227, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 226, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +undefined + +// === /tests/cases/fourslash/file.tsx === +// class RC1 extends React.Component<{}, {}> { +// render() { +// return null; +// } +// } +// class RC2 extends React.Component<{}, {}> { +// render() { +// return null; +// } +// private method() { } +// } +// var [|RCComp|] = RC1 || RC2; +// + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/file.tsx", + "kind": "var", + "name": "var RCComp: typeof RC1", + "textSpan": { + "start": 205, + "length": 6 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RCComp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "RC1", + "kind": "className" + } + ], + "contextSpan": { + "start": 201, + "length": 24 + } + }, + "references": [ + { + "textSpan": { + "start": 205, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 201, + "length": 24 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 227, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/file.tsx", + "contextSpan": { + "start": 226, + "length": 10 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/ambientShorthandFindAllRefs.ts b/tests/cases/fourslash/ambientShorthandFindAllRefs.ts index 3a0c30ef507..18698f77899 100644 --- a/tests/cases/fourslash/ambientShorthandFindAllRefs.ts +++ b/tests/cases/fourslash/ambientShorthandFindAllRefs.ts @@ -4,12 +4,10 @@ ////declare module "jquery"; // @Filename: user.ts -////[|import {[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|]} from "jquery";|] +////import {/*1*/x} from "jquery"; // @Filename: user2.ts -////[|import {[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}x|]} from "jquery";|] +////import {/*2*/x} from "jquery"; -const [r0Def, r0, r1Def, r1] = test.ranges(); // TODO: Want these to be in the same group, but that would require creating a symbol for `x`. -verify.singleReferenceGroup("(alias) module \"jquery\"\nimport x", [r0]); -verify.singleReferenceGroup("(alias) module \"jquery\"\nimport x", [r1]); \ No newline at end of file +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/esModuleInteropFindAllReferences.ts b/tests/cases/fourslash/esModuleInteropFindAllReferences.ts index 842243c9b1b..a0203972041 100644 --- a/tests/cases/fourslash/esModuleInteropFindAllReferences.ts +++ b/tests/cases/fourslash/esModuleInteropFindAllReferences.ts @@ -4,11 +4,11 @@ // @Filename: /abc.d.ts ////declare module "a" { -//// [|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|]: number;|] +//// /*1*/export const /*2*/x: number; ////} // @Filename: /b.ts ////import a from "a"; -////a.[|x|]; +////a./*3*/x; -verify.singleReferenceGroup("const x: number", "x"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/esModuleInteropFindAllReferences2.ts b/tests/cases/fourslash/esModuleInteropFindAllReferences2.ts index e70454f023a..50bf2367fec 100644 --- a/tests/cases/fourslash/esModuleInteropFindAllReferences2.ts +++ b/tests/cases/fourslash/esModuleInteropFindAllReferences2.ts @@ -6,10 +6,10 @@ // @Filename: /a.d.ts ////export as namespace abc; -////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|]: number;|] +/////*1*/export const /*2*/x: number; // @Filename: /b.ts ////import a from "./a"; -////a.[|x|]; +////a./*3*/x; -verify.singleReferenceGroup('const x: number', "x"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts b/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts index 2b28656c58e..8ecfedaf17d 100644 --- a/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts +++ b/tests/cases/fourslash/findAllReferPropertyAccessExpressionHeritageClause.ts @@ -2,9 +2,9 @@ //// class B {} //// function foo() { -//// return {[|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}B|]: B|]}; +//// return {/*1*/B: B}; //// } -//// class C extends (foo()).[|B|] {} -//// class C1 extends foo().[|B|] {} +//// class C extends (foo())./*2*/B {} +//// class C1 extends foo()./*3*/B {} -verify.singleReferenceGroup("(property) B: typeof B", "B"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllReferencesDynamicImport1.ts b/tests/cases/fourslash/findAllReferencesDynamicImport1.ts index 999704edd3e..cd1d5774ed4 100644 --- a/tests/cases/fourslash/findAllReferencesDynamicImport1.ts +++ b/tests/cases/fourslash/findAllReferencesDynamicImport1.ts @@ -3,7 +3,7 @@ // @Filename: foo.ts //// export function foo() { return "foo"; } -//// [|import("[|{| "contextRangeIndex": 0 |}./foo|]")|] -//// [|var x = import("[|{| "contextRangeIndex": 2 |}./foo|]")|] +//// /*1*/import("/*2*/./foo") +//// /*3*/var x = import("/*4*/./foo") -verify.singleReferenceGroup('module "/tests/cases/fourslash/foo"', "./foo"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllReferencesDynamicImport2.ts b/tests/cases/fourslash/findAllReferencesDynamicImport2.ts index 987fccc219e..7d9390f51d4 100644 --- a/tests/cases/fourslash/findAllReferencesDynamicImport2.ts +++ b/tests/cases/fourslash/findAllReferencesDynamicImport2.ts @@ -1,12 +1,12 @@ /// // @Filename: foo.ts -//// [|export function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}bar|]() { return "bar"; }|] +//// [|export function /*1*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}bar|]() { return "bar"; }|] //// var x = import("./foo"); //// x.then(foo => { -//// foo.[|bar|](); +//// foo./*2*/[|bar|](); //// }) -verify.singleReferenceGroup("function bar(): string", "bar"); +verify.baselineFindAllReferences('1', '2'); verify.rangesWithSameTextAreRenameLocations("bar"); diff --git a/tests/cases/fourslash/findAllReferencesJSDocFunctionNew.ts b/tests/cases/fourslash/findAllReferencesJSDocFunctionNew.ts index 28e24da2791..df6e4c32c2b 100644 --- a/tests/cases/fourslash/findAllReferencesJSDocFunctionNew.ts +++ b/tests/cases/fourslash/findAllReferencesJSDocFunctionNew.ts @@ -1,8 +1,7 @@ -/// -// @allowJs: true -// @Filename: Foo.js -/////** @type {function ([|[|{|"isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0|}new|]: string|], string): string} */ -////var f; - -const [a0Def, a0] = test.ranges(); -verify.singleReferenceGroup("(parameter) new: string", [a0]); +/// +// @allowJs: true +// @Filename: Foo.js +/////** @type {function (/*1*/new: string, string): string} */ +////var f; + +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts b/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts index 25059d028ed..60b281797bb 100644 --- a/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts +++ b/tests/cases/fourslash/findAllReferencesJsDocTypeLiteral.ts @@ -1,16 +1,16 @@ -// @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.[|{| "isDefinition": true |}great|] - much greatness -//// * @param {number} o.nested.times - twice? probably!?? -//// */ -//// function f(o) { return o.nested.[|great|]; } - -verify.singleReferenceGroup("(property) great: boolean"); +// @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; } + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts b/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts index 00ca23cda27..27f131603a8 100644 --- a/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts +++ b/tests/cases/fourslash/findAllReferencesOfConstructor_badOverload.ts @@ -1,8 +1,8 @@ /// ////class C { -//// [|[|{| "contextRangeIndex": 0, "isDefinition": true |}constructor|](n: number);|] -//// [|[|{| "contextRangeIndex": 2, "isDefinition": true |}constructor|](){}|] +//// /*1*/constructor(n: number); +//// /*2*/constructor(){} ////} -verify.singleReferenceGroup("class C", "constructor"); +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllReferencesOfJsonModule.ts b/tests/cases/fourslash/findAllReferencesOfJsonModule.ts index 7543d7a7899..05136ccb63e 100644 --- a/tests/cases/fourslash/findAllReferencesOfJsonModule.ts +++ b/tests/cases/fourslash/findAllReferencesOfJsonModule.ts @@ -5,10 +5,10 @@ // @esModuleInterop: true // @Filename: /foo.ts -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}settings|] from "./settings.json";|] -////[|settings|]; +/////*1*/import /*2*/settings from "./settings.json"; +/////*3*/settings; // @Filename: /settings.json //// {} -verify.singleReferenceGroup("import settings", "settings"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsCatchClause.ts b/tests/cases/fourslash/findAllRefsCatchClause.ts index 0e7e3799850..b08fa01a6c5 100644 --- a/tests/cases/fourslash/findAllRefsCatchClause.ts +++ b/tests/cases/fourslash/findAllRefsCatchClause.ts @@ -1,8 +1,8 @@ /// ////try { } -////catch ([|{| "isWriteAccess": true, "isDefinition": true |}err|]) { -//// [|err|]; +////catch (/*1*/err) { +//// /*2*/err; ////} -verify.singleReferenceGroup("var err: any"); +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsConstructorFunctions.ts b/tests/cases/fourslash/findAllRefsConstructorFunctions.ts index a020380db70..c5d8faac7a5 100644 --- a/tests/cases/fourslash/findAllRefsConstructorFunctions.ts +++ b/tests/cases/fourslash/findAllRefsConstructorFunctions.ts @@ -1,14 +1,14 @@ -/// - -// @allowJs: true - -// @Filename: /a.js -////function f() { -//// [|this.[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] = 0;|] -////} -////f.prototype.setX = function() { -//// [|this.[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}x|] = 1;|] -////} -////f.prototype.useX = function() { this.[|x|]; } - -verify.singleReferenceGroup("(property) f.x: number", "x"); +/// + +// @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; } + +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); diff --git a/tests/cases/fourslash/findAllRefsDeclareClass.ts b/tests/cases/fourslash/findAllRefsDeclareClass.ts index 789a4269403..633a07d03b3 100644 --- a/tests/cases/fourslash/findAllRefsDeclareClass.ts +++ b/tests/cases/fourslash/findAllRefsDeclareClass.ts @@ -1,7 +1,7 @@ -/// - -////[|declare class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}C|] { -//// static m(): void; -////}|] - -verify.singleReferenceGroup("class C", "C"); +/// + +/////*1*/declare class /*2*/C { +//// static m(): void; +////} + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts b/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts index b8c6fc62105..9110558d362 100644 --- a/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts +++ b/tests/cases/fourslash/findAllRefsEnumAsNamespace.ts @@ -1,6 +1,6 @@ -/// - -////[|enum [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}E|] { A }|] -////let e: [|E|].A; - -verify.singleReferenceGroup("enum E", "E"); +/// + +/////*1*/enum /*2*/E { A } +////let e: /*3*/E.A; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsEnumMember.ts b/tests/cases/fourslash/findAllRefsEnumMember.ts index 584b8befd29..27b458348a2 100644 --- a/tests/cases/fourslash/findAllRefsEnumMember.ts +++ b/tests/cases/fourslash/findAllRefsEnumMember.ts @@ -1,6 +1,6 @@ -/// - -////enum E { [|{| "isWriteAccess": true, "isDefinition": true |}A|], B } -////const e: E.[|A|] = E.[|A|]; - -verify.singleReferenceGroup("(enum member) E.A = 0"); +/// + +////enum E { /*1*/A, B } +////const e: E./*2*/A = E./*3*/A; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts b/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts index 3d374fefbb4..b3dc3302e8d 100644 --- a/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts +++ b/tests/cases/fourslash/findAllRefsExportDefaultClassConstructor.ts @@ -1,5 +1,5 @@ ////export default class { -//// [|[|{| "contextRangeIndex": 0, "isDefinition": true |}constructor|]() {}|] +//// /*1*/constructor() {} ////} -verify.singleReferenceGroup("class default", "constructor"); +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts b/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts index 96e34260893..798d928db82 100644 --- a/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts +++ b/tests/cases/fourslash/findAllRefsExportNotAtTopLevel.ts @@ -1,8 +1,8 @@ -/// - -////{ -//// [|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] = 0;|] -//// [|x|]; -////} - -verify.singleReferenceGroup("const x: 0", "x"); +/// + +////{ +//// /*1*/export const /*2*/x = 0; +//// /*3*/x; +////} + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport01.ts b/tests/cases/fourslash/findAllRefsForDefaultExport01.ts index 4cb366d6173..f6653ce7e2d 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport01.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport01.ts @@ -1,10 +1,10 @@ /// -////[|export default class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}DefaultExportedClass|] { -////}|] +/////*1*/export default class /*2*/DefaultExportedClass { +////} //// -////var x: [|DefaultExportedClass|]; +////var x: /*3*/DefaultExportedClass; //// -////var y = new [|DefaultExportedClass|]; +////var y = new /*4*/DefaultExportedClass; -verify.singleReferenceGroup("class DefaultExportedClass", "DefaultExportedClass"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport02.ts b/tests/cases/fourslash/findAllRefsForDefaultExport02.ts index e0f0ecdafab..25f0656844f 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport02.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport02.ts @@ -1,21 +1,17 @@ /// -////[|export default function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}DefaultExportedFunction|]() { -//// return [|DefaultExportedFunction|]; -////}|] +/////*1*/export default function /*2*/DefaultExportedFunction() { +//// return /*3*/DefaultExportedFunction; +////} //// -////var x: typeof [|DefaultExportedFunction|]; +////var x: typeof /*4*/DefaultExportedFunction; //// -////var y = [|DefaultExportedFunction|](); +////var y = /*5*/DefaultExportedFunction(); //// -////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 5 |}DefaultExportedFunction|] { -////}|] +/////*6*/namespace /*7*/DefaultExportedFunction { +////} -const [r0Def, r0, r1, r2, r3, r4Def, r4] = test.ranges(); -const fnRanges = [r0, r1, r2, r3]; -verify.singleReferenceGroup("function DefaultExportedFunction(): () => typeof DefaultExportedFunction", fnRanges); - // The namespace and function do not merge, // so the namespace should be all alone. -verify.singleReferenceGroup(`namespace DefaultExportedFunction`, [r4]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7'); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport03.ts b/tests/cases/fourslash/findAllRefsForDefaultExport03.ts index 3ad604e2282..077d8c491ea 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport03.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport03.ts @@ -1,17 +1,17 @@ /// -////[|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}f|]() { +/////*1*/function /*2*/f() { //// return 100; -////}|] +////} //// -////[|export default [|{| "contextRangeIndex": 2 |}f|];|] +/////*3*/export default /*4*/f; //// -////var x: typeof [|f|]; +////var x: typeof /*5*/f; //// -////var y = [|f|](); +////var y = /*6*/f(); //// -////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}f|] { +/////*7*/namespace /*8*/f { //// var local = 100; -////}|] +////} -verify.singleReferenceGroup("namespace f\nfunction f(): number", "f"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8'); diff --git a/tests/cases/fourslash/findAllRefsForDefaultExport08.ts b/tests/cases/fourslash/findAllRefsForDefaultExport08.ts index 250944ff249..50e9c4bb234 100644 --- a/tests/cases/fourslash/findAllRefsForDefaultExport08.ts +++ b/tests/cases/fourslash/findAllRefsForDefaultExport08.ts @@ -7,11 +7,11 @@ //// ////var y = new DefaultExportedClass; //// -////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}DefaultExportedClass|] { -////}|] +////namespace /*1*/DefaultExportedClass { +////} verify.noErrors(); // The namespace and class do not merge, // so the namespace should be all alone. -verify.singleReferenceGroup("class DefaultExportedClass\nnamespace DefaultExportedClass", "DefaultExportedClass"); +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/findAllRefsForFunctionExpression01.ts b/tests/cases/fourslash/findAllRefsForFunctionExpression01.ts index 9665c189715..1bcc709b867 100644 --- a/tests/cases/fourslash/findAllRefsForFunctionExpression01.ts +++ b/tests/cases/fourslash/findAllRefsForFunctionExpression01.ts @@ -1,12 +1,12 @@ /// // @Filename: file1.ts -////var foo = [|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}foo|](a = [|foo|](), b = () => [|foo|]) { -//// [|foo|]([|foo|], [|foo|]); -////}|] +////var foo = /*1*/function /*2*/foo(a = /*3*/foo(), b = () => /*4*/foo) { +//// /*5*/foo(/*6*/foo, /*7*/foo); +////} // @Filename: file2.ts /////// ////foo(); -verify.singleReferenceGroup("(local function) foo(a?: void, b?: () => (a?: void, b?: ...) => void): void", "foo"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7'); diff --git a/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts b/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts index a9de9bb632c..063710e5af7 100644 --- a/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts +++ b/tests/cases/fourslash/findAllRefsForObjectLiteralProperties.ts @@ -1,11 +1,11 @@ /// ////var x = { -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}property|]: {}|] +//// /*1*/property: {} ////}; //// -////x.[|property|]; +////x./*2*/property; //// -////[|let {[|{| "contextRangeIndex": 3 |}property|]: pVar} = x;|] +/////*3*/let {/*4*/property: pVar} = x; -verify.singleReferenceGroup("(property) property: {}", "property"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsForRest.ts b/tests/cases/fourslash/findAllRefsForRest.ts index 81aadfe69c9..4b4266e04c1 100644 --- a/tests/cases/fourslash/findAllRefsForRest.ts +++ b/tests/cases/fourslash/findAllRefsForRest.ts @@ -1,11 +1,11 @@ -/// -////interface Gen { -//// x: number -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}parent|]: Gen;|] -//// millenial: string; -////} -////let t: Gen; -////var { x, ...rest } = t; -////rest.[|parent|]; - -verify.singleReferenceGroup("(property) Gen.parent: Gen", "parent"); +/// +////interface Gen { +//// x: number +//// /*1*/parent: Gen; +//// millenial: string; +////} +////let t: Gen; +////var { x, ...rest } = t; +////rest./*2*/parent; + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts b/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts index 312bce4a3ad..1ec292f67c5 100644 --- a/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts +++ b/tests/cases/fourslash/findAllRefsForStringLiteralTypes.ts @@ -1,6 +1,6 @@ /// -////type Options = "[|{| "isInString": true |}option 1|]" | "option 2"; -////let myOption: Options = "[|{| "isInString": true |}option 1|]"; +////type Options = "/*1*/option 1" | "option 2"; +////let myOption: Options = "/*2*/option 1"; -verify.singleReferenceGroup('"option 1"'); +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts b/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts index 10776d35617..2aa87e3e73a 100644 --- a/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts +++ b/tests/cases/fourslash/findAllRefsForUMDModuleAlias1.ts @@ -4,10 +4,10 @@ //// export function doThing(): string; //// export function doTheOtherThing(): void; -//// [|export as namespace [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}myLib|];|] +//// /*1*/export as namespace /*2*/myLib; // @Filename: 1.ts //// /// -//// [|myLib|].doThing(); +//// /*3*/myLib.doThing(); -verify.singleReferenceGroup("export namespace myLib", "myLib"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts b/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts index 20037640a8c..297eb1a5335 100644 --- a/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts +++ b/tests/cases/fourslash/findAllRefsForVariableInExtendsClause01.ts @@ -1,6 +1,6 @@ /// -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Base|] = class { };|] -////class C extends [|Base|] { } +/////*1*/var /*2*/Base = class { }; +////class C extends /*3*/Base { } -verify.singleReferenceGroup("var Base: typeof Base", "Base"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts b/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts index da9faa17ef4..49998f34a99 100644 --- a/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts +++ b/tests/cases/fourslash/findAllRefsForVariableInExtendsClause02.ts @@ -1,9 +1,9 @@ /// -////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Base|] { }|] +/////*1*/interface /*2*/Base { } ////namespace n { //// var Base = class { }; -//// interface I extends [|Base|] { } +//// interface I extends /*3*/Base { } ////} -verify.singleReferenceGroup("interface Base", "Base"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsGlobalModuleAugmentation.ts b/tests/cases/fourslash/findAllRefsGlobalModuleAugmentation.ts index 68f691e27f5..e1804d2481b 100644 --- a/tests/cases/fourslash/findAllRefsGlobalModuleAugmentation.ts +++ b/tests/cases/fourslash/findAllRefsGlobalModuleAugmentation.ts @@ -1,13 +1,13 @@ -/// - -// @Filename: /a.ts -////export {}; -////declare global { -//// [|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}f|](): void;|] -////} - -// @Filename: /b.ts -////[|f|](); - -verify.noErrors(); -verify.singleReferenceGroup("function f(): void", "f"); +/// + +// @Filename: /a.ts +////export {}; +////declare global { +//// /*1*/function /*2*/f(): void; +////} + +// @Filename: /b.ts +/////*3*/f(); + +verify.noErrors(); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsImportType.ts b/tests/cases/fourslash/findAllRefsImportType.ts index 5ae1495ca55..887d9aaa834 100644 --- a/tests/cases/fourslash/findAllRefsImportType.ts +++ b/tests/cases/fourslash/findAllRefsImportType.ts @@ -1,12 +1,12 @@ -/// - -// @allowJs: true - -// @Filename: /a.js -////module.exports = 0; -////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}N|] = number;|] - -// @Filename: /b.js -////type T = import("./a").[|N|]; - -verify.singleReferenceGroup("type N = number", "N"); +/// + +// @allowJs: true + +// @Filename: /a.js +////module.exports = 0; +/////*1*/export type /*2*/N = number; + +// @Filename: /b.js +////type T = import("./a")./*3*/N; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts b/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts index aa80c6c3c1f..699155756cd 100644 --- a/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts +++ b/tests/cases/fourslash/findAllRefsIndexedAccessTypes.ts @@ -1,13 +1,12 @@ /// ////interface I { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}0|]: number;|] -//// [|[|{| "isDefinition": true, "contextRangeIndex": 2 |}s|]: string;|] +//// /*1*/0: number; +//// /*2*/s: string; ////} ////interface J { -//// a: I[[|0|]], -//// b: I["[|s|]"], +//// a: I[/*3*/0], +//// b: I["/*4*/s"], ////} -verify.singleReferenceGroup("(property) I[0]: number", "0"); -verify.singleReferenceGroup("(property) I.s: string", "s"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties1.ts b/tests/cases/fourslash/findAllRefsInheritedProperties1.ts index f2eef8e3a99..a0be082a24b 100644 --- a/tests/cases/fourslash/findAllRefsInheritedProperties1.ts +++ b/tests/cases/fourslash/findAllRefsInheritedProperties1.ts @@ -1,14 +1,12 @@ /// //// class class1 extends class1 { -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}doStuff|]() { }|] -//// [|[|{| "isDefinition": true, "contextRangeIndex": 2 |}propName|]: string;|] +//// /*1*/doStuff() { } +//// /*2*/propName: string; //// } //// //// var v: class1; -//// v.[|doStuff|](); -//// v.[|propName|]; +//// v./*3*/doStuff(); +//// v./*4*/propName; -const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); -verify.singleReferenceGroup("(method) class1.doStuff(): void", [r0, r2]); -verify.singleReferenceGroup("(property) class1.propName: string", [r1, r3]); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsInheritedProperties2.ts b/tests/cases/fourslash/findAllRefsInheritedProperties2.ts index 11795273799..2b37dcc02c9 100644 --- a/tests/cases/fourslash/findAllRefsInheritedProperties2.ts +++ b/tests/cases/fourslash/findAllRefsInheritedProperties2.ts @@ -1,14 +1,12 @@ /// //// interface interface1 extends interface1 { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}doStuff|](): void;|] // r0 -//// [|[|{| "isDefinition": true, "contextRangeIndex": 2 |}propName|]: string;|] // r1 +//// /*1*/doStuff(): void; // r0 +//// /*2*/propName: string; // r1 //// } //// //// var v: interface1; -//// v.[|doStuff|](); // r2 -//// v.[|propName|]; // r3 +//// v./*3*/doStuff(); // r2 +//// v./*4*/propName; // r3 -const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); -verify.singleReferenceGroup("(method) interface1.doStuff(): void", [r0, r2]); -verify.singleReferenceGroup("(property) interface1.propName: string", [r1, r3]); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsInsideTemplates1.ts b/tests/cases/fourslash/findAllRefsInsideTemplates1.ts index 14e7d339991..1111f03ad1e 100644 --- a/tests/cases/fourslash/findAllRefsInsideTemplates1.ts +++ b/tests/cases/fourslash/findAllRefsInsideTemplates1.ts @@ -1,6 +1,6 @@ /// -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] = 10;|] -////var y = `${ [|x|] } ${ [|x|] }` +/////*1*/var /*2*/x = 10; +////var y = `${ /*3*/x } ${ /*4*/x }` -verify.singleReferenceGroup("var x: number", "x"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsInsideTemplates2.ts b/tests/cases/fourslash/findAllRefsInsideTemplates2.ts index 8096081e363..37f6394b7d0 100644 --- a/tests/cases/fourslash/findAllRefsInsideTemplates2.ts +++ b/tests/cases/fourslash/findAllRefsInsideTemplates2.ts @@ -1,6 +1,6 @@ /// -////[|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}f|](...rest: any[]) { }|] -////[|f|] `${ [|f|] } ${ [|f|] }` +/////*1*/function /*2*/f(...rest: any[]) { } +/////*3*/f `${ /*4*/f } ${ /*5*/f }` -verify.singleReferenceGroup("function f(...rest: any[]): void", "f"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); diff --git a/tests/cases/fourslash/findAllRefsInsideWithBlock.ts b/tests/cases/fourslash/findAllRefsInsideWithBlock.ts index 991bf257538..f70c8290c92 100644 --- a/tests/cases/fourslash/findAllRefsInsideWithBlock.ts +++ b/tests/cases/fourslash/findAllRefsInsideWithBlock.ts @@ -1,12 +1,12 @@ /// -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] = 0;|] +/////*1*/var /*2*/x = 0; //// ////with ({}) { //// var y = x; // Reference of x here should not be picked -//// /*2*/y++; // also reference for y should be ignored +//// y++; // also reference for y should be ignored ////} //// -////[|{| "isWriteAccess": true |}x|] = [|x|] + 1; +/////*3*/x = /*4*/x + 1; -verify.singleReferenceGroup("var x: number", "x"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts b/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts index 3c1930eb37b..1016a8244c2 100644 --- a/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts +++ b/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class.ts @@ -1,6 +1,6 @@ -/// - -/////** @template [|T|] */ -////class C<[|{| "isWriteAccess": true, "isDefinition": true |}T|]> {} - -verify.singleReferenceGroup("(type parameter) T in C"); +/// + +/////** @template /*1*/T */ +////class C {} + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class_js.ts b/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class_js.ts index 8ec2e86fadb..423181908e1 100644 --- a/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class_js.ts +++ b/tests/cases/fourslash/findAllRefsJsDocTemplateTag_class_js.ts @@ -1,16 +1,16 @@ -/// - -// @allowJs: true -// @Filename: /a.js - -// Both uses of T should be referenced. - -/////** @template [|{| "isWriteAccess": true, "isDefinition": true |}T|] */ -////class C { -//// constructor() { -//// /** @type {[|T|]} */ -//// this.x = null; -//// } -////} - -verify.singleReferenceGroup("(type parameter) T in C", test.ranges()); +/// + +// @allowJs: true +// @Filename: /a.js + +// Both uses of T should be referenced. + +/////** @template /*1*/T */ +////class C { +//// constructor() { +//// /** @type {/*2*/T} */ +//// this.x = null; +//// } +////} + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts b/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts index 394c7cf5e5e..fbcb8bc5341 100644 --- a/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts +++ b/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function.ts @@ -1,6 +1,6 @@ -/// - -/////** @template [|{| "isWriteAccess": false, "isDefinition": false |}T|] */ -////function f<[|{| "isWriteAccess": true, "isDefinition": true |}T|]>() {} - -verify.singleReferenceGroup("(type parameter) T in f(): void"); +/// + +/////** @template /*1*/T */ +////function f() {} + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function_js.ts b/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function_js.ts index 0eb20cc32d6..1b6f7856f1a 100644 --- a/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function_js.ts +++ b/tests/cases/fourslash/findAllRefsJsDocTemplateTag_function_js.ts @@ -1,12 +1,12 @@ -/// - -// @allowJs: true -// @Filename: /a.js - -/////** -//// * @template [|{| "isWriteAccess": true, "isDefinition": true |}T|] -//// * @return {[|T|]} -//// */ -////function f() {} - -verify.singleReferenceGroup("(type parameter) T"); // TODO:GH#??? should be "(type parameter) T in f(): void" +/// + +// @allowJs: true +// @Filename: /a.js + +/////** +//// * @template /*1*/T +//// * @return {/*2*/T} +//// */ +////function f() {} + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts b/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts index fb3cdf5bc33..2cf84058e90 100644 --- a/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts +++ b/tests/cases/fourslash/findAllRefsJsDocTypeDef_js.ts @@ -1,20 +1,20 @@ -/// - -// Tests that the scope of @typedef is not just the node immediately below it. - -// @allowJs: true - -// @Filename: /a.js -/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|]|] */ -//// -/////** -//// * @return {[|T|]} -//// */ -////function f(obj) { return 0; } -//// -/////** -//// * @return {[|T|]} -//// */ -////function f2(obj) { return 0; } - -verify.singleReferenceGroup("type T = number", "T"); +/// + +// Tests that the scope of @typedef is not just the node immediately below it. + +// @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; } + +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsMappedType.ts b/tests/cases/fourslash/findAllRefsMappedType.ts index a505f41a151..8993a239dca 100644 --- a/tests/cases/fourslash/findAllRefsMappedType.ts +++ b/tests/cases/fourslash/findAllRefsMappedType.ts @@ -1,10 +1,10 @@ -/// - -////interface T { [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}a|]: number;|] } -////type U = { readonly [K in keyof T]?: string }; -////declare const t: T; -////t.[|a|]; -////declare const u: U; -////u.[|a|]; - -verify.singleReferenceGroup("(property) T.a: number", "a"); +/// + +////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; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts b/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts index 4dca721d614..a1d5d212387 100644 --- a/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts +++ b/tests/cases/fourslash/findAllRefsMappedType_nonHomomorphic.ts @@ -1,10 +1,10 @@ -/// - -// @strict: true - -////function f(x: { [K in "m"]: number; }) { -//// x.[|m|]; -//// x.[|m|] -////} - -verify.singleReferenceGroup("(property) m: number"); +/// + +// @strict: true + +////function f(x: { [K in "m"]: number; }) { +//// x./*1*/m; +//// x./*2*/m +////} + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsModuleAugmentation.ts b/tests/cases/fourslash/findAllRefsModuleAugmentation.ts index 35e42f7088d..d99b423ed49 100644 --- a/tests/cases/fourslash/findAllRefsModuleAugmentation.ts +++ b/tests/cases/fourslash/findAllRefsModuleAugmentation.ts @@ -1,13 +1,13 @@ -/// - -// @Filename: /node_modules/foo/index.d.ts -////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|] = number;|] - -// @Filename: /a.ts -////import * as foo from "foo"; -////declare module "foo" { -//// export const x: [|T|]; -////} - -verify.noErrors(); -verify.singleReferenceGroup("type T = number", "T"); +/// + +// @Filename: /node_modules/foo/index.d.ts +/////*1*/export type /*2*/T = number; + +// @Filename: /a.ts +////import * as foo from "foo"; +////declare module "foo" { +//// export const x: /*3*/T; +////} + +verify.noErrors(); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsModuleDotExports.ts b/tests/cases/fourslash/findAllRefsModuleDotExports.ts index 2d9a67a2155..80e4006d0d1 100644 --- a/tests/cases/fourslash/findAllRefsModuleDotExports.ts +++ b/tests/cases/fourslash/findAllRefsModuleDotExports.ts @@ -1,12 +1,11 @@ -/// - -// @allowJs: true - -// @Filename: /a.js -////[|const b = require("[|{| "contextRangeIndex": 0 |}./b|]");|] - -// @Filename: /b.js -////[|[|{| "contextRangeIndex": 2 |}module|].exports = 0;|] - -const [r0Def, r0, rDef, r1] = test.ranges(); -verify.singleReferenceGroup('module "/b"', [r0, r1]); +/// + +// @allowJs: true + +// @Filename: /a.js +/////*1*/const b = require("/*2*/./b"); + +// @Filename: /b.js +/////*3*/module.exports = 0; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsNoImportClause.ts b/tests/cases/fourslash/findAllRefsNoImportClause.ts index 4226af2b4cf..0140fbb665e 100644 --- a/tests/cases/fourslash/findAllRefsNoImportClause.ts +++ b/tests/cases/fourslash/findAllRefsNoImportClause.ts @@ -3,9 +3,9 @@ // https://github.com/Microsoft/TypeScript/issues/15452 // @Filename: /a.ts -////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] = 0;|] +/////*1*/export const /*2*/x = 0; // @Filename: /b.ts ////import "./a"; -verify.singleReferenceGroup("const x: 0", "x"); +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts index ca1a23740ba..2ea5d39e20c 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName01.ts @@ -1,11 +1,11 @@ /// ////interface I { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}property1|]: number;|] +//// /*1*/property1: number; //// property2: string; ////} //// ////var foo: I; -////[|var { [|{| "contextRangeIndex": 2 |}property1|]: prop1 } = foo;|] +/////*2*/var { /*3*/property1: prop1 } = foo; -verify.singleReferenceGroup("(property) I.property1: number", "property1"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts index fba2676f6dd..9a2e5554f8a 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName02.ts @@ -1,11 +1,11 @@ /// ////interface I { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}property1|]: number;|] +//// /*1*/property1: number; //// property2: string; ////} //// ////var foo: I; -////[|var { [|{| "contextRangeIndex": 2 |}property1|]: {} } = foo;|] +/////*2*/var { /*3*/property1: {} } = foo; -verify.singleReferenceGroup("(property) I.property1: number", "property1"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts index 64413cc8cba..2b8e72de7bb 100644 --- a/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts +++ b/tests/cases/fourslash/findAllRefsObjectBindingElementPropertyName10.ts @@ -1,11 +1,11 @@ /// ////interface Recursive { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}next|]?: Recursive;|] +//// /*1*/next?: Recursive; //// value: any; ////} //// -////function f ([|{ [|{| "contextRangeIndex": 2 |}next|]: { [|{| "contextRangeIndex": 2 |}next|]: x} }: Recursive|]) { +////function f (/*2*/{ /*3*/next: { /*4*/next: x} }: Recursive) { ////} -verify.singleReferenceGroup("(property) Recursive.next?: Recursive", "next"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsOnDecorators.ts b/tests/cases/fourslash/findAllRefsOnDecorators.ts index 0c261c9dd5b..c992ec5b208 100644 --- a/tests/cases/fourslash/findAllRefsOnDecorators.ts +++ b/tests/cases/fourslash/findAllRefsOnDecorators.ts @@ -1,16 +1,16 @@ /// // @Filename: a.ts -////[|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}decorator|](target) { +/////*1*/function /*2*/decorator(target) { //// return target; -////}|] -////[|decorator|](); +////} +/////*3*/decorator(); // @Filename: b.ts -////@[|decorator|] @[|decorator|]("again") +////@/*4*/decorator @/*5*/decorator("again") ////class C { -//// @[|decorator|] +//// @/*6*/decorator //// method() {} ////} -verify.singleReferenceGroup("function decorator(target: any): any", "decorator"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6'); diff --git a/tests/cases/fourslash/findAllRefsOnDefinition.ts b/tests/cases/fourslash/findAllRefsOnDefinition.ts index f70d8a396c5..bb35604a1e5 100644 --- a/tests/cases/fourslash/findAllRefsOnDefinition.ts +++ b/tests/cases/fourslash/findAllRefsOnDefinition.ts @@ -7,9 +7,9 @@ //// //// } //// -//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}start|](){ +//// /*1*/public /*2*/start(){ //// return this; -//// }|] +//// } //// //// public stop(){ //// return this; @@ -20,7 +20,7 @@ ////import Second = require("./findAllRefsOnDefinition-import"); //// ////var second = new Second.Test() -////second.[|start|](); +////second./*3*/start(); ////second.stop(); -verify.singleReferenceGroup("(method) Test.start(): this", "start"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsOnDefinition2.ts b/tests/cases/fourslash/findAllRefsOnDefinition2.ts index 7041dc22282..17f7a6b525c 100644 --- a/tests/cases/fourslash/findAllRefsOnDefinition2.ts +++ b/tests/cases/fourslash/findAllRefsOnDefinition2.ts @@ -3,7 +3,7 @@ //@Filename: findAllRefsOnDefinition2-import.ts ////export module Test{ //// -//// [|export interface [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}start|] { }|] +//// /*1*/export interface /*2*/start { } //// //// export interface stop { } ////} @@ -11,7 +11,7 @@ //@Filename: findAllRefsOnDefinition2.ts ////import Second = require("./findAllRefsOnDefinition2-import"); //// -////var start: Second.Test.[|start|]; +////var start: Second.Test./*3*/start; ////var stop: Second.Test.stop; -verify.singleReferenceGroup("interface Test.start", "start"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts b/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts index e0a01693059..5a437bfaf6e 100644 --- a/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts +++ b/tests/cases/fourslash/findAllRefsOnPrivateParameterProperty1.ts @@ -1,12 +1,12 @@ /// ////class ABCD { -//// constructor(private x: number, public y: number, [|private [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}z|]: number|]) { +//// constructor(private x: number, public y: number, /*1*/private /*2*/z: number) { //// } //// //// func() { -//// return this.[|z|]; +//// return this./*3*/z; //// } ////} -verify.singleReferenceGroup("(property) ABCD.z: number", "z"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsPrimitive.ts b/tests/cases/fourslash/findAllRefsPrimitive.ts index bf704c6ae71..016b9e4bbb9 100644 --- a/tests/cases/fourslash/findAllRefsPrimitive.ts +++ b/tests/cases/fourslash/findAllRefsPrimitive.ts @@ -1,31 +1,31 @@ -// @noLib: true - -/// - -// @Filename: a.ts -////const x: [|any|] = 0; -////const any = 2; -////const y: [|any|] = any; - -////function f(b: [|boolean|]): [|boolean|]; - -////type T = [|never|]; type U = [|never|]; - -////function n(x: [|number|]): [|number|]; - -////function o(x: [|object|]): [|object|]; - -////function s(x: [|string|]): [|string|]; - -////function sy(s: [|symbol|]): [|symbol|]; - -////function v(v: [|void|]): [|void|]; - -// @Filename: b.ts -// const z: [|any|] = 0; - -test.rangesByText().forEach((ranges, text) => verify.singleReferenceGroup(text, ranges)); -verify.rangesWithSameTextAreDocumentHighlights(); - -goTo.rangeStart(test.ranges()[0]); -verify.renameInfoFailed(); +// @noLib: true + +/// + +// @Filename: a.ts +////const x: [|any|] = 0; +////const any = 2; +////const y: [|any|] = any; + +////function f(b: [|boolean|]): [|boolean|]; + +////type T = [|never|]; type U = [|never|]; + +////function n(x: [|number|]): [|number|]; + +////function o(x: [|object|]): [|object|]; + +////function s(x: [|string|]): [|string|]; + +////function sy(s: [|symbol|]): [|symbol|]; + +////function v(v: [|void|]): [|void|]; + +// @Filename: b.ts +// const z: [|any|] = 0; + +test.rangesByText().forEach((ranges, text) => verify.singleReferenceGroup(text, ranges)); +verify.rangesWithSameTextAreDocumentHighlights(); + +goTo.rangeStart(test.ranges()[0]); +verify.renameInfoFailed(); diff --git a/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts b/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts index 82daf720d19..12ab6037172 100644 --- a/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts +++ b/tests/cases/fourslash/findAllRefsPrimitiveJsDoc.ts @@ -1,11 +1,11 @@ -// @noLib: true - -/// - -/////** -//// * @param {[|number|]} n -//// * @returns {[|number|]} -//// */ -////function f(n: [|number|]): [|number|] {} - -verify.singleReferenceGroup("number"); +// @noLib: true + +/// + +/////** +//// * @param {/*1*/number} n +//// * @returns {/*2*/number} +//// */ +////function f(n: /*3*/number): /*4*/number {} + +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts b/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts index 5fc76f40240..40604552e23 100644 --- a/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts +++ b/tests/cases/fourslash/findAllRefsPrivateNameAccessors.ts @@ -1,10 +1,10 @@ /// ////class C { -//// [|get [|{|"isDefinition": true, "isWriteAccess":true, "contextRangeIndex": 0 |}#foo|](){ return 1; }|] -//// [|set [|{|"isDefinition": true, "isWriteAccess":true, "contextRangeIndex": 2 |}#foo|](value: number){ }|] +//// /*1*/get /*2*/#foo(){ return 1; } +//// /*3*/set /*4*/#foo(value: number){ } //// constructor() { -//// this.[|#foo|](); +//// this./*5*/#foo(); //// } ////} ////class D extends C { @@ -14,14 +14,11 @@ //// } ////} ////class E { -//// [|get [|{|"isDefinition": true, "isWriteAccess":true, "contextRangeIndex": 5 |}#foo|](){ return 1; }|] -//// [|set [|{|"isDefinition": true, "isWriteAccess":true, "contextRangeIndex": 7 |}#foo|](value: number){ }|] +//// /*6*/get /*7*/#foo(){ return 1; } +//// /*8*/set /*9*/#foo(value: number){ } //// constructor() { -//// this.[|#foo|](); +//// this./*10*/#foo(); //// } ////} -const [rC0DefGet, rC0Get, rC0DefSet, rC0Set, rC1, - rE0GetDef, rE0Get, rE0SetDef, rE0Set, rE1] = test.ranges(); -verify.singleReferenceGroup("(property) C.#foo: number", [rC0Get, rC0Set, rC1]); -verify.singleReferenceGroup("(property) E.#foo: number", [rE0Get, rE0Set, rE1]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'); diff --git a/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts b/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts index d90a7e3940f..8b3a61b70d3 100644 --- a/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts +++ b/tests/cases/fourslash/findAllRefsPrivateNameMethods.ts @@ -1,9 +1,9 @@ /// ////class C { -//// [|[|{|"isDefinition": true, "isWriteAccess":true, "contextRangeIndex": 0 |}#foo|](){ }|] +//// /*1*/#foo(){ } //// constructor() { -//// this.[|#foo|](); +//// this./*2*/#foo(); //// } ////} ////class D extends C { @@ -13,12 +13,10 @@ //// } ////} ////class E { -//// [|[|{|"isDefinition": true, "isWriteAccess":true, "contextRangeIndex": 3 |}#foo|](){ }|] +//// /*3*/#foo(){ } //// constructor() { -//// this.[|#foo|](); +//// this./*4*/#foo(); //// } ////} -const [rC0Def, rC0, rC1, rE0Def, rE0, rE1] = test.ranges(); -verify.singleReferenceGroup("(method) C.#foo(): void", [rC0, rC1]); -verify.singleReferenceGroup("(method) E.#foo(): void", [rE0, rE1]); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts b/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts index 06c886b7e44..9558fb994ec 100644 --- a/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts +++ b/tests/cases/fourslash/findAllRefsPrivateNameProperties.ts @@ -1,10 +1,10 @@ /// ////class C { -//// [|[|{|"isDefinition": true, "isWriteAccess": true, "contextRangeIndex": 0 |}#foo|] = 10;|] +//// /*1*/#foo = 10; //// constructor() { -//// this.[|{|"isWriteAccess": true|}#foo|] = 20; -//// [|#foo|] in this; +//// this./*2*/#foo = 20; +//// /*3*/#foo in this; //// } ////} ////class D extends C { @@ -14,12 +14,10 @@ //// } ////} ////class E { -//// [|[|{|"isDefinition": true, "contextRangeIndex": 4 |}#foo|]: number;|] +//// /*4*/#foo: number; //// constructor() { -//// this.[|{|"isWriteAccess": true|}#foo|] = 20; +//// this./*5*/#foo = 20; //// } ////} -const [rC0Def, rC0, rC1, rC2, rE0Def, rE0, rE1] = test.ranges(); -verify.singleReferenceGroup("(property) C.#foo: number", [rC0, rC1, rC2]); -verify.singleReferenceGroup("(property) E.#foo: number", [rE0, rE1]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); diff --git a/tests/cases/fourslash/findAllRefsReExport_broken.ts b/tests/cases/fourslash/findAllRefsReExport_broken.ts index 4e17e26224e..496c7a05426 100644 --- a/tests/cases/fourslash/findAllRefsReExport_broken.ts +++ b/tests/cases/fourslash/findAllRefsReExport_broken.ts @@ -1,6 +1,6 @@ -/// - -// @Filename: /a.ts -////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] };|] - -verify.singleReferenceGroup("export x", "x"); +/// + +// @Filename: /a.ts +/////*1*/export { /*2*/x }; + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsReExport_broken2.ts b/tests/cases/fourslash/findAllRefsReExport_broken2.ts index a9d73730679..47e41fb1608 100644 --- a/tests/cases/fourslash/findAllRefsReExport_broken2.ts +++ b/tests/cases/fourslash/findAllRefsReExport_broken2.ts @@ -1,6 +1,6 @@ -/// - -// @Filename: /a.ts -////[|export { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] } from "nonsense";|] - -verify.singleReferenceGroup("export x", "x"); +/// + +// @Filename: /a.ts +/////*1*/export { /*2*/x } from "nonsense"; + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/findAllRefsThisKeyword.ts b/tests/cases/fourslash/findAllRefsThisKeyword.ts index 9779169bdd0..89d084c1f55 100644 --- a/tests/cases/fourslash/findAllRefsThisKeyword.ts +++ b/tests/cases/fourslash/findAllRefsThisKeyword.ts @@ -1,33 +1,27 @@ /// // @noLib: true -////[|this|]; -////function f([|{| "isWriteAccess": true, "isDefinition": true |}this|]) { -//// return [|this|]; -//// function g([|{| "isWriteAccess": true, "isDefinition": true |}this|]) { return [|this|]; } +/////*1*/this; +////function f(/*2*/this) { +//// return /*3*/this; +//// function g(/*4*/this) { return /*5*/this; } ////} ////class C { //// static x() { -//// [|this|]; +//// /*6*/this; //// } //// static y() { -//// () => [|this|]; +//// () => /*7*/this; //// } //// constructor() { -//// [|this|]; +//// /*8*/this; //// } //// method() { -//// () => [|this|]; +//// () => /*9*/this; //// } ////} ////// These are *not* real uses of the 'this' keyword, they are identifiers. -////const x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 9 |}this|]: 0|] } -////x.[|this|]; +////const x = { /*10*/this: 0 } +////x./*11*/this; -const [glob, f0, f1, g0, g1, x, y, constructor, method, propDefDef, propDef, propUse] = test.ranges(); -verify.singleReferenceGroup("this: typeof globalThis", [glob]); -verify.singleReferenceGroup("(parameter) this: any", [f0, f1]); -verify.singleReferenceGroup("(parameter) this: any", [g0, g1]); -verify.singleReferenceGroup("this: typeof C", [x, y]); -verify.singleReferenceGroup("this: this", [constructor, method]); -verify.singleReferenceGroup("(property) this: number", [propDef, propUse]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'); diff --git a/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts b/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts index 807bc9bf194..d79a62e7c45 100644 --- a/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts +++ b/tests/cases/fourslash/findAllRefsThisKeywordMultipleFiles.ts @@ -1,15 +1,15 @@ /// // @Filename: file1.ts -////[|this|]; [|this|]; +/////*1*/this; /*2*/this; // @Filename: file2.ts -////[|this|]; -////[|this|]; +/////*3*/this; +/////*4*/this; // @Filename: file3.ts -//// ((x = [|this|], y) => [|this|])([|this|], [|this|]); +//// ((x = /*5*/this, y) => /*6*/this)(/*7*/this, /*8*/this); //// // different 'this' //// function f(this) { return this; } -verify.singleReferenceGroup("this: typeof globalThis"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8'); diff --git a/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts b/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts index d489a51ccdd..84a1128b31d 100644 --- a/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts +++ b/tests/cases/fourslash/findAllRefsTypeParameterInMergedInterface.ts @@ -1,6 +1,6 @@ -/// - -////interface I<[|{| "isWriteAccess": true, "isDefinition": true |}T|]> { a: [|T|] } -////interface I<[|{| "isWriteAccess": true, "isDefinition": true |}T|]> { b: [|T|] } - -verify.singleReferenceGroup("(type parameter) T in I"); +/// + +////interface I { a: /*2*/T } +////interface I { b: /*4*/T } + +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefsTypedef.ts b/tests/cases/fourslash/findAllRefsTypedef.ts index c17f568946d..7fc516acc55 100644 --- a/tests/cases/fourslash/findAllRefsTypedef.ts +++ b/tests/cases/fourslash/findAllRefsTypedef.ts @@ -1,15 +1,15 @@ -/// - -// @allowJs: true - -// @Filename: /a.js -/////** -//// * @typedef I {Object} -//// * [|@prop [|{| "isDefinition": true, "contextRangeIndex": 0 |}p|] {number} -//// |]*/ -//// -/////** @type {I} */ -////let x; -////x.[|p|]; - -verify.singleReferenceGroup("(property) p: number", "p"); +/// + +// @allowJs: true + +// @Filename: /a.js +/////** +//// * @typedef I {Object} +//// * /*1*/@prop /*2*/p {number} +//// */ +//// +/////** @type {I} */ +////let x; +////x./*3*/p; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsTypedef_importType.ts b/tests/cases/fourslash/findAllRefsTypedef_importType.ts index 4816406d518..18a3a40f5d6 100644 --- a/tests/cases/fourslash/findAllRefsTypedef_importType.ts +++ b/tests/cases/fourslash/findAllRefsTypedef_importType.ts @@ -1,14 +1,14 @@ -/// - -// @allowJs: true - -// @Filename: /a.js -////module.exports = 0; -/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Foo|]|] */ -////const dummy = 0; - -// @Filename: /b.js -/////** @type {import('./a').[|Foo|]} */ -////const x = 0; - -verify.singleReferenceGroup("type Foo = number", "Foo"); +/// + +// @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; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsTypeofImport.ts b/tests/cases/fourslash/findAllRefsTypeofImport.ts index c89c0037b59..ae954cf6cb5 100644 --- a/tests/cases/fourslash/findAllRefsTypeofImport.ts +++ b/tests/cases/fourslash/findAllRefsTypeofImport.ts @@ -1,8 +1,8 @@ -/// - -// @Filename: /a.ts -////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] = 0;|] -////declare const a: typeof import("./a"); -////a.[|x|]; - -verify.singleReferenceGroup("const x: 0", "x"); +/// + +// @Filename: /a.ts +/////*1*/export const /*2*/x = 0; +////declare const a: typeof import("./a"); +////a./*3*/x; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts index a63d511ef09..32db5c4a6c4 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames1.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}_bar|]() { return 0; }|] +//// /*1*/public /*2*/_bar() { return 0; } ////} //// ////var x: Foo; -////x.[|_bar|]; +////x./*3*/_bar; -verify.singleReferenceGroup("(method) Foo._bar(): number", "_bar"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts index bc449992fc0..ed7606b3508 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames2.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}__bar|]() { return 0; }|] +//// /*1*/public /*2*/__bar() { return 0; } ////} //// ////var x: Foo; -////x.[|__bar|]; +////x./*3*/__bar; -verify.singleReferenceGroup("(method) Foo.__bar(): number", "__bar"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts index 8af1468e8b8..c903a203db3 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames3.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}___bar|]() { return 0; }|] +//// /*1*/public /*2*/___bar() { return 0; } ////} //// ////var x: Foo; -////x.[|___bar|]; +////x./*3*/___bar; -verify.singleReferenceGroup("(method) Foo.___bar(): number", "___bar"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts index dcc15f35382..9cf7281fa5a 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames4.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}____bar|]() { return 0; }|] +//// /*1*/public /*2*/____bar() { return 0; } ////} //// ////var x: Foo; -////x.[|____bar|]; +////x./*3*/____bar; -verify.singleReferenceGroup("(method) Foo.____bar(): number", "____bar"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts index 26e7ed094ff..a1875b872da 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames5.ts @@ -3,14 +3,14 @@ ////class Foo { //// public _bar; //// public __bar; -//// [|public [|{| "isDefinition": true, "contextRangeIndex": 0 |}___bar|];|] +//// /*1*/public /*2*/___bar; //// public ____bar; ////} //// ////var x: Foo; ////x._bar; ////x.__bar; -////x.[|___bar|]; +////x./*3*/___bar; ////x.____bar; -verify.singleReferenceGroup("(property) Foo.___bar: any", "___bar"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts index 7b1a4066adf..915dfa2d453 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames6.ts @@ -2,15 +2,15 @@ ////class Foo { //// public _bar; -//// [|public [|{| "isDefinition": true, "contextRangeIndex": 0 |}__bar|];|] +//// /*1*/public /*2*/__bar; //// public ___bar; //// public ____bar; ////} //// ////var x: Foo; ////x._bar; -////x.[|__bar|]; +////x./*3*/__bar; ////x.___bar; ////x.____bar; -verify.singleReferenceGroup("(property) Foo.__bar: any", "__bar"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts index 1876e71d3ae..8ca3faf1180 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames7.ts @@ -1,7 +1,7 @@ /// -////[|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}__foo|]() { -//// [|__foo|](); -////}|] +/////*1*/function /*2*/__foo() { +//// /*3*/__foo(); +////} -verify.singleReferenceGroup("function __foo(): void", "__foo"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts index 1c8b80dde95..f6f54c52f51 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames8.ts @@ -1,7 +1,7 @@ /// -////([|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}__foo|]() { -//// [|__foo|](); -////}|]) +////(/*1*/function /*2*/__foo() { +//// /*3*/__foo(); +////}) -verify.singleReferenceGroup("(local function) __foo(): void", "__foo"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts index 5fd2097788e..eecb6016d01 100644 --- a/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts +++ b/tests/cases/fourslash/findAllRefsWithLeadingUnderscoreNames9.ts @@ -1,7 +1,7 @@ /// -////([|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}___foo|]() { -//// [|___foo|](); -////}|]) +////(/*1*/function /*2*/___foo() { +//// /*3*/___foo(); +////}) -verify.singleReferenceGroup("(local function) ___foo(): void", "___foo"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/findAllRefs_importType_meaningAtLocation.ts b/tests/cases/fourslash/findAllRefs_importType_meaningAtLocation.ts index 2671cd0c00a..2f88ec496ba 100644 --- a/tests/cases/fourslash/findAllRefs_importType_meaningAtLocation.ts +++ b/tests/cases/fourslash/findAllRefs_importType_meaningAtLocation.ts @@ -1,13 +1,11 @@ -/// - -// @Filename: /a.ts -////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|] = 0;|] -////[|export const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}T|] = 0;|] - -// @Filename: /b.ts -////const x: import("./a").[|T|] = 0; -////const x: typeof import("./a").[|T|] = 0; - -const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); -verify.singleReferenceGroup("type T = 0", [r0, r2]); -verify.singleReferenceGroup("const T: 0", [r1, r3]); +/// + +// @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; + +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6'); diff --git a/tests/cases/fourslash/findAllRefs_importType_named.ts b/tests/cases/fourslash/findAllRefs_importType_named.ts index 921464e9b83..ef5ec4416f9 100644 --- a/tests/cases/fourslash/findAllRefs_importType_named.ts +++ b/tests/cases/fourslash/findAllRefs_importType_named.ts @@ -1,13 +1,11 @@ -/// - -// @Filename: /a.ts -////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|] = number;|] -////[|export type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}U|] = string;|] - -// @Filename: /b.ts -////const x: import("./a").[|T|] = 0; -////const x: import("./a").[|U|] = 0; - -const [r0Def, r0, r1Def, r1, r2, r3] = test.ranges(); -verify.singleReferenceGroup("type T = number", [r0, r2]); -verify.singleReferenceGroup("type U = string", [r1, r3]); +/// + +// @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; + +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6'); diff --git a/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts b/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts index 89741206c74..83a2ab759d8 100644 --- a/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts +++ b/tests/cases/fourslash/findAllRefs_importType_typeofImport.ts @@ -1,10 +1,10 @@ -/// - -// @Filename: /a.ts -////export const x = 0; - -// @Filename: /b.ts -////[|const x: typeof import("[|{| "contextRangeIndex": 0 |}./a|]") = { x: 0 };|] -////[|const y: typeof import("[|{| "contextRangeIndex": 2 |}./a|]") = { x: 0 };|] - -verify.singleReferenceGroup('module "/a"', "./a"); +/// + +// @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 }; + +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findAllRefs_jsEnum.ts b/tests/cases/fourslash/findAllRefs_jsEnum.ts index d492cd84de4..2b7a9666036 100644 --- a/tests/cases/fourslash/findAllRefs_jsEnum.ts +++ b/tests/cases/fourslash/findAllRefs_jsEnum.ts @@ -1,16 +1,12 @@ -/// - -// @allowJs: true - -// @Filename: /a.js -/////** @enum {string} */ -////[|const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}E|] = { A: "" };|] -////[|E|]["A"]; -/////** @type {[|E|]} */ -////const e = [|E|].A; - -verify.singleReferenceGroup( -`type E = string -const E: { - A: string; -}`, "E"); +/// + +// @allowJs: true + +// @Filename: /a.js +/////** @enum {string} */ +/////*1*/const /*2*/E = { A: "" }; +/////*3*/E["A"]; +/////** @type {/*4*/E} */ +////const e = /*5*/E.A; + +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); \ No newline at end of file diff --git a/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts b/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts index bfa20f51959..e643a7fa72e 100644 --- a/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts +++ b/tests/cases/fourslash/findReferencesAcrossMultipleProjects.ts @@ -1,14 +1,14 @@ /// //@Filename: a.ts -////[|var [|{| "isDefinition": true, "contextRangeIndex": 0 |}x|]: number;|] +/////*1*/var /*2*/x: number; //@Filename: b.ts /////// -////[|{| "isWriteAccess": true |}x|]++; +/////*3*/x++; //@Filename: c.ts /////// -////[|{| "isWriteAccess": true |}x|]++; +/////*4*/x++; -verify.singleReferenceGroup("var x: number", "x"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/findReferencesJSXTagName2.ts b/tests/cases/fourslash/findReferencesJSXTagName2.ts index dc942720a0e..d89fbc1a4b6 100644 --- a/tests/cases/fourslash/findReferencesJSXTagName2.ts +++ b/tests/cases/fourslash/findReferencesJSXTagName2.ts @@ -1,9 +1,7 @@ /// // @Filename: index.tsx -////[|const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}obj|] = {Component: () =>
};|] -////const element = <[|obj|].Component/>; +/////*1*/const /*2*/obj = {Component: () =>
}; +////const element = ; -verify.singleReferenceGroup(`const obj: { - Component: () => any; -}`, "obj"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts index 839a270e611..60a2199e0c6 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfArrowFunction.ts @@ -1,5 +1,5 @@ -/// -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}f|] = x => x + 1;|] -////[|f|](12); - -verify.singleReferenceGroup("var f: (x: any) => any", "f"); +/// +/////*1*/var /*2*/f = x => x + 1; +/////*3*/f(12); + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts index c6ab29fd884..9e763aba6dd 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfClass.ts @@ -1,10 +1,10 @@ -/// -////[|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}C|] { -//// n: number; -//// constructor() { -//// this.n = 12; -//// } -////}|] -////let c = new [|C|](); - -verify.singleReferenceGroup("class C", "C"); +/// +/////*1*/class /*2*/C { +//// n: number; +//// constructor() { +//// this.n = 12; +//// } +////} +////let c = new /*3*/C(); + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts index 16c29b88006..28a9bd781b1 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfComputedProperty.ts @@ -1,6 +1,6 @@ -/// -////let o = { [|["[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}foo|]"]: 12|] }; -////let y = o.[|foo|]; -////let z = o['[|foo|]']; - -verify.singleReferenceGroup('(property) ["foo"]: number', "foo"); +/// +////let o = { /*1*/["/*2*/foo"]: 12 }; +////let y = o./*3*/foo; +////let z = o['/*4*/foo']; + +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts index 26010967b25..47a75d4ed05 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfEnum.ts @@ -1,8 +1,8 @@ -/// -////[|enum [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}E|] { -//// First, -//// Second -////}|] -////let first = [|E|].First; - -verify.singleReferenceGroup("enum E", "E"); +/// +/////*1*/enum /*2*/E { +//// First, +//// Second +////} +////let first = /*3*/E.First; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts index 1275671d433..d23a8b32ec5 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfFunction.ts @@ -1,6 +1,6 @@ -/// -////[|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}func|](x: number) { -////}|] -////[|func|](x) - -verify.singleReferenceGroup("function func(x: number): void", "func"); +/// +/////*1*/function /*2*/func(x: number) { +////} +/////*3*/func(x) + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts index 3fe4753feef..e90c3e74973 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterface.ts @@ -1,7 +1,7 @@ -/// -////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}I|] { -//// p: number; -////}|] -////let i: [|I|] = { p: 12 }; - -verify.singleReferenceGroup("interface I", "I"); +/// +/////*1*/interface /*2*/I { +//// p: number; +////} +////let i: /*3*/I = { p: 12 }; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts index a454f212531..316f42eb3d5 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfInterfaceClassMerge.ts @@ -1,16 +1,16 @@ -/// -////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Numbers|] { -//// p: number; -////}|] -////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}Numbers|] { -//// m: number; -////}|] -////[|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}Numbers|] { -//// f(n: number) { -//// return this.p + this.m + n; -//// } -////}|] -////let i: [|Numbers|] = new [|Numbers|](); -////let x = i.f(i.p + i.m); - -verify.singleReferenceGroup("class Numbers\ninterface Numbers", "Numbers"); +/// +/////*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); + +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts index 48ec42cdac0..e8b33f50778 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNamespace.ts @@ -1,7 +1,7 @@ -/// -////[|namespace [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Numbers|] { -//// export var n = 12; -////}|] -////let x = [|Numbers|].n + 1; - -verify.singleReferenceGroup("namespace Numbers", "Numbers"); +/// +/////*1*/namespace /*2*/Numbers { +//// export var n = 12; +////} +////let x = /*3*/Numbers.n + 1; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts index 02bdbb14f51..e7c37254efb 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfNumberNamedProperty.ts @@ -1,5 +1,5 @@ -/// -////let o = { [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}1|]: 12|] }; -////let y = o[[|1|]]; - -verify.singleReferenceGroup("(property) 1: number", "1"); +/// +////let o = { /*1*/1: 12 }; +////let y = o[/*2*/1]; + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts index 1a09882464a..be07ef5a1e2 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfParameter.ts @@ -1,6 +1,6 @@ -/// -////function f([|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|]: number|]) { -//// return [|x|] + 1 -////} - -verify.singleReferenceGroup("(parameter) x: number", "x"); +/// +////function f(/*1*/x: number) { +//// return /*2*/x + 1 +////} + +verify.baselineFindAllReferences('1', '2'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts index 1e806fc4968..e6752489df3 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfStringNamedProperty.ts @@ -1,5 +1,5 @@ -/// -////let o = { [|"[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|]": 12|] }; -////let y = o.[|x|]; - -verify.singleReferenceGroup('(property) "x": number', "x"); +/// +////let o = { /*1*/"/*2*/x": 12 }; +////let y = o./*3*/x; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts index dae8c5e3840..a48e83e374d 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfTypeAlias.ts @@ -1,5 +1,5 @@ -/// -////[|type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Alias|]= number;|] -////let n: [|Alias|] = 12; - -verify.singleReferenceGroup("type Alias = number", "Alias"); +/// +/////*1*/type /*2*/Alias= number; +////let n: /*3*/Alias = 12; + +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts b/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts index b90641779f6..48e2cadab8a 100644 --- a/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts +++ b/tests/cases/fourslash/getOccurrencesIsDefinitionOfVariable.ts @@ -1,20 +1,20 @@ /// -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}x|] = 0;|] -////var assignmentRightHandSide = [|x|]; -////var assignmentRightHandSide2 = 1 + [|x|]; +/////*1*/var /*2*/x = 0; +////var assignmentRightHandSide = /*3*/x; +////var assignmentRightHandSide2 = 1 + /*4*/x; //// -////[|{| "isWriteAccess": true |}x|] = 1; -////[|{| "isWriteAccess": true |}x|] = [|x|] + [|x|]; +/////*5*/x = 1; +/////*6*/x = /*7*/x + /*8*/x; //// -////[|x|] == 1; -////[|x|] <= 1; +/////*9*/x == 1; +/////*10*/x <= 1; //// -////var preIncrement = ++[|{| "isWriteAccess": true |}x|]; -////var postIncrement = [|{| "isWriteAccess": true |}x|]++; -////var preDecrement = --[|{| "isWriteAccess": true |}x|]; -////var postDecrement = [|{| "isWriteAccess": true |}x|]--; +////var preIncrement = ++/*11*/x; +////var postIncrement = /*12*/x++; +////var preDecrement = --/*13*/x; +////var postDecrement = /*14*/x--; //// -////[|{| "isWriteAccess": true |}x|] += 1; -////[|{| "isWriteAccess": true |}x|] <<= 1; +/////*15*/x += 1; +/////*16*/x <<= 1; -verify.singleReferenceGroup("var x: number", "x"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16'); diff --git a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts index 44156116d2f..ce454d196ec 100644 --- a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts +++ b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning0.ts @@ -3,14 +3,11 @@ // @allowJs: true // @Filename: a.js -/////** [|@typedef {number} [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|]|] */ +/////** /*1*/@typedef {number} /*2*/T */ -////[|const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}T|] = 1;|] +/////*3*/const /*4*/T = 1; -/////** @type {[|T|]} */ -////const n = [|T|]; +/////** @type {/*5*/T} */ +////const n = /*6*/T; -const [t0Def, t0, v0Def, v0, t1, v1] = test.ranges(); - -verify.singleReferenceGroup("type T = number", [t0, t1]); -verify.singleReferenceGroup("const T: 1", [v0, v1]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6'); diff --git a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts index 10b076c55f8..1c0a7faa317 100644 --- a/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts +++ b/tests/cases/fourslash/jsdocTypedefTagSemanticMeaning1.ts @@ -4,9 +4,9 @@ // @Filename: a.js /////** @typedef {number} */ -////[|const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|] = 1;|] +/////*1*/const /*2*/T = 1; -/////** @type {[|T|]} */ -////const n = [|T|]; +/////** @type {/*3*/T} */ +////const n = /*4*/T; -verify.singleReferenceGroup("type T = number\nconst T: 1", "T"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/jsdocTypedefTagServices.ts b/tests/cases/fourslash/jsdocTypedefTagServices.ts index 7d9e4154c6c..e59713c3b23 100644 --- a/tests/cases/fourslash/jsdocTypedefTagServices.ts +++ b/tests/cases/fourslash/jsdocTypedefTagServices.ts @@ -1,29 +1,29 @@ -/// - -// @allowJs: true -// @Filename: a.js - -/////** -//// * Doc comment -//// * [|@typedef /*def*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Product|] -//// * @property {string} title -//// |]*/ - -/////** -//// * @type {[|/*use*/Product|]} -//// */ -////const product = null; - -const desc = `type Product = { - title: string; -}`; - -const [r0Def, ...ranges] = test.ranges(); -verify.quickInfoAt("use", desc, "Doc comment"); - -verify.goToDefinition("use", "def"); - -verify.rangesAreOccurrences(/*isWriteAccesss*/ undefined, ranges); -verify.rangesAreDocumentHighlights(ranges); -verify.singleReferenceGroup(desc, ranges); -verify.rangesAreRenameLocations(ranges); +/// + +// @allowJs: true +// @Filename: a.js + +/////** +//// * Doc comment +//// * [|@typedef /*def*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Product|] +//// * @property {string} title +//// |]*/ + +/////** +//// * @type {[|/*use*/Product|]} +//// */ +////const product = null; + +const desc = `type Product = { + title: string; +}`; + +const [r0Def, ...ranges] = test.ranges(); +verify.quickInfoAt("use", desc, "Doc comment"); + +verify.goToDefinition("use", "def"); + +verify.rangesAreOccurrences(/*isWriteAccesss*/ undefined, ranges); +verify.rangesAreDocumentHighlights(ranges); +verify.singleReferenceGroup(desc, ranges); +verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/quickInfoUntypedModuleImport.ts b/tests/cases/fourslash/quickInfoUntypedModuleImport.ts index 2e06c45107e..a25be529547 100644 --- a/tests/cases/fourslash/quickInfoUntypedModuleImport.ts +++ b/tests/cases/fourslash/quickInfoUntypedModuleImport.ts @@ -4,8 +4,8 @@ ////{} // @Filename: a.ts -////[|import /*foo*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}foo|] from /*fooModule*/"[|{| "isInString": true, "contextRangeIndex": 0 |}foo|]";|] -////[|foo|](); +////import /*foo*/foo from /*fooModule*/"foo"; +/////*fooCall*/foo(); goTo.file("a.ts"); verify.numberOfErrorsInCurrentFile(0); @@ -13,10 +13,9 @@ verify.numberOfErrorsInCurrentFile(0); goTo.marker("fooModule"); verify.goToDefinitionIs([]); verify.quickInfoIs(""); -const [r00, r0, r1, r2] = test.ranges(); -verify.singleReferenceGroup('"foo"', [r1]); goTo.marker("foo"); verify.goToDefinitionIs("foo"); verify.quickInfoIs("import foo"); -verify.singleReferenceGroup("import foo", [r0, r2]); + +verify.baselineFindAllReferences('foo', 'fooModule', 'fooCall'); diff --git a/tests/cases/fourslash/referenceToClass.ts b/tests/cases/fourslash/referenceToClass.ts index 37e5322165e..2a473b480a2 100644 --- a/tests/cases/fourslash/referenceToClass.ts +++ b/tests/cases/fourslash/referenceToClass.ts @@ -3,21 +3,21 @@ // Class references should work across file and not find local variables. // @Filename: referenceToClass_1.ts -////[|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}foo|] { -//// public n: [|foo|]; +////class /*1*/foo { +//// public n: /*2*/foo; //// public foo: number; -////}|] +////} //// ////class bar { -//// public n: [|foo|]; -//// public k = new [|foo|](); +//// public n: /*3*/foo; +//// public k = new /*4*/foo(); ////} //// ////module mod { -//// var k: [|foo|] = null; +//// var k: /*5*/foo = null; ////} // @Filename: referenceToClass_2.ts -////var k: [|foo|]; +////var k: /*6*/foo; -verify.singleReferenceGroup("class foo", "foo"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6') diff --git a/tests/cases/fourslash/referencesBloomFilters3.ts b/tests/cases/fourslash/referencesBloomFilters3.ts index 5d6d68c9dd5..cb183e7f8f4 100644 --- a/tests/cases/fourslash/referencesBloomFilters3.ts +++ b/tests/cases/fourslash/referencesBloomFilters3.ts @@ -4,9 +4,9 @@ // @Filename: declaration.ts -////enum Test { [|"[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}42|]" = 1|] }; +////enum Test { /*1*/"/*2*/42" = 1 }; // @Filename: expression.ts -////(Test[[|42|]]); +////(Test[/*3*/42]); -verify.singleReferenceGroup('(enum member) Test["42"] = 1', "42"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForAmbients.ts b/tests/cases/fourslash/referencesForAmbients.ts index 6852ad8f2cb..1c843350999 100644 --- a/tests/cases/fourslash/referencesForAmbients.ts +++ b/tests/cases/fourslash/referencesForAmbients.ts @@ -1,21 +1,17 @@ /// -////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}foo|]" { -//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}f|]: number;|] -////}|] +/////*1*/declare module "/*2*/foo" { +//// /*3*/var /*4*/f: number; +////} //// -////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}bar|]" { -//// [|export import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}foo|] = require("[|{| "contextRangeIndex": 6 |}foo|]");|] -//// var f2: typeof [|foo|].[|f|]; -////}|] +/////*5*/declare module "/*6*/bar" { +//// /*7*/export import /*8*/foo = require("/*9*/foo"); +//// var f2: typeof /*10*/foo./*11*/f; +////} //// ////declare module "baz" { -//// [|import bar = require("[|{| "contextRangeIndex": 11 |}bar|]");|] -//// var f2: typeof bar.[|foo|]; +//// /*12*/import bar = require("/*13*/bar"); +//// var f2: typeof bar./*14*/foo; ////} -const [moduleFoo0Def, moduleFoo0, f0Def, f0, moduleBar0Def, moduleBar0, foo0Def, foo0, moduleFoo1, foo1, f1, moduleBar1Def, moduleBar1, foo2] = test.ranges(); -verify.singleReferenceGroup('module "foo"', [moduleFoo0, moduleFoo1]); -verify.singleReferenceGroup('module "bar"', [moduleBar0, moduleBar1]); -verify.singleReferenceGroup('(alias) module "foo"\nimport foo = require("foo")', [foo0, foo1, foo2]); -verify.singleReferenceGroup("var f: number", [f0, f1]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14'); diff --git a/tests/cases/fourslash/referencesForAmbients2.ts b/tests/cases/fourslash/referencesForAmbients2.ts index 2ec60cf3731..263f3d21ea9 100644 --- a/tests/cases/fourslash/referencesForAmbients2.ts +++ b/tests/cases/fourslash/referencesForAmbients2.ts @@ -2,20 +2,20 @@ // @Filename: /defA.ts ////declare module "a" { -//// [|export type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}T|] = number;|] +//// /*1*/export type /*2*/T = number; ////} // @Filename: /defB.ts ////declare module "b" { //// export import a = require("a"); -//// export const x: a.[|T|]; +//// export const x: a./*3*/T; ////} // @Filename: /defC.ts ////declare module "c" { //// import b = require("b"); -//// const x: b.a.[|T|]; +//// const x: b.a./*4*/T; ////} verify.noErrors(); -verify.singleReferenceGroup("type T = number", "T"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForClassLocal.ts b/tests/cases/fourslash/referencesForClassLocal.ts index 406b512d62b..8332c775ccc 100644 --- a/tests/cases/fourslash/referencesForClassLocal.ts +++ b/tests/cases/fourslash/referencesForClassLocal.ts @@ -5,14 +5,14 @@ ////var n = 14; //// ////class foo { -//// [|private [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}n|] = 0;|] +//// /*1*/private /*2*/n = 0; //// //// public bar() { -//// this.[|{| "isWriteAccess": true |}n|] = 9; +//// this./*3*/n = 9; //// } //// //// constructor() { -//// this.[|{| "isWriteAccess": true |}n|] = 4; +//// this./*4*/n = 4; //// } //// //// public bar2() { @@ -20,4 +20,4 @@ //// } ////} -verify.singleReferenceGroup("(property) foo.n: number", "n"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForClassParameter.ts b/tests/cases/fourslash/referencesForClassParameter.ts index 011be7e85bb..57dbdc44050 100644 --- a/tests/cases/fourslash/referencesForClassParameter.ts +++ b/tests/cases/fourslash/referencesForClassParameter.ts @@ -7,16 +7,16 @@ ////class p { } //// ////class foo { -//// constructor ([|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}p|]: any|]) { +//// constructor (/*1*/public /*2*/p: any) { //// } //// //// public f(p) { -//// this.[|{| "isWriteAccess": true |}p|] = p; +//// this./*3*/p = p; //// } //// ////} //// ////var n = new foo(undefined); -////n.[|{| "isWriteAccess": true |}p|] = null; +////n./*4*/p = null; -verify.singleReferenceGroup("(property) foo.p: any", "p"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForEnums.ts b/tests/cases/fourslash/referencesForEnums.ts index 395dee4a3a7..161d3e602d3 100644 --- a/tests/cases/fourslash/referencesForEnums.ts +++ b/tests/cases/fourslash/referencesForEnums.ts @@ -1,16 +1,14 @@ /// ////enum E { -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}value1|] = 1|], -//// [|"[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}value2|]" = [|value1|]|], -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 5 |}111|] = 11|] +//// /*1*/value1 = 1, +//// /*2*/"/*3*/value2" = /*4*/value1, +//// /*5*/111 = 11 ////} //// -////E.[|value1|]; -////E["[|value2|]"]; -////E.[|value2|]; -////E[[|111|]]; +////E./*6*/value1; +////E["/*7*/value2"]; +////E./*8*/value2; +////E[/*9*/111]; -verify.singleReferenceGroup("(enum member) E.value1 = 1", "value1"); -verify.singleReferenceGroup("(enum member) E[\"value2\"] = 1", "value2"); -verify.singleReferenceGroup("(enum member) E[111] = 11", "111"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9'); diff --git a/tests/cases/fourslash/referencesForExportedValues.ts b/tests/cases/fourslash/referencesForExportedValues.ts index c623e270bed..4cc782b0bcf 100644 --- a/tests/cases/fourslash/referencesForExportedValues.ts +++ b/tests/cases/fourslash/referencesForExportedValues.ts @@ -1,13 +1,13 @@ /// ////module M { -//// [|export var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}variable|] = 0;|] +//// /*1*/export var /*2*/variable = 0; //// //// // local use -//// var x = [|variable|]; +//// var x = /*3*/variable; ////} //// ////// external use -////M.[|variable|] +////M./*4*/variable -verify.singleReferenceGroup("var M.variable: number", "variable"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForExternalModuleNames.ts b/tests/cases/fourslash/referencesForExternalModuleNames.ts index 699e04a518a..32bb3c22968 100644 --- a/tests/cases/fourslash/referencesForExternalModuleNames.ts +++ b/tests/cases/fourslash/referencesForExternalModuleNames.ts @@ -1,11 +1,11 @@ /// // @Filename: referencesForGlobals_1.ts -////[|declare module "[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}foo|]" { +/////*1*/declare module "/*2*/foo" { //// var f: number; -////}|] +////} // @Filename: referencesForGlobals_2.ts -////[|import f = require("[|{| "contextRangeIndex": 2 |}foo|]");|] +/////*3*/import f = require("/*4*/foo"); -verify.singleReferenceGroup('module "foo"', "foo"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForFunctionOverloads.ts b/tests/cases/fourslash/referencesForFunctionOverloads.ts index a124321f464..0ab059347a0 100644 --- a/tests/cases/fourslash/referencesForFunctionOverloads.ts +++ b/tests/cases/fourslash/referencesForFunctionOverloads.ts @@ -2,9 +2,9 @@ // Function overloads should be highlighted together. -////[|function [|{| "isDefinition": true, "contextRangeIndex": 0 |}foo|](x: string);|] -////[|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}foo|](x: string, y: number) { -//// [|foo|]('', 43); -////}|] +/////*1*/function /*2*/foo(x: string); +/////*3*/function /*4*/foo(x: string, y: number) { +//// /*5*/foo('', 43); +////} -verify.singleReferenceGroup("function foo(x: string): any", "foo"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); diff --git a/tests/cases/fourslash/referencesForFunctionParameter.ts b/tests/cases/fourslash/referencesForFunctionParameter.ts index 83baed3b834..0c08d614a9d 100644 --- a/tests/cases/fourslash/referencesForFunctionParameter.ts +++ b/tests/cases/fourslash/referencesForFunctionParameter.ts @@ -3,9 +3,9 @@ ////var x; ////var n; //// -////function n(x: number, [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}n|]: number|]) { -//// [|{| "isWriteAccess": true |}n|] = 32; -//// x = [|n|]; +////function n(x: number, /*1*/n: number) { +//// /*2*/n = 32; +//// x = /*3*/n; ////} -verify.singleReferenceGroup("(parameter) n: number", "n"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForGlobals.ts b/tests/cases/fourslash/referencesForGlobals.ts index 0cbe1aae9fa..8f5829769df 100644 --- a/tests/cases/fourslash/referencesForGlobals.ts +++ b/tests/cases/fourslash/referencesForGlobals.ts @@ -3,7 +3,7 @@ // Global variable reference. // @Filename: referencesForGlobals_1.ts -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}global|] = 2;|] +/////*1*/var /*2*/global = 2; //// ////class foo { //// constructor (public global) { } @@ -13,16 +13,16 @@ //// ////class bar { //// constructor () { -//// var n = [|global|]; +//// var n = /*3*/global; //// //// var f = new foo(''); //// f.global = ''; //// } ////} //// -////var k = [|global|]; +////var k = /*4*/global; // @Filename: referencesForGlobals_2.ts -////var m = [|global|]; +////var m = /*5*/global; -verify.singleReferenceGroup("var global: number", "global"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); diff --git a/tests/cases/fourslash/referencesForGlobals2.ts b/tests/cases/fourslash/referencesForGlobals2.ts index 35399447455..b150336d718 100644 --- a/tests/cases/fourslash/referencesForGlobals2.ts +++ b/tests/cases/fourslash/referencesForGlobals2.ts @@ -3,11 +3,11 @@ // Global class reference. // @Filename: referencesForGlobals_1.ts -////[|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}globalClass|] { +/////*1*/class /*2*/globalClass { //// public f() { } -////}|] +////} // @Filename: referencesForGlobals_2.ts -////var c = [|globalClass|](); +////var c = /*3*/globalClass(); -verify.singleReferenceGroup("class globalClass", "globalClass"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForGlobals3.ts b/tests/cases/fourslash/referencesForGlobals3.ts index 76c7f4d54e3..e0829b018a8 100644 --- a/tests/cases/fourslash/referencesForGlobals3.ts +++ b/tests/cases/fourslash/referencesForGlobals3.ts @@ -3,11 +3,11 @@ // Global interface reference. // @Filename: referencesForGlobals_1.ts -////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}globalInterface|] { +/////*1*/interface /*2*/globalInterface { //// f(); -////}|] +////} // @Filename: referencesForGlobals_2.ts -////var i: [|globalInterface|]; +////var i: /*3*/globalInterface; -verify.singleReferenceGroup("interface globalInterface", "globalInterface"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForGlobals4.ts b/tests/cases/fourslash/referencesForGlobals4.ts index 3ce0bf541a9..2d7941eaca7 100644 --- a/tests/cases/fourslash/referencesForGlobals4.ts +++ b/tests/cases/fourslash/referencesForGlobals4.ts @@ -3,11 +3,11 @@ // Global module reference. // @Filename: referencesForGlobals_1.ts -////[|module [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}globalModule|] { +/////*1*/module /*2*/globalModule { //// export f() { }; -////}|] +////} // @Filename: referencesForGlobals_2.ts -////var m = [|globalModule|]; +////var m = /*3*/globalModule; -verify.singleReferenceGroup("namespace globalModule", "globalModule"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForGlobals5.ts b/tests/cases/fourslash/referencesForGlobals5.ts index b0be1609cf8..291b2ac1b0e 100644 --- a/tests/cases/fourslash/referencesForGlobals5.ts +++ b/tests/cases/fourslash/referencesForGlobals5.ts @@ -7,9 +7,9 @@ //// export var x; ////} //// -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}globalAlias|] = globalModule;|] +/////*1*/import /*2*/globalAlias = globalModule; // @Filename: referencesForGlobals_2.ts -////var m = [|globalAlias|]; +////var m = /*3*/globalAlias; -verify.singleReferenceGroup("(alias) namespace globalAlias\nimport globalAlias = globalModule", "globalAlias"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts b/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts index 3c3af49a382..9de888c2324 100644 --- a/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts +++ b/tests/cases/fourslash/referencesForGlobalsInExternalModule.ts @@ -2,23 +2,20 @@ // Global variable reference. -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}topLevelVar|] = 2;|] -////var topLevelVar2 = [|topLevelVar|]; +/////*1*/var /*2*/topLevelVar = 2; +////var topLevelVar2 = /*3*/topLevelVar; //// -////[|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 3 |}topLevelClass|] { }|] -////var c = new [|topLevelClass|](); +/////*4*/class /*5*/topLevelClass { } +////var c = new /*6*/topLevelClass(); //// -////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}topLevelInterface|] { }|] -////var i: [|topLevelInterface|]; +/////*7*/interface /*8*/topLevelInterface { } +////var i: /*9*/topLevelInterface; //// -////[|module [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 9 |}topLevelModule|] { +/////*10*/module /*11*/topLevelModule { //// export var x; -////}|] -////var x = [|topLevelModule|].x; +////} +////var x = /*12*/topLevelModule.x; //// ////export = x; -verify.singleReferenceGroup("var topLevelVar: number", "topLevelVar"); -verify.singleReferenceGroup("class topLevelClass", "topLevelClass"); -verify.singleReferenceGroup("interface topLevelInterface", "topLevelInterface"); -verify.singleReferenceGroup("namespace topLevelModule", "topLevelModule"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'); diff --git a/tests/cases/fourslash/referencesForImports.ts b/tests/cases/fourslash/referencesForImports.ts index ed9ec91b6f8..257965f223c 100644 --- a/tests/cases/fourslash/referencesForImports.ts +++ b/tests/cases/fourslash/referencesForImports.ts @@ -5,11 +5,9 @@ //// export = $; ////} -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}$|] = require("jquery");|] -////[|$|]("a"); +/////*1*/import /*2*/$ = require("jquery"); +/////*3*/$("a"); -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 3 |}$|] = require("jquery");|] +/////*4*/import /*5*/$ = require("jquery"); -const [r0Def, r0, r1, r2Def, r2] = test.ranges(); -verify.singleReferenceGroup('import $ = require("jquery")', [r0, r1]); -verify.singleReferenceGroup('import $ = require("jquery")', [r2]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); diff --git a/tests/cases/fourslash/referencesForIndexProperty.ts b/tests/cases/fourslash/referencesForIndexProperty.ts index 6c5abf44200..5e23e05e4b2 100644 --- a/tests/cases/fourslash/referencesForIndexProperty.ts +++ b/tests/cases/fourslash/referencesForIndexProperty.ts @@ -3,13 +3,12 @@ // References a class property using string index access ////class Foo { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}property|]: number;|] -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}method|](): void { }|] +//// /*1*/property: number; +//// /*2*/method(): void { } ////} //// ////var f: Foo; -////f["[|property|]"]; -////f["[|method|]"]; +////f["/*3*/property"]; +////f["/*4*/method"]; -verify.singleReferenceGroup("(property) Foo.property: number", "property"); -verify.singleReferenceGroup("(method) Foo.method(): void", "method"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForIndexProperty2.ts b/tests/cases/fourslash/referencesForIndexProperty2.ts index 0f87c82f7d3..102fe582bff 100644 --- a/tests/cases/fourslash/referencesForIndexProperty2.ts +++ b/tests/cases/fourslash/referencesForIndexProperty2.ts @@ -3,6 +3,6 @@ // References to a unknown index property ////var a; -////a["[|{| "isInString": true |}blah|]"]; +////a["/*1*/blah"]; -verify.singleReferenceGroup('"blah"'); +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/referencesForIndexProperty3.ts b/tests/cases/fourslash/referencesForIndexProperty3.ts index 4cb763baec1..d8ef21a3ff0 100644 --- a/tests/cases/fourslash/referencesForIndexProperty3.ts +++ b/tests/cases/fourslash/referencesForIndexProperty3.ts @@ -3,13 +3,13 @@ // References to a property of the apparent type using string indexer ////interface Object { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}toMyString|]();|] +//// /*1*/toMyString(); ////} //// ////var y: Object; -////y.[|toMyString|](); +////y./*2*/toMyString(); //// ////var x = {}; -////x["[|toMyString|]"](); +////x["/*3*/toMyString"](); -verify.singleReferenceGroup("(method) Object.toMyString(): any", "toMyString"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForInheritedProperties3.ts b/tests/cases/fourslash/referencesForInheritedProperties3.ts index 3cff5ac7e99..a9d531a36f4 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties3.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties3.ts @@ -1,13 +1,12 @@ /// //// interface interface1 extends interface1 { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}doStuff|](): void;|] -//// [|[|{| "isDefinition": true, "contextRangeIndex": 2 |}propName|]: string;|] +//// /*1*/doStuff(): void; +//// /*2*/propName: string; //// } //// //// var v: interface1; -//// v.[|propName|]; -//// v.[|doStuff|](); +//// v./*3*/propName; +//// v./*4*/doStuff(); -verify.singleReferenceGroup("(method) interface1.doStuff(): void", "doStuff"); -verify.singleReferenceGroup("(property) interface1.propName: string", "propName"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForInheritedProperties4.ts b/tests/cases/fourslash/referencesForInheritedProperties4.ts index 7e2ec514213..05837e883d3 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties4.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties4.ts @@ -1,13 +1,12 @@ /// //// class class1 extends class1 { -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}doStuff|]() { }|] -//// [|[|{| "isDefinition": true, "contextRangeIndex": 2 |}propName|]: string;|] +//// /*1*/doStuff() { } +//// /*2*/propName: string; //// } //// //// var c: class1; -//// c.[|doStuff|](); -//// c.[|propName|]; +//// c./*3*/doStuff(); +//// c./*4*/propName; -verify.singleReferenceGroup("(method) class1.doStuff(): void", "doStuff"); -verify.singleReferenceGroup("(property) class1.propName: string", "propName"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForInheritedProperties9.ts b/tests/cases/fourslash/referencesForInheritedProperties9.ts index 941d286f86d..93f6415f96a 100644 --- a/tests/cases/fourslash/referencesForInheritedProperties9.ts +++ b/tests/cases/fourslash/referencesForInheritedProperties9.ts @@ -1,16 +1,14 @@ /// //// class D extends C { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}prop1|]: string;|] +//// /*1*/prop1: string; //// } //// //// class C extends D { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 2 |}prop1|]: string;|] +//// /*2*/prop1: string; //// } //// //// var c: C; -//// c.[|prop1|]; +//// c./*3*/prop1; -const [r0Def, r0, r1Def, r1, r2] = test.ranges(); -verify.singleReferenceGroup("(property) D.prop1: string", [r0]); -verify.singleReferenceGroup("(property) C.prop1: string", [r1, r2]); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForLabel.ts b/tests/cases/fourslash/referencesForLabel.ts index c7ee984b6a7..afe68b23c82 100644 --- a/tests/cases/fourslash/referencesForLabel.ts +++ b/tests/cases/fourslash/referencesForLabel.ts @@ -2,14 +2,12 @@ // Valid References for a label -////[|[|{| "contextRangeIndex": 0 |}label|]: while (true) { -//// if (false) [|break [|{| "contextRangeIndex": 2 |}label|];|] -//// if (true) [|continue [|{| "contextRangeIndex": 4 |}label|];|] -////}|] +/////*1*/label: while (true) { +//// if (false) /*2*/break /*3*/label; +//// if (true) /*4*/continue /*5*/label; +////} //// -////[|[|{| "contextRangeIndex": 6 |}label|]: while (false) { }|] +/////*6*/label: while (false) { } ////var label = "label"; -const [r0Def, r0, r1Def, r1, r2Def, r2, r3Def, r3] = test.ranges(); -verify.singleReferenceGroup("label", [r0, r1, r2]); -verify.singleReferenceGroup("label", [r3]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6'); diff --git a/tests/cases/fourslash/referencesForLabel3.ts b/tests/cases/fourslash/referencesForLabel3.ts index 4d666aff632..5701cf9070a 100644 --- a/tests/cases/fourslash/referencesForLabel3.ts +++ b/tests/cases/fourslash/referencesForLabel3.ts @@ -2,8 +2,8 @@ // References to unused label -////[|[|{| "contextRangeIndex": 0 |}label|]: while (true) { +/////*1*/label: while (true) { //// var label = "label"; -////}|] +////} -verify.singleReferenceGroup("label", "label"); +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/referencesForLabel4.ts b/tests/cases/fourslash/referencesForLabel4.ts index 4cf8bf2baf7..4181eeff69b 100644 --- a/tests/cases/fourslash/referencesForLabel4.ts +++ b/tests/cases/fourslash/referencesForLabel4.ts @@ -2,10 +2,10 @@ // References to a label outside function bounderies -////[|[|{| "contextRangeIndex": 0 |}label|]: function foo(label) { +/////*1*/label: function foo(label) { //// while (true) { -//// [|break [|{| "contextRangeIndex": 2 |}label|];|] +//// /*2*/break /*3*/label; //// } -////}|] +////} -verify.singleReferenceGroup("label", "label"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForLabel5.ts b/tests/cases/fourslash/referencesForLabel5.ts index 923c0be9c72..b3088c2e117 100644 --- a/tests/cases/fourslash/referencesForLabel5.ts +++ b/tests/cases/fourslash/referencesForLabel5.ts @@ -2,16 +2,14 @@ // References to shadowed label -////[|[|{| "contextRangeIndex": 0 |}label|]: while (true) { -//// if (false) [|break [|{| "contextRangeIndex": 2 |}label|];|] +/////*1*/label: while (true) { +//// if (false) /*2*/break /*3*/label; //// function blah() { -////[|[|{| "contextRangeIndex": 4 |}label|]: while (true) { -//// if (false) [|break [|{| "contextRangeIndex": 6 |}label|];|] -//// }|] +/////*4*/label: while (true) { +//// if (false) /*5*/break /*6*/label; +//// } //// } -//// if (false) [|break [|{| "contextRangeIndex": 8 |}label|];|] -//// }|] +//// if (false) /*7*/break /*8*/label; +//// } -const [ourter1Def, outer1, outer2Def, outer2, inner1Def, inner1, inner2Def, inner2, outer3Def, outer3] = test.ranges(); -verify.singleReferenceGroup("label", [outer1, outer2, outer3]); -verify.singleReferenceGroup("label", [inner1, inner2]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8'); diff --git a/tests/cases/fourslash/referencesForLabel6.ts b/tests/cases/fourslash/referencesForLabel6.ts index 0fbc468fc92..7530cfc586a 100644 --- a/tests/cases/fourslash/referencesForLabel6.ts +++ b/tests/cases/fourslash/referencesForLabel6.ts @@ -2,10 +2,9 @@ // References to labels with close names -////[|[|{| "contextRangeIndex": 0 |}labela|]: while (true) { -////[|[|{| "contextRangeIndex": 2 |}labelb|]: while (false) { [|break [|{| "contextRangeIndex": 4 |}labelb|];|] }|] +/////*1*/labela: while (true) { +/////*2*/labelb: while (false) { /*3*/break /*4*/labelb; } //// break labelc; -////}|] +////} -verify.singleReferenceGroup("labela", "labela"); -verify.singleReferenceGroup("labelb", "labelb"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations.ts b/tests/cases/fourslash/referencesForMergedDeclarations.ts index 22d17342afd..908f7da5ce2 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations.ts @@ -1,20 +1,17 @@ /// -////[|interface [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Foo|] { -////}|] +/////*1*/interface /*2*/Foo { +////} //// -////[|module [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}Foo|] { +/////*3*/module /*4*/Foo { //// export interface Bar { } -////}|] +////} //// -////[|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}Foo|](): void { -////}|] +/////*5*/function /*6*/Foo(): void { +////} //// -////var f1: [|Foo|].Bar; -////var f2: [|Foo|]; -////[|Foo|].bind(this); +////var f1: /*7*/Foo.Bar; +////var f2: /*8*/Foo; +/////*9*/Foo.bind(this); -const [type1Def, type1, namespace1Def, namespace1, value1Def, value1, namespace2, type2, value2] = test.ranges(); -verify.singleReferenceGroup("interface Foo\nnamespace Foo", [type1, type2]); -verify.singleReferenceGroup("namespace Foo", [namespace1, namespace2]); -verify.singleReferenceGroup("namespace Foo\nfunction Foo(): void", [value1, value2]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9'); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations2.ts b/tests/cases/fourslash/referencesForMergedDeclarations2.ts index f590c321385..8dbbd903a4c 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations2.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations2.ts @@ -6,13 +6,9 @@ //// ////function ATest() { } //// -////[|import [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}alias|] = ATest;|] // definition +/////*1*/import /*2*/alias = ATest; // definition //// -////var a: [|alias|].Bar; // namespace -////[|alias|].call(this); // value +////var a: /*3*/alias.Bar; // namespace +/////*4*/alias.call(this); // value -verify.singleReferenceGroup([ - "(alias) function alias(): void", - "(alias) namespace alias", - "import alias = ATest" -].join("\n"), "alias"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations4.ts b/tests/cases/fourslash/referencesForMergedDeclarations4.ts index 63dc543b9d2..50ee1f06a8a 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations4.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations4.ts @@ -2,24 +2,24 @@ // class and instantiated module -////[|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}testClass|] { +/////*1*/class /*2*/testClass { //// static staticMethod() { } //// method() { } -////}|] +////} //// -////[|module [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}testClass|] { +/////*3*/module /*4*/testClass { //// export interface Bar { //// //// } //// export var s = 0; -////}|] +////} //// -////var c1: [|testClass|]; -////var c2: [|testClass|].Bar; -////[|testClass|].staticMethod(); -////[|testClass|].prototype.method(); -////[|testClass|].bind(this); -////[|testClass|].s; -////new [|testClass|](); +////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(); -verify.singleReferenceGroup("class testClass\nnamespace testClass", "testClass"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations6.ts b/tests/cases/fourslash/referencesForMergedDeclarations6.ts index 1557fdb7201..a0c6794e73d 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations6.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations6.ts @@ -1,13 +1,13 @@ /// ////interface Foo { } -////[|module [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Foo|] { +/////*1*/module /*2*/Foo { //// export interface Bar { } //// export module Bar { export interface Baz { } } //// export function Bar() { } -////}|] +////} //// ////// module -////import a1 = [|Foo|]; +////import a1 = /*3*/Foo; -verify.singleReferenceGroup("namespace Foo", "Foo"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForMergedDeclarations8.ts b/tests/cases/fourslash/referencesForMergedDeclarations8.ts index 7434fda95b4..9aa83d201ba 100644 --- a/tests/cases/fourslash/referencesForMergedDeclarations8.ts +++ b/tests/cases/fourslash/referencesForMergedDeclarations8.ts @@ -3,11 +3,11 @@ ////interface Foo { } ////module Foo { //// export interface Bar { } -//// [|export module [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Bar|] { export interface Baz { } }|] +//// /*1*/export module /*2*/Bar { export interface Baz { } } //// export function Bar() { } ////} //// ////// module -////import a3 = Foo.[|Bar|].Baz; +////import a3 = Foo./*3*/Bar.Baz; -verify.singleReferenceGroup("namespace Foo.Bar", "Bar"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForObjectLiteralProperties.ts b/tests/cases/fourslash/referencesForObjectLiteralProperties.ts index 86e8cea583d..d89f194dbbf 100644 --- a/tests/cases/fourslash/referencesForObjectLiteralProperties.ts +++ b/tests/cases/fourslash/referencesForObjectLiteralProperties.ts @@ -2,10 +2,10 @@ // References to an object literal property -////var x = { [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}add|]: 0|], b: "string" }; -////x["[|add|]"]; -////x.[|add|]; +////var x = { /*1*/add: 0, b: "string" }; +////x["/*2*/add"]; +////x./*3*/add; ////var y = x; -////y.[|add|]; +////y./*4*/add; -verify.singleReferenceGroup("(property) add: number", "add"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts b/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts index c7cc345970a..e20a88d171e 100644 --- a/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts +++ b/tests/cases/fourslash/referencesForPropertiesOfGenericType.ts @@ -1,13 +1,13 @@ /// ////interface IFoo { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}doSomething|](v: T): T;|] +//// /*1*/doSomething(v: T): T; ////} //// ////var x: IFoo; -////x.[|doSomething|]("ss"); +////x./*2*/doSomething("ss"); //// ////var y: IFoo; -////y.[|doSomething|](12); +////y./*3*/doSomething(12); -verify.singleReferenceGroup("(method) IFoo.doSomething(v: T): T", "doSomething"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForStatic.ts b/tests/cases/fourslash/referencesForStatic.ts index 2571e379528..295d02a993f 100644 --- a/tests/cases/fourslash/referencesForStatic.ts +++ b/tests/cases/fourslash/referencesForStatic.ts @@ -6,28 +6,28 @@ ////var n = 43; //// ////class foo { -//// [|static [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}n|] = '';|] +//// /*1*/static /*2*/n = ''; //// //// public bar() { -//// foo.[|{| "isWriteAccess": true |}n|] = "'"; -//// if(foo.[|n|]) { -//// var x = foo.[|n|]; +//// foo./*3*/n = "'"; +//// if(foo./*4*/n) { +//// var x = foo./*5*/n; //// } //// } ////} //// ////class foo2 { -//// private x = foo.[|n|]; +//// private x = foo./*6*/n; //// constructor() { -//// foo.[|{| "isWriteAccess": true |}n|] = x; +//// foo./*7*/n = x; //// } //// //// function b(n) { -//// n = foo.[|n|]; +//// n = foo./*8*/n; //// } ////} // @Filename: referencesOnStatic_2.ts -////var q = foo.[|n|]; +////var q = foo./*9*/n; -verify.singleReferenceGroup("(property) foo.n: string", "n"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9'); diff --git a/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts b/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts index 655b4b9a308..7efa0eb97ae 100644 --- a/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts +++ b/tests/cases/fourslash/referencesForStaticsAndMembersWithSameNames.ts @@ -3,38 +3,30 @@ ////module FindRef4 { //// module MixedStaticsClassTest { //// export class Foo { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}bar|]: Foo;|] -//// [|static [|{| "isDefinition": true, "contextRangeIndex": 2 |}bar|]: Foo;|] +//// /*1*/bar: Foo; +//// /*2*/static /*3*/bar: Foo; //// -//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}foo|](): void { -//// }|] -//// [|public static [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}foo|](): void { -//// }|] +//// /*4*/public /*5*/foo(): void { +//// } +//// /*6*/public static /*7*/foo(): void { +//// } //// } //// } //// //// function test() { //// // instance function //// var x = new MixedStaticsClassTest.Foo(); -//// x.[|foo|](); -//// x.[|bar|]; +//// x./*8*/foo(); +//// x./*9*/bar; //// //// // static function -//// MixedStaticsClassTest.Foo.[|foo|](); -//// MixedStaticsClassTest.Foo.[|bar|]; +//// MixedStaticsClassTest.Foo./*10*/foo(); +//// MixedStaticsClassTest.Foo./*11*/bar; //// } ////} -const [fooBarDef, fooBar, fooStaticBarDef, fooStaticBar, fooFooDef, fooFoo, fooStaticFooDef, fooStaticFoo, xFoo, xBar, staticFoo, staticBar] = test.ranges(); - // References to a member method with the same name as a static. -verify.singleReferenceGroup("(method) MixedStaticsClassTest.Foo.foo(): void", [fooFoo, xFoo]); - // References to a static method with the same name as a member. -verify.singleReferenceGroup("(method) MixedStaticsClassTest.Foo.foo(): void", [fooStaticFoo, staticFoo]); - // References to a member property with the same name as a static. -verify.singleReferenceGroup("(property) MixedStaticsClassTest.Foo.bar: Foo", [fooBar, xBar]); - // References to a static property with the same name as a member. -verify.singleReferenceGroup("(property) MixedStaticsClassTest.Foo.bar: Foo", [fooStaticBar, staticBar]); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts index 4402316c5a3..20ac0c8065b 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames2.ts @@ -1,10 +1,10 @@ /// ////class Foo { -//// [|"[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}blah|]"() { return 0; }|] +//// /*1*/"/*2*/blah"() { return 0; } ////} //// ////var x: Foo; -////x.[|blah|]; +////x./*3*/blah; -verify.singleReferenceGroup('(method) Foo["blah"](): number', "blah"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts b/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts index 2ef57d19b5c..ac618f7a7a9 100644 --- a/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts +++ b/tests/cases/fourslash/referencesForStringLiteralPropertyNames3.ts @@ -1,11 +1,11 @@ /// ////class Foo2 { -//// [|get "[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}42|]"() { return 0; }|] -//// [|set [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}42|](n) { }|] +//// /*1*/get "/*2*/42"() { return 0; } +//// /*3*/set /*4*/42(n) { } ////} //// ////var y: Foo2; -////y[[|42|]]; +////y[/*5*/42]; -verify.singleReferenceGroup('(property) Foo2["42"]: number', "42"); \ No newline at end of file +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); \ No newline at end of file diff --git a/tests/cases/fourslash/server/findAllRefsForStringLiteralTypes.ts b/tests/cases/fourslash/server/findAllRefsForStringLiteralTypes.ts deleted file mode 100644 index 98e740aed55..00000000000 --- a/tests/cases/fourslash/server/findAllRefsForStringLiteralTypes.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -// @Filename: /a.ts -////type Options = "/*0*/option 1" | "option 2"; -////let myOption: Options = "/*1*/option 1"; - -verify.baselineFindAllReferences('0', '1') diff --git a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts index c3bb5fa8428..debd0c793bc 100644 --- a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts +++ b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts @@ -1,5 +1,6 @@ /// +//@BaselineFile: getReferencesAtPosition-pp.baseline.jsonc //@Filename: findAllRefsOnDefinition-import.ts ////export class Test{ //// @@ -7,9 +8,9 @@ //// //// } //// -//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}start|](){ +//// /*1*/public /*2*/start(){ //// return this; -//// }|] +//// } //// //// public stop(){ //// return this; @@ -20,7 +21,7 @@ ////import Second = require("./findAllRefsOnDefinition-import"); //// ////var second = new Second.Test() -////second.[|start|](); +////second./*3*/start(); ////second.stop(); -verify.singleReferenceGroup("(method) Test.start(): this", "start"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/shims/getReferencesAtPosition.ts b/tests/cases/fourslash/shims/getReferencesAtPosition.ts index c3bb5fa8428..40e03cd2d76 100644 --- a/tests/cases/fourslash/shims/getReferencesAtPosition.ts +++ b/tests/cases/fourslash/shims/getReferencesAtPosition.ts @@ -1,5 +1,6 @@ /// +//@BaselineFile: getReferencesAtPosition.baseline.jsonc //@Filename: findAllRefsOnDefinition-import.ts ////export class Test{ //// @@ -7,9 +8,9 @@ //// //// } //// -//// [|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}start|](){ +//// /*1*/public /*2*/start(){ //// return this; -//// }|] +//// } //// //// public stop(){ //// return this; @@ -20,7 +21,7 @@ ////import Second = require("./findAllRefsOnDefinition-import"); //// ////var second = new Second.Test() -////second.[|start|](); +////second./*3*/start(); ////second.stop(); -verify.singleReferenceGroup("(method) Test.start(): this", "start"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/tsxFindAllReferences1.ts b/tests/cases/fourslash/tsxFindAllReferences1.ts index 8e48057e4b6..3e4a55ad525 100644 --- a/tests/cases/fourslash/tsxFindAllReferences1.ts +++ b/tests/cases/fourslash/tsxFindAllReferences1.ts @@ -4,17 +4,13 @@ //// declare module JSX { //// interface Element { } //// interface IntrinsicElements { -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}div|]: { +//// /*1*/div: { //// name?: string; //// isOpen?: boolean; -//// };|] +//// }; //// span: { n: string; }; //// } //// } -//// var x = [|<[|{| "contextRangeIndex": 2 |}div|] />|]; +//// var x = /*2*/; -verify.singleReferenceGroup( - `(property) JSX.IntrinsicElements.div: { - name?: string; - isOpen?: boolean; -}`, "div"); +verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/tsxFindAllReferences11.ts b/tests/cases/fourslash/tsxFindAllReferences11.ts index 8c7e7a46909..3c2b2468d2f 100644 --- a/tests/cases/fourslash/tsxFindAllReferences11.ts +++ b/tests/cases/fourslash/tsxFindAllReferences11.ts @@ -23,6 +23,6 @@ //// 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 = ; -verify.singleReferenceGroup("(property) wrong: true"); +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/tsxFindAllReferences4.ts b/tests/cases/fourslash/tsxFindAllReferences4.ts index 42a5d44f453..15f21c150b6 100644 --- a/tests/cases/fourslash/tsxFindAllReferences4.ts +++ b/tests/cases/fourslash/tsxFindAllReferences4.ts @@ -7,13 +7,13 @@ //// } //// interface ElementAttributesProperty { props } //// } -//// [|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}MyClass|] { +//// /*1*/class /*2*/MyClass { //// props: { //// name?: string; //// size?: number; -//// }|] +//// } //// //// -//// var x = [|<[|{| "contextRangeIndex" : 2 |}MyClass|] name='hello'>|]; +//// var x = /*3*/; -verify.singleReferenceGroup("class MyClass", "MyClass"); +verify.baselineFindAllReferences('1', '2', '3', '4', '5'); diff --git a/tests/cases/fourslash/tsxFindAllReferences5.ts b/tests/cases/fourslash/tsxFindAllReferences5.ts index 7921e503dbc..1056446f037 100644 --- a/tests/cases/fourslash/tsxFindAllReferences5.ts +++ b/tests/cases/fourslash/tsxFindAllReferences5.ts @@ -15,14 +15,11 @@ //// propString: string //// optional?: boolean //// } -//// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Opt|](attributes: OptionPropBag): JSX.Element;|] -//// let opt = [|<[|{| "contextRangeIndex": 2 |}Opt|] />|]; -//// let opt1 = [|<[|{| "contextRangeIndex": 4 |}Opt|] propx={100} propString />|]; -//// let opt2 = [|<[|{| "contextRangeIndex": 6 |}Opt|] propx={100} optional/>|]; -//// let opt3 = [|<[|{| "contextRangeIndex": 8 |}Opt|] wrong />|]; -//// let opt4 = [|<[|{| "contextRangeIndex": 10 |}Opt|] propx={100} propString="hi" />|]; +//// /*1*/declare function /*2*/Opt(attributes: OptionPropBag): JSX.Element; +//// let opt = /*3*/; +//// let opt1 = /*5*/; +//// let opt2 = /*7*/; +//// let opt3 = /*9*/; +//// let opt4 = /*11*/; -verify.singleReferenceGroup( - "function Opt(attributes: OptionPropBag): JSX.Element", - "Opt" -); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'); diff --git a/tests/cases/fourslash/tsxFindAllReferences6.ts b/tests/cases/fourslash/tsxFindAllReferences6.ts index c0e119a4e45..d30528f742b 100644 --- a/tests/cases/fourslash/tsxFindAllReferences6.ts +++ b/tests/cases/fourslash/tsxFindAllReferences6.ts @@ -17,6 +17,6 @@ //// optional?: boolean //// } //// declare function Opt(attributes: OptionPropBag): JSX.Element; -//// let opt = ; +//// let opt = ; -verify.singleReferenceGroup("(property) wrong: true"); +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/tsxFindAllReferences8.ts b/tests/cases/fourslash/tsxFindAllReferences8.ts index efed4141230..907431cb0af 100644 --- a/tests/cases/fourslash/tsxFindAllReferences8.ts +++ b/tests/cases/fourslash/tsxFindAllReferences8.ts @@ -20,17 +20,14 @@ //// interface LinkProps extends ClickableProps { //// goTo: string; //// } -//// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}MainButton|](buttonProps: ButtonProps): JSX.Element;|] -//// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}MainButton|](linkProps: LinkProps): JSX.Element;|] -//// [|declare function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}MainButton|](props: ButtonProps | LinkProps): JSX.Element;|] -//// let opt = [|<[|{| "contextRangeIndex": 6 |}MainButton|] />|]; -//// let opt = [|<[|{| "contextRangeIndex": 8 |}MainButton|] children="chidlren" />|]; -//// let opt = [|<[|{| "contextRangeIndex": 10 |}MainButton|] onClick={()=>{}} />|]; -//// let opt = [|<[|{| "contextRangeIndex": 12 |}MainButton|] onClick={()=>{}} ignore-prop />|]; -//// let opt = [|<[|{| "contextRangeIndex": 14 |}MainButton|] goTo="goTo" />|]; -//// let opt = [|<[|{| "contextRangeIndex": 16 |}MainButton|] wrong />|]; +//// /*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*/; +//// let opt = /*9*/; +//// let opt = /*11*/{}} />; +//// let opt = /*13*/{}} ignore-prop />; +//// let opt = /*15*/; +//// let opt = /*17*/; -verify.singleReferenceGroup( - "function MainButton(buttonProps: ButtonProps): JSX.Element (+2 overloads)", - "MainButton" -); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18'); diff --git a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts index 2a1301a64f5..480be64cb4e 100644 --- a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts +++ b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType1.ts @@ -18,11 +18,7 @@ //// return

World

; //// } -//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}SFCComp|] = SFC1 || SFC2;|] -//// [|<[|{| "contextRangeIndex": 2 |}SFCComp|] x={ "hi" } />|] +//// /*1*/var /*2*/SFCComp = SFC1 || SFC2; +//// /*3*/ -verify.singleReferenceGroup(`var SFCComp: ((prop: { - x: number; -}) => JSX.Element) | ((prop: { - x: boolean; -}) => JSX.Element)`, "SFCComp"); +verify.baselineFindAllReferences('1', '2', '3', '4'); diff --git a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts index 684be599072..89db1080ec5 100644 --- a/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts +++ b/tests/cases/fourslash/tsxFindAllReferencesUnionElementType2.ts @@ -17,7 +17,7 @@ //// private method() { } //// } -//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}RCComp|] = RC1 || RC2;|] -//// [|<[|{| "contextRangeIndex": 2 |}RCComp|] />|] +//// /*1*/var /*2*/RCComp = RC1 || RC2; +//// /*3*/ -verify.singleReferenceGroup("var RCComp: typeof RC1", "RCComp"); +verify.baselineFindAllReferences('1', '2', '3', '4'); From e02998f70d254ef8e4d8e115e525dc1770f4c588 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Mon, 4 Apr 2022 22:27:49 +0300 Subject: [PATCH 12/41] fix(48541): forbid function extraction to arrow function with expression body (#48548) --- src/harness/fourslashImpl.ts | 5 +++-- src/harness/fourslashInterfaceImpl.ts | 4 ++-- src/services/refactors/extractSymbol.ts | 3 ++- .../extractConstant_ArrowFunction_Expression.js | 2 +- .../extractConstant_ArrowFunction_Expression.ts | 2 +- .../cases/fourslash/extract-method-two-type-literals.ts | 2 +- tests/cases/fourslash/extract-method44.ts | 9 +++++++++ tests/cases/fourslash/fourslash.ts | 2 +- 8 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 tests/cases/fourslash/extract-method44.ts diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 408785ccf00..dac3d672d75 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -3529,9 +3529,10 @@ namespace FourSlash { }; } - public verifyRefactorAvailable(negative: boolean, triggerReason: ts.RefactorTriggerReason, name: string, actionName?: string) { + public verifyRefactorAvailable(negative: boolean, triggerReason: ts.RefactorTriggerReason, name: string, actionName?: string, actionDescription?: string) { let refactors = this.getApplicableRefactorsAtSelection(triggerReason); - refactors = refactors.filter(r => r.name === name && (actionName === undefined || r.actions.some(a => a.name === actionName))); + refactors = refactors.filter(r => + r.name === name && (actionName === undefined || r.actions.some(a => a.name === actionName)) && (actionDescription === undefined || r.actions.some(a => a.description === actionDescription))); const isAvailable = refactors.length > 0; if (negative) { diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index dfe3808c8e5..064ec8b745a 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -215,8 +215,8 @@ namespace FourSlashInterface { this.state.verifyRefactorsAvailable(names); } - public refactorAvailable(name: string, actionName?: string) { - this.state.verifyRefactorAvailable(this.negative, "implicit", name, actionName); + public refactorAvailable(name: string, actionName?: string, actionDescription?: string) { + this.state.verifyRefactorAvailable(this.negative, "implicit", name, actionName, actionDescription); } public refactorAvailableForTriggerReason(triggerReason: ts.RefactorTriggerReason, name: string, actionName?: string) { diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 36571bbf1c1..f9a790e80ac 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -639,7 +639,8 @@ namespace ts.refactor.extractSymbol { } function isScope(node: Node): node is Scope { - return isFunctionLikeDeclaration(node) || isSourceFile(node) || isModuleBlock(node) || isClassLike(node); + return isArrowFunction(node) ? isFunctionBody(node.body) : + isFunctionLikeDeclaration(node) || isSourceFile(node) || isModuleBlock(node) || isClassLike(node); } /** diff --git a/tests/baselines/reference/extractConstant/extractConstant_ArrowFunction_Expression.js b/tests/baselines/reference/extractConstant/extractConstant_ArrowFunction_Expression.js index ac6de28d3c4..3313cc2e50d 100644 --- a/tests/baselines/reference/extractConstant/extractConstant_ArrowFunction_Expression.js +++ b/tests/baselines/reference/extractConstant/extractConstant_ArrowFunction_Expression.js @@ -1,5 +1,5 @@ // ==ORIGINAL== const f = () => /*[#|*/2 + 1/*|]*/; -// ==SCOPE::Extract to constant in global scope== +// ==SCOPE::Extract to constant in enclosing scope== const newLocal = 2 + 1; const f = () => /*RENAME*/newLocal; \ No newline at end of file diff --git a/tests/baselines/reference/extractConstant/extractConstant_ArrowFunction_Expression.ts b/tests/baselines/reference/extractConstant/extractConstant_ArrowFunction_Expression.ts index ac6de28d3c4..3313cc2e50d 100644 --- a/tests/baselines/reference/extractConstant/extractConstant_ArrowFunction_Expression.ts +++ b/tests/baselines/reference/extractConstant/extractConstant_ArrowFunction_Expression.ts @@ -1,5 +1,5 @@ // ==ORIGINAL== const f = () => /*[#|*/2 + 1/*|]*/; -// ==SCOPE::Extract to constant in global scope== +// ==SCOPE::Extract to constant in enclosing scope== const newLocal = 2 + 1; const f = () => /*RENAME*/newLocal; \ No newline at end of file diff --git a/tests/cases/fourslash/extract-method-two-type-literals.ts b/tests/cases/fourslash/extract-method-two-type-literals.ts index f8885d58bea..df502c5f9eb 100644 --- a/tests/cases/fourslash/extract-method-two-type-literals.ts +++ b/tests/cases/fourslash/extract-method-two-type-literals.ts @@ -5,7 +5,7 @@ goTo.select("1", "2"); edit.applyRefactor({ refactorName: "Extract Symbol", - actionName: "function_scope_1", + actionName: "function_scope_0", actionDescription: "Extract to function in global scope", newContent: `(x: {}, y: {}) => (/*RENAME*/newFunction(x, y)); diff --git a/tests/cases/fourslash/extract-method44.ts b/tests/cases/fourslash/extract-method44.ts new file mode 100644 index 00000000000..1fcdfb857f8 --- /dev/null +++ b/tests/cases/fourslash/extract-method44.ts @@ -0,0 +1,9 @@ +/// + +////function foo() { +//// let x = [1, 2, 3]; +//// let y = x.map(e => /*a*/e + e/*b*/); +////} + +goTo.select("a", "b"); +verify.not.refactorAvailable("Extract Symbol", "function_scope_0", "Extract to inner function in arrow function"); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index a02e06a574c..d6e0d3ce80c 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -271,7 +271,7 @@ declare namespace FourSlashInterface { codeFixDiagnosticsAvailableAtMarkers(markerNames: string[], diagnosticCode?: number): void; applicableRefactorAvailableForRange(): void; - refactorAvailable(name: string, actionName?: string): void; + refactorAvailable(name: string, actionName?: string, actionDescription?: string): void; refactorAvailableForTriggerReason(triggerReason: RefactorTriggerReason, name: string, action?: string): void; refactorKindAvailable(refactorKind: string, expected: string[], preferences?: {}): void; } From 7465f046666917f224f6435e489afd768fd1fa83 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Tue, 5 Apr 2022 00:05:20 +0300 Subject: [PATCH 13/41] fix(48542): omit parameter info of contextual union type (#48549) --- src/services/signatureHelp.ts | 9 +- .../signatureHelp_unionType.baseline | 419 ++++++++++++++++++ .../fourslash/signatureHelp_unionType.ts | 21 + 3 files changed, 446 insertions(+), 3 deletions(-) create mode 100644 tests/baselines/reference/signatureHelp_unionType.baseline create mode 100644 tests/cases/fourslash/signatureHelp_unionType.ts diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index e26b0f49425..eefc1c44e9c 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -307,10 +307,13 @@ namespace ts.SignatureHelp { // for optional function condition. const nonNullableContextualType = contextualType.getNonNullableType(); - const signatures = nonNullableContextualType.getCallSignatures(); - if (signatures.length !== 1) return undefined; + const symbol = nonNullableContextualType.symbol; + if (symbol === undefined) return undefined; - const invocation: ContextualInvocation = { kind: InvocationKind.Contextual, signature: first(signatures), node: startingToken, symbol: chooseBetterSymbol(nonNullableContextualType.symbol) }; + const signature = lastOrUndefined(nonNullableContextualType.getCallSignatures()); + if (signature === undefined) return undefined; + + const invocation: ContextualInvocation = { kind: InvocationKind.Contextual, signature, node: startingToken, symbol: chooseBetterSymbol(symbol) }; return { isTypeParameterList: false, invocation, argumentsSpan, argumentIndex, argumentCount }; } diff --git a/tests/baselines/reference/signatureHelp_unionType.baseline b/tests/baselines/reference/signatureHelp_unionType.baseline new file mode 100644 index 00000000000..17ba6f279be --- /dev/null +++ b/tests/baselines/reference/signatureHelp_unionType.baseline @@ -0,0 +1,419 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/signatureHelp_unionType.ts", + "position": 296, + "name": "1" + }, + "signatureHelp": { + "items": [ + { + "isVariadic": false, + "prefixDisplayParts": [ + { + "text": "a", + "kind": "localName" + }, + { + "text": "(", + "kind": "punctuation" + } + ], + "suffixDisplayParts": [ + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "separatorDisplayParts": [ + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + } + ], + "parameters": [ + { + "name": "fn", + "documentation": [], + "displayParts": [ + { + "text": "fn", + "kind": "parameterName" + }, + { + "text": "?", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "y", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + } + ], + "isOptional": true, + "isRest": false + } + ], + "documentation": [], + "tags": [] + } + ], + "applicableSpan": { + "start": 295, + "length": 31 + }, + "selectedItemIndex": 0, + "argumentIndex": 0, + "argumentCount": 1 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/signatureHelp_unionType.ts", + "position": 332, + "name": "2" + }, + "signatureHelp": { + "items": [ + { + "isVariadic": false, + "prefixDisplayParts": [ + { + "text": "b", + "kind": "localName" + }, + { + "text": "(", + "kind": "punctuation" + } + ], + "suffixDisplayParts": [ + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "separatorDisplayParts": [ + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + } + ], + "parameters": [ + { + "name": "x", + "documentation": [], + "displayParts": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + } + ], + "documentation": [], + "tags": [] + } + ], + "applicableSpan": { + "start": 332, + "length": 0 + }, + "selectedItemIndex": 0, + "argumentIndex": 0, + "argumentCount": 0 + } + }, + { + "marker": { + "fileName": "/tests/cases/fourslash/signatureHelp_unionType.ts", + "position": 339, + "name": "3" + }, + "signatureHelp": { + "items": [ + { + "isVariadic": false, + "prefixDisplayParts": [ + { + "text": "Callback", + "kind": "interfaceName" + }, + { + "text": "(", + "kind": "punctuation" + } + ], + "suffixDisplayParts": [ + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "separatorDisplayParts": [ + { + "text": ",", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + } + ], + "parameters": [ + { + "name": "x", + "documentation": [], + "displayParts": [ + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "|", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "isOptional": false, + "isRest": false + } + ], + "documentation": [], + "tags": [] + } + ], + "applicableSpan": { + "start": 339, + "length": 0 + }, + "selectedItemIndex": 0, + "argumentIndex": 0, + "argumentCount": 0 + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/signatureHelp_unionType.ts b/tests/cases/fourslash/signatureHelp_unionType.ts new file mode 100644 index 00000000000..0548ac1e689 --- /dev/null +++ b/tests/cases/fourslash/signatureHelp_unionType.ts @@ -0,0 +1,21 @@ +/// + +////declare const a: (fn?: ((x: string) => string) | ((y: number) => number)) => void; +////declare const b: (x: string | number) => void; +//// +////interface Callback { +//// (x: string): string; +//// (x: number): number; +//// (x: string | number): string | number; +////} +////declare function c(callback: Callback): void; + +////a((/*1*/) => { +//// return undefined; +////}); +//// +////b(/*2*/); +//// +////c((/*3*/) => {}); + +verify.baselineSignatureHelp(); From 9d2f72b285bf259460f27d6a0755f266ab866d9b Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 4 Apr 2022 14:07:32 -0700 Subject: [PATCH 14/41] Remove nightly-only flagging for nodenext features (#48555) --- src/compiler/program.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index a17654e981f..2c9f07fe0bb 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -3326,21 +3326,6 @@ namespace ts { } function verifyCompilerOptions() { - const isNightly = stringContains(version, "-dev") || stringContains(version, "-insiders"); - if (!isNightly) { - if (getEmitModuleKind(options) === ModuleKind.Node12) { - createOptionValueDiagnostic("module", Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12"); - } - else if (getEmitModuleKind(options) === ModuleKind.NodeNext) { - createOptionValueDiagnostic("module", Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "nodenext"); - } - else if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.Node12) { - createOptionValueDiagnostic("moduleResolution", Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "node12"); - } - else if (getEmitModuleResolutionKind(options) === ModuleResolutionKind.NodeNext) { - createOptionValueDiagnostic("moduleResolution", Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "nodenext"); - } - } if (options.strictPropertyInitialization && !getStrictOptionValue(options, "strictNullChecks")) { createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks"); } From 3b12284fc46fa635fa7996a65fb69b16f93d8538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Sabater=20Jim=C3=A9nez?= Date: Mon, 4 Apr 2022 23:16:21 +0200 Subject: [PATCH 15/41] fixed code duplication (#48425) * fixed code duplication * updated baselines --- src/compiler/types.ts | 1 - tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5180c765990..396805f71a6 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3458,7 +3458,6 @@ namespace ts { | FlowStart | FlowLabel | FlowAssignment - | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 680978e77c2..ce6ba3b45cc 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1983,7 +1983,7 @@ declare namespace ts { Label = 12, Condition = 96 } - export type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel; + export type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel; export interface FlowNodeBase { flags: FlowFlags; id?: number; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 1a7f9480772..c225bd3a9fe 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1983,7 +1983,7 @@ declare namespace ts { Label = 12, Condition = 96 } - export type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCall | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel; + export type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel; export interface FlowNodeBase { flags: FlowFlags; id?: number; From e5ca3e4386ba431ca949e42e3e70a035381a15e4 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Tue, 5 Apr 2022 00:42:50 +0300 Subject: [PATCH 16/41] fix(48406): resolve JSDoc host of property signature (#48407) --- src/compiler/utilities.ts | 6 ++- .../reference/quickInfoLink9.baseline | 52 +++++++++++++++++++ tests/cases/fourslash/quickInfoLink9.ts | 10 ++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/quickInfoLink9.baseline create mode 100644 tests/cases/fourslash/quickInfoLink9.ts diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 2465c336345..3b303c65eb8 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2825,7 +2825,11 @@ namespace ts { export function getHostSignatureFromJSDoc(node: Node): SignatureDeclaration | undefined { const host = getEffectiveJSDocHost(node); - return host && isFunctionLike(host) ? host : undefined; + if (host) { + return isPropertySignature(host) && host.type && isFunctionLike(host.type) ? host.type : + isFunctionLike(host) ? host : undefined; + } + return undefined; } export function getEffectiveJSDocHost(node: Node): Node | undefined { diff --git a/tests/baselines/reference/quickInfoLink9.baseline b/tests/baselines/reference/quickInfoLink9.baseline new file mode 100644 index 00000000000..ec7a9ec78d2 --- /dev/null +++ b/tests/baselines/reference/quickInfoLink9.baseline @@ -0,0 +1,52 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoLink9.ts", + "position": 47, + "name": "" + }, + "quickInfo": { + "kind": "parameter", + "kindModifiers": "", + "textSpan": { + "start": 47, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "a", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "documentation": [] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/quickInfoLink9.ts b/tests/cases/fourslash/quickInfoLink9.ts new file mode 100644 index 00000000000..676234396cd --- /dev/null +++ b/tests/cases/fourslash/quickInfoLink9.ts @@ -0,0 +1,10 @@ +/// + +//// type Foo = { +//// /** +//// * Text before {@link /**/a} text after +//// */ +//// c: (a: number) => void; +//// } + +verify.baselineQuickInfo(); From aa3c5a787cff8ba0660443c1ab58f198d7976f03 Mon Sep 17 00:00:00 2001 From: Oleksandr T Date: Tue, 5 Apr 2022 00:56:35 +0300 Subject: [PATCH 17/41] fix(48418): allow using empty tuple (#48420) --- src/services/codefixes/helpers.ts | 7 ++++- .../codeFixAddMissingProperties19.ts | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/codeFixAddMissingProperties19.ts diff --git a/src/services/codefixes/helpers.ts b/src/services/codefixes/helpers.ts index cc6575912be..a33fe54ec2a 100644 --- a/src/services/codefixes/helpers.ts +++ b/src/services/codefixes/helpers.ts @@ -192,7 +192,12 @@ namespace ts.codefix { const program = context.program; const checker = program.getTypeChecker(); const scriptTarget = getEmitScriptTarget(program.getCompilerOptions()); - const flags = NodeBuilderFlags.NoTruncation | NodeBuilderFlags.NoUndefinedOptionalParameterType | NodeBuilderFlags.SuppressAnyReturnType | (quotePreference === QuotePreference.Single ? NodeBuilderFlags.UseSingleQuotesForStringLiteralType : 0); + const flags = + NodeBuilderFlags.NoTruncation + | NodeBuilderFlags.NoUndefinedOptionalParameterType + | NodeBuilderFlags.SuppressAnyReturnType + | NodeBuilderFlags.AllowEmptyTuple + | (quotePreference === QuotePreference.Single ? NodeBuilderFlags.UseSingleQuotesForStringLiteralType : NodeBuilderFlags.None); const signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)) as ArrowFunction | FunctionExpression | MethodDeclaration; if (!signatureDeclaration) { return undefined; diff --git a/tests/cases/fourslash/codeFixAddMissingProperties19.ts b/tests/cases/fourslash/codeFixAddMissingProperties19.ts new file mode 100644 index 00000000000..b8a8b9143b9 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingProperties19.ts @@ -0,0 +1,28 @@ +/// + +////export interface Foo { +//// z(...args: T extends unknown[] ? T : [T]); +////} +////export interface Bar { +//// a(foo: Foo<[number]>): void; +//// b(foo: Foo<[]>): void; +//// c(foo: Foo): void; +////} +////[|const bar: Bar = {};|] + +verify.codeFix({ + index: 0, + description: ts.Diagnostics.Add_missing_properties.message, + newRangeContent: +`const bar: Bar = { + a: function(foo: Foo<[number]>): void { + throw new Error("Function not implemented."); + }, + b: function(foo: Foo<[]>): void { + throw new Error("Function not implemented."); + }, + c: function(foo: Foo): void { + throw new Error("Function not implemented."); + } +};`, +}); From 99ea99b386a032187411a465e959e0904a7e336b Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Mon, 4 Apr 2022 19:53:41 -0300 Subject: [PATCH 18/41] Properly check singleton labeled tuple before unwrapping (#48554) * properly check if singleton labeled tuple has optional element * also check if labeled element is rest --- src/compiler/checker.ts | 6 ++- .../reference/singletonLabeledTuple.js | 19 ++++++++ .../reference/singletonLabeledTuple.symbols | 33 ++++++++++++++ .../reference/singletonLabeledTuple.types | 45 +++++++++++++++++++ tests/cases/compiler/singletonLabeledTuple.ts | 16 +++++++ 5 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/singletonLabeledTuple.js create mode 100644 tests/baselines/reference/singletonLabeledTuple.symbols create mode 100644 tests/baselines/reference/singletonLabeledTuple.types create mode 100644 tests/cases/compiler/singletonLabeledTuple.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b891a0ec6c0..7e144dd26f3 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -15860,7 +15860,11 @@ namespace ts { } function isSingletonTupleType(node: TypeNode) { - return isTupleTypeNode(node) && length(node.elements) === 1 && !isOptionalTypeNode(node.elements[0]) && !isRestTypeNode(node.elements[0]); + return isTupleTypeNode(node) && + length(node.elements) === 1 && + !isOptionalTypeNode(node.elements[0]) && + !isRestTypeNode(node.elements[0]) && + !(isNamedTupleMember(node.elements[0]) && (node.elements[0].questionToken || node.elements[0].dotDotDotToken)); } /** diff --git a/tests/baselines/reference/singletonLabeledTuple.js b/tests/baselines/reference/singletonLabeledTuple.js new file mode 100644 index 00000000000..e8299438f1e --- /dev/null +++ b/tests/baselines/reference/singletonLabeledTuple.js @@ -0,0 +1,19 @@ +//// [singletonLabeledTuple.ts] +type AliasOptional = [p?: number] + +// literal type vs type alias +type Literal = [p?: number] extends [unknown] ? true : false // Expect `Literal` to be `false` +type Alias = AliasOptional extends [unknown] ? true : false // Expect `Alias` to be `false` + +// labeled tuple vs normal tuple +type Labeled = [p?: number] extends [unknown] ? true : false // Expect `Labeled` to be `false` +type Normal = [number?] extends [unknown] ? true : false // Expect `Normal` to be `false` + + +type AliasRest = [...p: number[]]; + +type LiteralRest = [...p: number[]] extends [unknown] ? true : false; // Expect `LiteralRest` to be `false` +type AliasedRest = AliasRest extends [unknown] ? true : false; // Expect `AliasedRest` to be `false` +type NormalRest = [...number[]] extends [unknown] ? true : false; // Expect `NormalRest` to be `false` + +//// [singletonLabeledTuple.js] diff --git a/tests/baselines/reference/singletonLabeledTuple.symbols b/tests/baselines/reference/singletonLabeledTuple.symbols new file mode 100644 index 00000000000..327ab83ac16 --- /dev/null +++ b/tests/baselines/reference/singletonLabeledTuple.symbols @@ -0,0 +1,33 @@ +=== tests/cases/compiler/singletonLabeledTuple.ts === +type AliasOptional = [p?: number] +>AliasOptional : Symbol(AliasOptional, Decl(singletonLabeledTuple.ts, 0, 0)) + +// literal type vs type alias +type Literal = [p?: number] extends [unknown] ? true : false // Expect `Literal` to be `false` +>Literal : Symbol(Literal, Decl(singletonLabeledTuple.ts, 0, 33)) + +type Alias = AliasOptional extends [unknown] ? true : false // Expect `Alias` to be `false` +>Alias : Symbol(Alias, Decl(singletonLabeledTuple.ts, 3, 60)) +>AliasOptional : Symbol(AliasOptional, Decl(singletonLabeledTuple.ts, 0, 0)) + +// labeled tuple vs normal tuple +type Labeled = [p?: number] extends [unknown] ? true : false // Expect `Labeled` to be `false` +>Labeled : Symbol(Labeled, Decl(singletonLabeledTuple.ts, 4, 59)) + +type Normal = [number?] extends [unknown] ? true : false // Expect `Normal` to be `false` +>Normal : Symbol(Normal, Decl(singletonLabeledTuple.ts, 7, 60)) + + +type AliasRest = [...p: number[]]; +>AliasRest : Symbol(AliasRest, Decl(singletonLabeledTuple.ts, 8, 56)) + +type LiteralRest = [...p: number[]] extends [unknown] ? true : false; // Expect `LiteralRest` to be `false` +>LiteralRest : Symbol(LiteralRest, Decl(singletonLabeledTuple.ts, 11, 34)) + +type AliasedRest = AliasRest extends [unknown] ? true : false; // Expect `AliasedRest` to be `false` +>AliasedRest : Symbol(AliasedRest, Decl(singletonLabeledTuple.ts, 13, 69)) +>AliasRest : Symbol(AliasRest, Decl(singletonLabeledTuple.ts, 8, 56)) + +type NormalRest = [...number[]] extends [unknown] ? true : false; // Expect `NormalRest` to be `false` +>NormalRest : Symbol(NormalRest, Decl(singletonLabeledTuple.ts, 14, 62)) + diff --git a/tests/baselines/reference/singletonLabeledTuple.types b/tests/baselines/reference/singletonLabeledTuple.types new file mode 100644 index 00000000000..44ca6b978d1 --- /dev/null +++ b/tests/baselines/reference/singletonLabeledTuple.types @@ -0,0 +1,45 @@ +=== tests/cases/compiler/singletonLabeledTuple.ts === +type AliasOptional = [p?: number] +>AliasOptional : AliasOptional + +// literal type vs type alias +type Literal = [p?: number] extends [unknown] ? true : false // Expect `Literal` to be `false` +>Literal : false +>true : true +>false : false + +type Alias = AliasOptional extends [unknown] ? true : false // Expect `Alias` to be `false` +>Alias : false +>true : true +>false : false + +// labeled tuple vs normal tuple +type Labeled = [p?: number] extends [unknown] ? true : false // Expect `Labeled` to be `false` +>Labeled : false +>true : true +>false : false + +type Normal = [number?] extends [unknown] ? true : false // Expect `Normal` to be `false` +>Normal : false +>true : true +>false : false + + +type AliasRest = [...p: number[]]; +>AliasRest : AliasRest + +type LiteralRest = [...p: number[]] extends [unknown] ? true : false; // Expect `LiteralRest` to be `false` +>LiteralRest : false +>true : true +>false : false + +type AliasedRest = AliasRest extends [unknown] ? true : false; // Expect `AliasedRest` to be `false` +>AliasedRest : false +>true : true +>false : false + +type NormalRest = [...number[]] extends [unknown] ? true : false; // Expect `NormalRest` to be `false` +>NormalRest : false +>true : true +>false : false + diff --git a/tests/cases/compiler/singletonLabeledTuple.ts b/tests/cases/compiler/singletonLabeledTuple.ts new file mode 100644 index 00000000000..27d457ce35e --- /dev/null +++ b/tests/cases/compiler/singletonLabeledTuple.ts @@ -0,0 +1,16 @@ +type AliasOptional = [p?: number] + +// literal type vs type alias +type Literal = [p?: number] extends [unknown] ? true : false // Expect `Literal` to be `false` +type Alias = AliasOptional extends [unknown] ? true : false // Expect `Alias` to be `false` + +// labeled tuple vs normal tuple +type Labeled = [p?: number] extends [unknown] ? true : false // Expect `Labeled` to be `false` +type Normal = [number?] extends [unknown] ? true : false // Expect `Normal` to be `false` + + +type AliasRest = [...p: number[]]; + +type LiteralRest = [...p: number[]] extends [unknown] ? true : false; // Expect `LiteralRest` to be `false` +type AliasedRest = AliasRest extends [unknown] ? true : false; // Expect `AliasedRest` to be `false` +type NormalRest = [...number[]] extends [unknown] ? true : false; // Expect `NormalRest` to be `false` \ No newline at end of file From 493ddc2447fd1ea2a5c9372e40205ace2cbd0da6 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Mon, 4 Apr 2022 16:54:10 -0700 Subject: [PATCH 19/41] Remove non-baselining fourslash FAR validation (#48564) * Fix fourslash failures * Delete unused FAR fourslash helpers --- src/harness/fourslashImpl.ts | 101 +- src/harness/fourslashInterfaceImpl.ts | 8 +- ...indingAllRefsOnDefinition.1.baseline.jsonc | 116 + ...indingAllRefsOnDefinition.3.baseline.jsonc | 116 + .../findAllRefsPrimitive.baseline.jsonc | 953 ++ .../findReferencesAfterEdit.1.baseline.jsonc | 195 + .../findReferencesAfterEdit.2.baseline.jsonc | 197 + .../findReferencesJSXTagName3.baseline.jsonc | 1173 ++ .../reference/jsDocServices.baseline.jsonc | 290 + .../jsdocTypedefTagServices.baseline.jsonc | 241 + .../localGetReferences.baseline.jsonc | 10291 ++++++++++++++++ .../remoteGetReferences.baseline.jsonc | 8919 ++++++++++++++ ...cellationWhenfindingAllRefsOnDefinition.ts | 10 +- tests/cases/fourslash/findAllRefsPrimitive.ts | 22 +- .../fourslash/findReferencesAfterEdit.ts | 8 +- .../fourslash/findReferencesJSXTagName3.ts | 21 +- tests/cases/fourslash/fourslash.ts | 1 + tests/cases/fourslash/jsDocServices.ts | 6 +- .../fourslash/jsdocTypedefTagServices.ts | 4 +- tests/cases/fourslash/localGetReferences.ts | 130 +- tests/cases/fourslash/remoteGetReferences.ts | 77 +- 21 files changed, 22611 insertions(+), 268 deletions(-) create mode 100644 tests/baselines/reference/cancellationWhenfindingAllRefsOnDefinition.1.baseline.jsonc create mode 100644 tests/baselines/reference/cancellationWhenfindingAllRefsOnDefinition.3.baseline.jsonc create mode 100644 tests/baselines/reference/findAllRefsPrimitive.baseline.jsonc create mode 100644 tests/baselines/reference/findReferencesAfterEdit.1.baseline.jsonc create mode 100644 tests/baselines/reference/findReferencesAfterEdit.2.baseline.jsonc create mode 100644 tests/baselines/reference/findReferencesJSXTagName3.baseline.jsonc create mode 100644 tests/baselines/reference/jsDocServices.baseline.jsonc create mode 100644 tests/baselines/reference/jsdocTypedefTagServices.baseline.jsonc create mode 100644 tests/baselines/reference/remoteGetReferences.baseline.jsonc diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index dac3d672d75..f4b2832c00b 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -1122,83 +1122,18 @@ namespace FourSlash { } } - private verifyDocumentHighlightsRespectFilesList(files: readonly string[]): void { - const startFile = this.activeFile.fileName; - for (const fileName of files) { - const searchFileNames = startFile === fileName ? [startFile] : [startFile, fileName]; - const highlights = this.getDocumentHighlightsAtCurrentPosition(searchFileNames); - if (highlights && !highlights.every(dh => ts.contains(searchFileNames, dh.fileName))) { - this.raiseError(`When asking for document highlights only in files ${searchFileNames}, got document highlights in ${unique(highlights, dh => dh.fileName)}`); - } - } - } - - public verifyReferenceGroups(starts: ArrayOrSingle | ArrayOrSingle, parts: readonly FourSlashInterface.ReferenceGroup[]): void { - interface ReferenceGroupJson { - definition: string | { text: string, range: ts.TextSpan }; - references: ts.ReferenceEntry[]; - } - interface RangeMarkerData { - id?: string; - isWriteAccess?: boolean, - isDefinition?: boolean, - isInString?: true, - contextRangeIndex?: number, - contextRangeDelta?: number, - contextRangeId?: string - } - const fullExpected = ts.map(parts, ({ definition, ranges }) => ({ - definition: typeof definition === "string" ? definition : { ...definition, range: ts.createTextSpanFromRange(definition.range) }, - references: ranges.map(r => { - const { isWriteAccess = false, isDefinition = false, isInString, contextRangeIndex, contextRangeDelta, contextRangeId } = (r.marker && r.marker.data || {}) as RangeMarkerData; - let contextSpan: ts.TextSpan | undefined; - if (contextRangeDelta !== undefined) { - const allRanges = this.getRanges(); - const index = allRanges.indexOf(r); - if (index !== -1) { - contextSpan = ts.createTextSpanFromRange(allRanges[index + contextRangeDelta]); - } - } - else if (contextRangeId !== undefined) { - const allRanges = this.getRanges(); - const contextRange = ts.find(allRanges, range => (range.marker?.data as RangeMarkerData)?.id === contextRangeId); - if (contextRange) { - contextSpan = ts.createTextSpanFromRange(contextRange); - } - } - else if (contextRangeIndex !== undefined) { - contextSpan = ts.createTextSpanFromRange(this.getRanges()[contextRangeIndex]); - } - return { - textSpan: ts.createTextSpanFromRange(r), - fileName: r.fileName, - ...(contextSpan ? { contextSpan } : undefined), - isWriteAccess, - isDefinition, - ...(isInString ? { isInString: true } : undefined), - }; - }), - })); - - for (const start of toArray(starts)) { - this.goToMarkerOrRange(start); - const fullActual = ts.map(this.findReferencesAtCaret(), ({ definition, references }, i) => { - const text = definition.displayParts.map(d => d.text).join(""); - return { - definition: fullExpected.length > i && typeof fullExpected[i].definition === "string" ? text : { text, range: definition.textSpan }, - references, - }; - }); - this.assertObjectsEqual(fullActual, fullExpected); - - if (parts) { - this.verifyDocumentHighlightsRespectFilesList(unique(ts.flatMap(parts, p => p.ranges), r => r.fileName)); - } - } - } - public verifyBaselineFindAllReferences(...markerNames: string[]) { + ts.Debug.assert(markerNames.length > 0, "Must pass at least one marker name to `verifyBaselineFindAllReferences()`"); + this.verifyBaselineFindAllReferencesWorker("", markerNames); + } + + // Used when a single test needs to produce multiple baselines + public verifyBaselineFindAllReferencesMulti(seq: number, ...markerNames: string[]) { ts.Debug.assert(markerNames.length > 0, "Must pass at least one marker name to `baselineFindAllReferences()`"); + this.verifyBaselineFindAllReferencesWorker(`.${seq}`, markerNames); + } + + private verifyBaselineFindAllReferencesWorker(suffix: string, markerNames: string[]) { const baseline = markerNames.map(markerName => { this.goToMarker(markerName); const marker = this.getMarkerByName(markerName); @@ -1213,7 +1148,7 @@ namespace FourSlash { // Write response JSON return baselineContent + JSON.stringify(references, undefined, 2); }).join("\n\n"); - Harness.Baseline.runBaseline(this.getBaselineFileNameForContainingTestFile(".baseline.jsonc"), baseline); + Harness.Baseline.runBaseline(this.getBaselineFileNameForContainingTestFile(`${suffix}.baseline.jsonc`), baseline); } public verifyBaselineGetFileReferences(fileName: string) { @@ -1280,11 +1215,6 @@ namespace FourSlash { } } - public verifySingleReferenceGroup(definition: FourSlashInterface.ReferenceGroupDefinition, ranges?: Range[] | string) { - ranges = ts.isString(ranges) ? this.rangesByText().get(ranges)! : ranges || this.getRanges(); - this.verifyReferenceGroups(ranges, [{ definition, ranges }]); - } - private assertObjectsEqual(fullActual: T, fullExpected: T, msgPrefix = ""): void { const recur = (actual: U, expected: U, path: string) => { const fail = (msg: string) => { @@ -2403,15 +2333,6 @@ namespace FourSlash { this.goToPosition(len); } - private goToMarkerOrRange(markerOrRange: string | Range) { - if (typeof markerOrRange === "string") { - this.goToMarker(markerOrRange); - } - else { - this.goToRangeStart(markerOrRange); - } - } - public goToRangeStart({ fileName, pos }: Range) { this.openFile(fileName); this.goToPosition(pos); diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index 064ec8b745a..ea07f4f386f 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -352,12 +352,12 @@ namespace FourSlashInterface { this.state.verifyBaselineFindAllReferences(...markerNames); } - public baselineGetFileReferences(fileName: string) { - this.state.verifyBaselineGetFileReferences(fileName); + public baselineFindAllReferencesMulti(seq: number, ...markerNames: string[]) { + this.state.verifyBaselineFindAllReferencesMulti(seq, ...markerNames); } - public singleReferenceGroup(definition: ReferenceGroupDefinition, ranges?: FourSlash.Range[] | string) { - this.state.verifySingleReferenceGroup(definition, ranges); + public baselineGetFileReferences(fileName: string) { + this.state.verifyBaselineGetFileReferences(fileName); } public findReferencesDefinitionDisplayPartsAtCaretAre(expected: ts.SymbolDisplayPart[]) { diff --git a/tests/baselines/reference/cancellationWhenfindingAllRefsOnDefinition.1.baseline.jsonc b/tests/baselines/reference/cancellationWhenfindingAllRefsOnDefinition.1.baseline.jsonc new file mode 100644 index 00000000000..fac647eb0ac --- /dev/null +++ b/tests/baselines/reference/cancellationWhenfindingAllRefsOnDefinition.1.baseline.jsonc @@ -0,0 +1,116 @@ +// === /tests/cases/fourslash/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// public /*FIND ALL REFS*/[|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/cancellationWhenfindingAllRefsOnDefinition.3.baseline.jsonc b/tests/baselines/reference/cancellationWhenfindingAllRefsOnDefinition.3.baseline.jsonc new file mode 100644 index 00000000000..fac647eb0ac --- /dev/null +++ b/tests/baselines/reference/cancellationWhenfindingAllRefsOnDefinition.3.baseline.jsonc @@ -0,0 +1,116 @@ +// === /tests/cases/fourslash/findAllRefsOnDefinition-import.ts === +// export class Test{ +// +// constructor(){ +// +// } +// +// public /*FIND ALL REFS*/[|start|](){ +// return this; +// } +// +// public stop(){ +// return this; +// } +// } + +// === /tests/cases/fourslash/findAllRefsOnDefinition.ts === +// import Second = require("./findAllRefsOnDefinition-import"); +// +// var second = new Second.Test() +// second.[|start|](); +// second.stop(); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "kind": "method", + "name": "(method) Test.start(): this", + "textSpan": { + "start": 58, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Test", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "start", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "this", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 51, + "length": 42 + } + }, + "references": [ + { + "textSpan": { + "start": 58, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition-import.ts", + "contextSpan": { + "start": 51, + "length": 42 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 100, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/findAllRefsOnDefinition.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findAllRefsPrimitive.baseline.jsonc b/tests/baselines/reference/findAllRefsPrimitive.baseline.jsonc new file mode 100644 index 00000000000..4a4a47a031a --- /dev/null +++ b/tests/baselines/reference/findAllRefsPrimitive.baseline.jsonc @@ -0,0 +1,953 @@ +// === /tests/cases/fourslash/a.ts === +// const x: /*FIND ALL REFS*/[|any|] = 0; +// const any = 2; +// const y: [|any|] = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +// === /tests/cases/fourslash/b.ts === +// const z: [|any|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "any", + "textSpan": { + "start": 9, + "length": 3 + }, + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 42, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: [|any|] = 0; +// const any = 2; +// const y: /*FIND ALL REFS*/[|any|] = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +// === /tests/cases/fourslash/b.ts === +// const z: [|any|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "any", + "textSpan": { + "start": 9, + "length": 3 + }, + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 42, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: /*FIND ALL REFS*/[|boolean|]): [|boolean|]; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "boolean", + "textSpan": { + "start": 67, + "length": 7 + }, + "displayParts": [ + { + "text": "boolean", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 67, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 77, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: [|boolean|]): /*FIND ALL REFS*/[|boolean|]; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "boolean", + "textSpan": { + "start": 67, + "length": 7 + }, + "displayParts": [ + { + "text": "boolean", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 67, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 77, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = /*FIND ALL REFS*/[|never|]; type U = [|never|]; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "never", + "textSpan": { + "start": 95, + "length": 5 + }, + "displayParts": [ + { + "text": "never", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 95, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 111, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = [|never|]; type U = /*FIND ALL REFS*/[|never|]; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "never", + "textSpan": { + "start": 95, + "length": 5 + }, + "displayParts": [ + { + "text": "never", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 95, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 111, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: /*FIND ALL REFS*/[|number|]): [|number|]; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "number", + "textSpan": { + "start": 132, + "length": 6 + }, + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 132, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 141, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: [|number|]): /*FIND ALL REFS*/[|number|]; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "number", + "textSpan": { + "start": 132, + "length": 6 + }, + "displayParts": [ + { + "text": "number", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 132, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 141, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: /*FIND ALL REFS*/[|object|]): [|object|]; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "object", + "textSpan": { + "start": 163, + "length": 6 + }, + "displayParts": [ + { + "text": "object", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 163, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 172, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: [|object|]): /*FIND ALL REFS*/[|object|]; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "object", + "textSpan": { + "start": 163, + "length": 6 + }, + "displayParts": [ + { + "text": "object", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 163, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 172, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: /*FIND ALL REFS*/[|string|]): [|string|]; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "string", + "textSpan": { + "start": 194, + "length": 6 + }, + "displayParts": [ + { + "text": "string", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 194, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 203, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: [|string|]): /*FIND ALL REFS*/[|string|]; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "string", + "textSpan": { + "start": 194, + "length": 6 + }, + "displayParts": [ + { + "text": "string", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 194, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 203, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: /*FIND ALL REFS*/[|symbol|]): [|symbol|]; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "symbol", + "textSpan": { + "start": 226, + "length": 6 + }, + "displayParts": [ + { + "text": "symbol", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 226, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 235, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: [|symbol|]): /*FIND ALL REFS*/[|symbol|]; +// function v(v: void): void; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "symbol", + "textSpan": { + "start": 226, + "length": 6 + }, + "displayParts": [ + { + "text": "symbol", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 226, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 235, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: /*FIND ALL REFS*/[|void|]): [|void|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "void", + "textSpan": { + "start": 257, + "length": 4 + }, + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 257, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 264, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: any = 0; +// const any = 2; +// const y: any = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: [|void|]): /*FIND ALL REFS*/[|void|]; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "void", + "textSpan": { + "start": 257, + "length": 4 + }, + "displayParts": [ + { + "text": "void", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 257, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 264, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// const x: [|any|] = 0; +// const any = 2; +// const y: [|any|] = any; +// function f(b: boolean): boolean; +// type T = never; type U = never; +// function n(x: number): number; +// function o(x: object): object; +// function s(x: string): string; +// function sy(s: symbol): symbol; +// function v(v: void): void; + +// === /tests/cases/fourslash/b.ts === +// const z: /*FIND ALL REFS*/[|any|] = 0; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "keyword", + "name": "any", + "textSpan": { + "start": 9, + "length": 3 + }, + "displayParts": [ + { + "text": "any", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 42, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 9, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findReferencesAfterEdit.1.baseline.jsonc b/tests/baselines/reference/findReferencesAfterEdit.1.baseline.jsonc new file mode 100644 index 00000000000..4c45cf3c272 --- /dev/null +++ b/tests/baselines/reference/findReferencesAfterEdit.1.baseline.jsonc @@ -0,0 +1,195 @@ +// === /tests/cases/fourslash/a.ts === +// interface A { +// /*FIND ALL REFS*/[|foo|]: string; +// } + +// === /tests/cases/fourslash/b.ts === +// /// +// +// function foo(x: A) { +// x.[|foo|] +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "property", + "name": "(property) A.foo: string", + "textSpan": { + "start": 18, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 18, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 56, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// interface A { +// [|foo|]: string; +// } + +// === /tests/cases/fourslash/b.ts === +// /// +// +// function foo(x: A) { +// x./*FIND ALL REFS*/[|foo|] +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "property", + "name": "(property) A.foo: string", + "textSpan": { + "start": 18, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 18, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 56, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findReferencesAfterEdit.2.baseline.jsonc b/tests/baselines/reference/findReferencesAfterEdit.2.baseline.jsonc new file mode 100644 index 00000000000..193611f636c --- /dev/null +++ b/tests/baselines/reference/findReferencesAfterEdit.2.baseline.jsonc @@ -0,0 +1,197 @@ +// === /tests/cases/fourslash/a.ts === +// interface A { +// /*FIND ALL REFS*/[|foo|]: string; +// } + +// === /tests/cases/fourslash/b.ts === +// /// +// +// +// function foo(x: A) { +// x.[|foo|] +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "property", + "name": "(property) A.foo: string", + "textSpan": { + "start": 18, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 18, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 57, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.ts === +// interface A { +// [|foo|]: string; +// } + +// === /tests/cases/fourslash/b.ts === +// /// +// +// +// function foo(x: A) { +// x./*FIND ALL REFS*/[|foo|] +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.ts", + "kind": "property", + "name": "(property) A.foo: string", + "textSpan": { + "start": 18, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "A", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "foo", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 18, + "length": 12 + } + }, + "references": [ + { + "textSpan": { + "start": 18, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/a.ts", + "contextSpan": { + "start": 18, + "length": 12 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 57, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/b.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/findReferencesJSXTagName3.baseline.jsonc b/tests/baselines/reference/findReferencesJSXTagName3.baseline.jsonc new file mode 100644 index 00000000000..c7b6b7c1c6c --- /dev/null +++ b/tests/baselines/reference/findReferencesJSXTagName3.baseline.jsonc @@ -0,0 +1,1173 @@ +// === /a.tsx === +// namespace JSX { +// export interface Element { } +// export interface IntrinsicElements { +// /*FIND ALL REFS*/[|div|]: any; +// } +// } +// +// const Comp = () => +// <[|div|]> +// Some content +// <[|div|]>More content +// ; +// +// const x = +// Content +// ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.tsx", + "kind": "property", + "name": "(property) JSX.IntrinsicElements.div: any", + "textSpan": { + "start": 98, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "IntrinsicElements", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "div", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 98, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 98, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 98, + "length": 9 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 141, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 176, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 194, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 205, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.tsx === +// namespace JSX { +// export interface Element { } +// export interface IntrinsicElements { +// [|div|]: any; +// } +// } +// +// const Comp = () => +// +// Some content +// <[|div|]>More content +// ; +// +// const x = +// Content +// ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.tsx", + "kind": "property", + "name": "(property) JSX.IntrinsicElements.div: any", + "textSpan": { + "start": 98, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "IntrinsicElements", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "div", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 98, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 98, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 98, + "length": 9 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 141, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 176, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 194, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 205, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.tsx === +// namespace JSX { +// export interface Element { } +// export interface IntrinsicElements { +// [|div|]: any; +// } +// } +// +// const Comp = () => +// <[|div|]> +// Some content +// More content +// ; +// +// const x = +// Content +// ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.tsx", + "kind": "property", + "name": "(property) JSX.IntrinsicElements.div: any", + "textSpan": { + "start": 98, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "IntrinsicElements", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "div", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 98, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 98, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 98, + "length": 9 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 141, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 176, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 194, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 205, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.tsx === +// namespace JSX { +// export interface Element { } +// export interface IntrinsicElements { +// [|div|]: any; +// } +// } +// +// const Comp = () => +// <[|div|]> +// Some content +// <[|div|]>More content +// ; +// +// const x = +// Content +// ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.tsx", + "kind": "property", + "name": "(property) JSX.IntrinsicElements.div: any", + "textSpan": { + "start": 98, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "IntrinsicElements", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "div", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 98, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 98, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 98, + "length": 9 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 141, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 176, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 194, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 205, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.tsx === +// namespace JSX { +// export interface Element { } +// export interface IntrinsicElements { +// [|div|]: any; +// } +// } +// +// const Comp = () => +// <[|div|]> +// Some content +// <[|div|]>More content +// ; +// +// const x = +// Content +// ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.tsx", + "kind": "property", + "name": "(property) JSX.IntrinsicElements.div: any", + "textSpan": { + "start": 98, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "IntrinsicElements", + "kind": "interfaceName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "div", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "any", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 98, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 98, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 98, + "length": 9 + }, + "isWriteAccess": false, + "isDefinition": true + }, + { + "textSpan": { + "start": 141, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 176, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 194, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 175, + "length": 23 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 205, + "length": 3 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 140, + "length": 69 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.tsx === +// namespace JSX { +// export interface Element { } +// export interface IntrinsicElements { +// div: any; +// } +// } +// +// const /*FIND ALL REFS*/[|Comp|] = () => +//
+// Some content +//
More content
+//
; +// +// const x = <[|Comp|]> +// Content +// ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.tsx", + "kind": "const", + "name": "const Comp: () => JSX.Element", + "textSpan": { + "start": 123, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Comp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 117, + "length": 93 + } + }, + "references": [ + { + "textSpan": { + "start": 123, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 117, + "length": 93 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 223, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 222, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 243, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 222, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.tsx === +// namespace JSX { +// export interface Element { } +// export interface IntrinsicElements { +// div: any; +// } +// } +// +// const [|Comp|] = () => +//
+// Some content +//
More content
+//
; +// +// const x = +// Content +// ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.tsx", + "kind": "const", + "name": "const Comp: () => JSX.Element", + "textSpan": { + "start": 123, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Comp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 117, + "length": 93 + } + }, + "references": [ + { + "textSpan": { + "start": 123, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 117, + "length": 93 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 223, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 222, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 243, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 222, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /a.tsx === +// namespace JSX { +// export interface Element { } +// export interface IntrinsicElements { +// div: any; +// } +// } +// +// const [|Comp|] = () => +//
+// Some content +//
More content
+//
; +// +// const x = <[|Comp|]> +// Content +// ; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a.tsx", + "kind": "const", + "name": "const Comp: () => JSX.Element", + "textSpan": { + "start": 123, + "length": 4 + }, + "displayParts": [ + { + "text": "const", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Comp", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=>", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "JSX", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Element", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 117, + "length": 93 + } + }, + "references": [ + { + "textSpan": { + "start": 123, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 117, + "length": 93 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 223, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 222, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 243, + "length": 4 + }, + "fileName": "/a.tsx", + "contextSpan": { + "start": 222, + "length": 26 + }, + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/jsDocServices.baseline.jsonc b/tests/baselines/reference/jsDocServices.baseline.jsonc new file mode 100644 index 00000000000..570bc451f21 --- /dev/null +++ b/tests/baselines/reference/jsDocServices.baseline.jsonc @@ -0,0 +1,290 @@ +// === /tests/cases/fourslash/jsDocServices.ts === +// interface I {} +// +// /** +// * @param /*FIND ALL REFS*/[|foo|] I pity the foo +// */ +// function f([|foo|]: I) { +// return [|foo|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "kind": "parameter", + "name": "(parameter) foo: I", + "textSpan": { + "start": 64, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 64, + "length": 6 + } + }, + "references": [ + { + "textSpan": { + "start": 30, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "contextSpan": { + "start": 64, + "length": 6 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 85, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/jsDocServices.ts === +// interface I {} +// +// /** +// * @param [|foo|] I pity the foo +// */ +// function f(/*FIND ALL REFS*/[|foo|]: I) { +// return [|foo|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "kind": "parameter", + "name": "(parameter) foo: I", + "textSpan": { + "start": 64, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 64, + "length": 6 + } + }, + "references": [ + { + "textSpan": { + "start": 30, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "contextSpan": { + "start": 64, + "length": 6 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 85, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/jsDocServices.ts === +// interface I {} +// +// /** +// * @param [|foo|] I pity the foo +// */ +// function f([|foo|]: I) { +// return /*FIND ALL REFS*/[|foo|]; +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "kind": "parameter", + "name": "(parameter) foo: I", + "textSpan": { + "start": 64, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "I", + "kind": "interfaceName" + } + ], + "contextSpan": { + "start": 64, + "length": 6 + } + }, + "references": [ + { + "textSpan": { + "start": 30, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 64, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "contextSpan": { + "start": 64, + "length": 6 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 85, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/jsDocServices.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/jsdocTypedefTagServices.baseline.jsonc b/tests/baselines/reference/jsdocTypedefTagServices.baseline.jsonc new file mode 100644 index 00000000000..f6e6bbfd98d --- /dev/null +++ b/tests/baselines/reference/jsdocTypedefTagServices.baseline.jsonc @@ -0,0 +1,241 @@ +// === /tests/cases/fourslash/a.js === +// /** +// * Doc comment +// * @typedef [|Product|] +// * @property {string} title +// */ +// /** +// * @type {/*FIND ALL REFS*/[|Product|]} +// */ +// const product = null; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "type", + "name": "type Product = {\n title: string;\n}", + "textSpan": { + "start": 31, + "length": 7 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Product", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "title", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 22, + "length": 46 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 22, + "length": 46 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 85, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/a.js === +// /** +// * Doc comment +// * @typedef /*FIND ALL REFS*/[|Product|] +// * @property {string} title +// */ +// /** +// * @type {[|Product|]} +// */ +// const product = null; + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/a.js", + "kind": "type", + "name": "type Product = {\n title: string;\n}", + "textSpan": { + "start": 31, + "length": 7 + }, + "displayParts": [ + { + "text": "type", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "Product", + "kind": "aliasName" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "=", + "kind": "operator" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "{", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "title", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + }, + { + "text": ";", + "kind": "punctuation" + }, + { + "text": "\n", + "kind": "lineBreak" + }, + { + "text": "}", + "kind": "punctuation" + } + ], + "contextSpan": { + "start": 22, + "length": 46 + } + }, + "references": [ + { + "textSpan": { + "start": 31, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/a.js", + "contextSpan": { + "start": 22, + "length": 46 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 85, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/a.js", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/localGetReferences.baseline.jsonc b/tests/baselines/reference/localGetReferences.baseline.jsonc index 56e8f0fd8e9..436ad073390 100644 --- a/tests/baselines/reference/localGetReferences.baseline.jsonc +++ b/tests/baselines/reference/localGetReferences.baseline.jsonc @@ -1,3 +1,10294 @@ +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// /*FIND ALL REFS*/var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var /*FIND ALL REFS*/[|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// /*FIND ALL REFS*/static [|clsSVar|] = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsSVar: number", + "textSpan": { + "start": 195, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 188, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 195, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 188, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 402, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 686, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 889, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1075, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1353, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static /*FIND ALL REFS*/[|clsSVar|] = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsSVar: number", + "textSpan": { + "start": 195, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 188, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 195, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 188, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 402, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 686, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 889, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1075, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1353, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// /*FIND ALL REFS*/[|clsVar|] = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.[|clsVar|]++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsVar: number", + "textSpan": { + "start": 265, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 265, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 265, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 265, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 377, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (/*FIND ALL REFS*/public [|clsParam|]: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.[|clsParam|]++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsParam: number", + "textSpan": { + "start": 302, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsParam", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 295, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 302, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 295, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 470, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public /*FIND ALL REFS*/[|clsParam|]: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.[|clsParam|]++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsParam: number", + "textSpan": { + "start": 302, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsParam", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 295, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 302, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 295, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 470, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// /*FIND ALL REFS*/[|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// [|clsVar|] = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this./*FIND ALL REFS*/[|clsVar|]++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsVar: number", + "textSpan": { + "start": 265, + "length": 6 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 265, + "length": 11 + } + }, + "references": [ + { + "textSpan": { + "start": 265, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 265, + "length": 11 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 377, + "length": 6 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static [|clsSVar|] = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls./*FIND ALL REFS*/[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsSVar: number", + "textSpan": { + "start": 195, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 188, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 195, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 188, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 402, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 686, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 889, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1075, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1353, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public [|clsParam|]: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this./*FIND ALL REFS*/[|clsParam|]++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsParam: number", + "textSpan": { + "start": 302, + "length": 8 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsParam", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 295, + "length": 23 + } + }, + "references": [ + { + "textSpan": { + "start": 302, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 295, + "length": 23 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 470, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// /*FIND ALL REFS*/function [|foo|](x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "function", + "name": "function foo(x: number): number", + "textSpan": { + "start": 565, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 556, + "length": 224 + } + }, + "references": [ + { + "textSpan": { + "start": 565, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 556, + "length": 224 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 956, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1012, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1150, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1316, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1490, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function /*FIND ALL REFS*/[|foo|](x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "function", + "name": "function foo(x: number): number", + "textSpan": { + "start": 565, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 556, + "length": 224 + } + }, + "references": [ + { + "textSpan": { + "start": 565, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 556, + "length": 224 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 956, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1012, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1150, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1316, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1490, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(/*FIND ALL REFS*/[|x|]: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "parameter", + "name": "(parameter) x: number", + "textSpan": { + "start": 569, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 569, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 569, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 569, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 774, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// /*FIND ALL REFS*/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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "local var", + "name": "(local var) fnVar: number", + "textSpan": { + "start": 646, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local var", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fnVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 642, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 646, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 642, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 740, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// var /*FIND ALL REFS*/[|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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "local var", + "name": "(local var) fnVar: number", + "textSpan": { + "start": 646, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local var", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fnVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 642, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 646, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 642, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 740, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static [|clsSVar|] = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// var fnVar = 1; +// +// //Increments +// fooCls./*FIND ALL REFS*/[|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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsSVar: number", + "textSpan": { + "start": 195, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 188, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 195, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 188, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 402, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 686, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 889, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1075, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1353, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// var fnVar = 1; +// +// //Increments +// fooCls.clsSVar++; +// /*FIND ALL REFS*/[|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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// var [|fnVar|] = 1; +// +// //Increments +// fooCls.clsSVar++; +// globalVar++; +// modTest.modVar++; +// /*FIND ALL REFS*/[|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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "local var", + "name": "(local var) fnVar: number", + "textSpan": { + "start": 646, + "length": 5 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "local var", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fnVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 642, + "length": 14 + } + }, + "references": [ + { + "textSpan": { + "start": 646, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 642, + "length": 14 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 740, + "length": 5 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo([|x|]: number) { +// // References to a variable declared in a function. +// var fnVar = 1; +// +// //Increments +// fooCls.clsSVar++; +// globalVar++; +// modTest.modVar++; +// fnVar++; +// +// //Return +// return /*FIND ALL REFS*/[|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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "parameter", + "name": "(parameter) x: number", + "textSpan": { + "start": 569, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 569, + "length": 9 + } + }, + "references": [ + { + "textSpan": { + "start": 569, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 569, + "length": 9 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 774, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// var fnVar = 1; +// +// //Increments +// fooCls.clsSVar++; +// [|globalVar|]++; +// modTest.modVar++; +// fnVar++; +// +// //Return +// return x++; +// } +// +// module modTest { +// //Declare +// export var modVar:number; +// +// //Increments +// /*FIND ALL REFS*/[|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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static [|clsSVar|] = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// var fnVar = 1; +// +// //Increments +// fooCls.[|clsSVar|]++; +// globalVar++; +// modTest.modVar++; +// fnVar++; +// +// //Return +// return x++; +// } +// +// module modTest { +// //Declare +// export var modVar:number; +// +// //Increments +// globalVar++; +// fooCls./*FIND ALL REFS*/[|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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsSVar: number", + "textSpan": { + "start": 195, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 188, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 195, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 188, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 402, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 686, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 889, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1075, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1353, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function [|foo|](x: number) { +// // References to a variable declared in a function. +// 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 = /*FIND ALL REFS*/[|foo|]; +// } +// +// function testFn(){ +// static boo = [|foo|]; +// +// //Increments +// globalVar++; +// fooCls.clsSVar++; +// modVar++; +// } +// +// module testMod { +// var boo = [|foo|]; +// } +// } +// +// //Type test +// var clsTest: fooCls; +// +// //Arguments +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "function", + "name": "function foo(x: number): number", + "textSpan": { + "start": 565, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 556, + "length": 224 + } + }, + "references": [ + { + "textSpan": { + "start": 565, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 556, + "length": 224 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 956, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1012, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1150, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1316, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1490, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function [|foo|](x: number) { +// // References to a variable declared in a function. +// 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 = /*FIND ALL REFS*/[|foo|]; +// +// //Increments +// globalVar++; +// fooCls.clsSVar++; +// modVar++; +// } +// +// module testMod { +// var boo = [|foo|]; +// } +// } +// +// //Type test +// var clsTest: fooCls; +// +// //Arguments +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "function", + "name": "function foo(x: number): number", + "textSpan": { + "start": 565, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 556, + "length": 224 + } + }, + "references": [ + { + "textSpan": { + "start": 565, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 556, + "length": 224 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 956, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1012, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1150, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1316, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1490, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// /*FIND ALL REFS*/[|globalVar|]++; +// fooCls.clsSVar++; +// modVar++; +// } +// +// module testMod { +// var boo = foo; +// } +// } +// +// //Type test +// var clsTest: fooCls; +// +// //Arguments +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static [|clsSVar|] = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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./*FIND ALL REFS*/[|clsSVar|]++; +// modVar++; +// } +// +// module testMod { +// var boo = foo; +// } +// } +// +// //Type test +// var clsTest: fooCls; +// +// //Arguments +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsSVar: number", + "textSpan": { + "start": 195, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 188, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 195, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 188, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 402, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 686, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 889, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1075, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1353, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function [|foo|](x: number) { +// // References to a variable declared in a function. +// 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 = /*FIND ALL REFS*/[|foo|]; +// } +// } +// +// //Type test +// var clsTest: fooCls; +// +// //Arguments +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "function", + "name": "function foo(x: number): number", + "textSpan": { + "start": 565, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 556, + "length": 224 + } + }, + "references": [ + { + "textSpan": { + "start": 565, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 556, + "length": 224 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 956, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1012, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1150, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1316, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1490, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(/*FIND ALL REFS*/[|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function [|foo|](x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// /*FIND ALL REFS*/[|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "function", + "name": "function foo(x: number): number", + "textSpan": { + "start": 565, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 556, + "length": 224 + } + }, + "references": [ + { + "textSpan": { + "start": 565, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 556, + "length": 224 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 956, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1012, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1150, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1316, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1490, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo(/*FIND ALL REFS*/[|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static [|clsSVar|] = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.[|clsSVar|]++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls./*FIND ALL REFS*/[|clsSVar|]++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "property", + "name": "(property) fooCls.clsSVar: number", + "textSpan": { + "start": 195, + "length": 7 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "fooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "clsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 188, + "length": 19 + } + }, + "references": [ + { + "textSpan": { + "start": 195, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 188, + "length": 19 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 402, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 686, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 889, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1075, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1353, + "length": 7 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// /*FIND ALL REFS*/[|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = /*FIND ALL REFS*/[|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + /*FIND ALL REFS*/[|globalVar|]; +// +// //ETC - Other cases +// [|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var [|globalVar|]: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// [|globalVar|]++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls([|globalVar|]); +// // References to a function argument. +// foo([|globalVar|]); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// [|globalVar|] = [|globalVar|] + [|globalVar|]; +// +// //ETC - Other cases +// /*FIND ALL REFS*/[|globalVar|] = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "var", + "name": "var globalVar: number", + "textSpan": { + "start": 87, + "length": 9 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 83, + "length": 26 + } + }, + "references": [ + { + "textSpan": { + "start": 87, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 83, + "length": 26 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 351, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 701, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 865, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1047, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1266, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1320, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1382, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1394, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1406, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1438, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function [|foo|](x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// /*FIND ALL REFS*/[|foo|] = [|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "function", + "name": "function foo(x: number): number", + "textSpan": { + "start": 565, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 556, + "length": 224 + } + }, + "references": [ + { + "textSpan": { + "start": 565, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 556, + "length": 224 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 956, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1012, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1150, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1316, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1490, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function [|foo|](x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// [|foo|](globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// [|foo|] = /*FIND ALL REFS*/[|foo|] + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "function", + "name": "function foo(x: number): number", + "textSpan": { + "start": 565, + "length": 3 + }, + "displayParts": [ + { + "text": "function", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "foo", + "kind": "functionName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "x", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 556, + "length": 224 + } + }, + "references": [ + { + "textSpan": { + "start": 565, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 556, + "length": 224 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 956, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1012, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1150, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1316, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1490, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(/*FIND ALL REFS*/[|globalVar|]: number) { +// //Increments +// [|globalVar|]++; +// return [|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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "parameter", + "name": "(parameter) globalVar: number", + "textSpan": { + "start": 1557, + "length": 9 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1557, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 1557, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 1557, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 1599, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1623, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw([|globalVar|]: number) { +// //Increments +// /*FIND ALL REFS*/[|globalVar|]++; +// return [|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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "parameter", + "name": "(parameter) globalVar: number", + "textSpan": { + "start": 1557, + "length": 9 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1557, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 1557, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 1557, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 1599, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1623, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw([|globalVar|]: number) { +// //Increments +// [|globalVar|]++; +// return /*FIND ALL REFS*/[|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(str) { +// +// +// +// // Reference misses function parameter. +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "parameter", + "name": "(parameter) globalVar: number", + "textSpan": { + "start": 1557, + "length": 9 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "globalVar", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 1557, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 1557, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "contextSpan": { + "start": 1557, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 1599, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1623, + "length": 9 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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(/*FIND ALL REFS*/[|str|]) { +// +// +// +// // Reference misses function parameter. +// return [|str|] + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "parameter", + "name": "(parameter) str: string", + "textSpan": { + "start": 2052, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "str", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 2052, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 2115, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/localGetReferences_1.ts === +// // Comment Refence Test: globalVar +// // References to a variable declared in global. +// var globalVar: number = 2; +// +// class fooCls { +// // References to static variable declared in a class. +// static clsSVar = 1; +// // References to a variable declared in a class. +// clsVar = 1; +// +// constructor (public clsParam: number) { +// //Increments +// globalVar++; +// this.clsVar++; +// fooCls.clsSVar++; +// // References to a class parameter. +// this.clsParam++; +// modTest.modVar++; +// } +// } +// +// // References to a function parameter. +// function foo(x: number) { +// // References to a variable declared in a function. +// 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 +// // References to a class argument. +// clsTest = new fooCls(globalVar); +// // References to a function argument. +// foo(globalVar); +// +// //Increments +// fooCls.clsSVar++; +// modTest.modVar++; +// globalVar = globalVar + globalVar; +// +// //ETC - Other cases +// globalVar = 3; +// // References to illegal assignment. +// foo = foo + 1; +// err = err++; +// +// //Shadowed fn Parameter +// function shdw(globalVar: number) { +// //Increments +// globalVar++; +// return 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([|str|]) { +// +// +// +// // Reference misses function parameter. +// return /*FIND ALL REFS*/[|str|] + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "kind": "parameter", + "name": "(parameter) str: string", + "textSpan": { + "start": 2052, + "length": 3 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "parameter", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "str", + "kind": "parameterName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "string", + "kind": "keyword" + } + ] + }, + "references": [ + { + "textSpan": { + "start": 2052, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 2115, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/localGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + undefined undefined diff --git a/tests/baselines/reference/remoteGetReferences.baseline.jsonc b/tests/baselines/reference/remoteGetReferences.baseline.jsonc new file mode 100644 index 00000000000..7c89ba1bfd0 --- /dev/null +++ b/tests/baselines/reference/remoteGetReferences.baseline.jsonc @@ -0,0 +1,8919 @@ +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: /*FIND ALL REFS*/[|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: [|remotefooCls|]; +// +// //Arguments +// remoteclsTest = new /*FIND ALL REFS*/[|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls(/*FIND ALL REFS*/[|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls([|remoteglobalVar|]); +// remotefoo(/*FIND ALL REFS*/[|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: [|remotefooCls|]; +// +// //Arguments +// remoteclsTest = new [|remotefooCls|](remoteglobalVar); +// remotefoo(remoteglobalVar); +// +// //Increments +// /*FIND ALL REFS*/[|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls(remoteglobalVar); +// remotefoo(remoteglobalVar); +// +// //Increments +// remotefooCls./*FIND ALL REFS*/[|remoteclsSVar|]++; +// remotemodTest.remotemodVar++; +// remoteglobalVar = remoteglobalVar + remoteglobalVar; +// +// //ETC - Other cases +// remoteglobalVar = 3; +// +// //Find References misses method param +// var +// +// +// +// array = ["f", "o", "o"]; +// +// array.forEach( +// +// +// function(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsSVar: number", + "textSpan": { + "start": 93, + "length": 13 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 86, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 1431, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 93, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 86, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 233, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 413, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 647, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 857, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls([|remoteglobalVar|]); +// remotefoo([|remoteglobalVar|]); +// +// //Increments +// remotefooCls.remoteclsSVar++; +// remotemodTest.remotemodVar++; +// /*FIND ALL REFS*/[|remoteglobalVar|] = [|remoteglobalVar|] + [|remoteglobalVar|]; +// +// //ETC - Other cases +// [|remoteglobalVar|] = 3; +// +// //Find References misses method param +// var +// +// +// +// array = ["f", "o", "o"]; +// +// array.forEach( +// +// +// function(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls([|remoteglobalVar|]); +// remotefoo([|remoteglobalVar|]); +// +// //Increments +// remotefooCls.remoteclsSVar++; +// remotemodTest.remotemodVar++; +// [|remoteglobalVar|] = /*FIND ALL REFS*/[|remoteglobalVar|] + [|remoteglobalVar|]; +// +// //ETC - Other cases +// [|remoteglobalVar|] = 3; +// +// //Find References misses method param +// var +// +// +// +// array = ["f", "o", "o"]; +// +// array.forEach( +// +// +// function(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls([|remoteglobalVar|]); +// remotefoo([|remoteglobalVar|]); +// +// //Increments +// remotefooCls.remoteclsSVar++; +// remotemodTest.remotemodVar++; +// [|remoteglobalVar|] = [|remoteglobalVar|] + /*FIND ALL REFS*/[|remoteglobalVar|]; +// +// //ETC - Other cases +// [|remoteglobalVar|] = 3; +// +// //Find References misses method param +// var +// +// +// +// array = ["f", "o", "o"]; +// +// array.forEach( +// +// +// function(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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; +// } +// } + +// === /tests/cases/fourslash/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: remotefooCls; +// +// //Arguments +// remoteclsTest = new remotefooCls([|remoteglobalVar|]); +// remotefoo([|remoteglobalVar|]); +// +// //Increments +// remotefooCls.remoteclsSVar++; +// remotemodTest.remotemodVar++; +// [|remoteglobalVar|] = [|remoteglobalVar|] + [|remoteglobalVar|]; +// +// //ETC - Other cases +// /*FIND ALL REFS*/[|remoteglobalVar|] = 3; +// +// //Find References misses method param +// var +// +// +// +// array = ["f", "o", "o"]; +// +// array.forEach( +// +// +// function(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// /*FIND ALL REFS*/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; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var /*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var remoteglobalVar: number = 2; +// +// /*FIND ALL REFS*/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; +// } +// } + +// === /tests/cases/fourslash/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: [|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var remoteglobalVar: number = 2; +// +// class /*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: [|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var remoteglobalVar: number = 2; +// +// class remotefooCls { +// //Declare +// /*FIND ALL REFS*/[|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; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsVar: number", + "textSpan": { + "start": 67, + "length": 12 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 67, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 67, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 67, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 202, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var remoteglobalVar: number = 2; +// +// class remotefooCls { +// //Declare +// remoteclsVar = 1; +// /*FIND ALL REFS*/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; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsSVar: number", + "textSpan": { + "start": 93, + "length": 13 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 86, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 1431, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 93, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 86, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 233, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 413, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 647, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 857, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var remoteglobalVar: number = 2; +// +// class remotefooCls { +// //Declare +// remoteclsVar = 1; +// static /*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsSVar: number", + "textSpan": { + "start": 93, + "length": 13 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 86, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 1431, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 93, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 86, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 233, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 413, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 647, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 857, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var [|remoteglobalVar|]: number = 2; +// +// class remotefooCls { +// //Declare +// remoteclsVar = 1; +// static remoteclsSVar = 1; +// +// constructor(public remoteclsParam: number) { +// //Increments +// /*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var remoteglobalVar: number = 2; +// +// class remotefooCls { +// //Declare +// [|remoteclsVar|] = 1; +// static remoteclsSVar = 1; +// +// constructor(public remoteclsParam: number) { +// //Increments +// remoteglobalVar++; +// this./*FIND ALL REFS*/[|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; +// } +// } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsVar: number", + "textSpan": { + "start": 67, + "length": 12 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 67, + "length": 17 + } + }, + "references": [ + { + "textSpan": { + "start": 67, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 67, + "length": 17 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 202, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var remoteglobalVar: number = 2; +// +// class [|remotefooCls|] { +// //Declare +// remoteclsVar = 1; +// static remoteclsSVar = 1; +// +// constructor(public remoteclsParam: number) { +// //Increments +// remoteglobalVar++; +// this.remoteclsVar++; +// /*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: [|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_2.ts === +// var remoteglobalVar: number = 2; +// +// class remotefooCls { +// //Declare +// remoteclsVar = 1; +// static [|remoteclsSVar|] = 1; +// +// constructor(public remoteclsParam: number) { +// //Increments +// remoteglobalVar++; +// this.remoteclsVar++; +// remotefooCls./*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsSVar: number", + "textSpan": { + "start": 93, + "length": 13 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 86, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 1431, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 93, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 86, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 233, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 413, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 647, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 857, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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 +// /*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: [|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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./*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsSVar: number", + "textSpan": { + "start": 93, + "length": 13 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 86, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 1431, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 93, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 86, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 233, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 413, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 647, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 857, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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++; +// /*FIND ALL REFS*/[|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; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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 +// /*FIND ALL REFS*/[|remoteglobalVar|]++; +// remotefooCls.remoteclsSVar++; +// remotemodVar++; +// +// class remotetestCls { +// static remoteboo = remotefoo; +// } +// +// function remotetestFn(){ +// static remoteboo = remotefoo; +// +// //Increments +// [|remoteglobalVar|]++; +// remotefooCls.remoteclsSVar++; +// remotemodVar++; +// } +// +// module remotetestMod { +// var remoteboo = remotefoo; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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++; +// /*FIND ALL REFS*/[|remotefooCls|].remoteclsSVar++; +// remotemodVar++; +// +// class remotetestCls { +// static remoteboo = remotefoo; +// } +// +// function remotetestFn(){ +// static remoteboo = remotefoo; +// +// //Increments +// remoteglobalVar++; +// [|remotefooCls|].remoteclsSVar++; +// remotemodVar++; +// } +// +// module remotetestMod { +// var remoteboo = remotefoo; +// } +// } + +// === /tests/cases/fourslash/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: [|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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./*FIND ALL REFS*/[|remoteclsSVar|]++; +// remotemodVar++; +// +// class remotetestCls { +// static remoteboo = remotefoo; +// } +// +// function remotetestFn(){ +// static remoteboo = remotefoo; +// +// //Increments +// remoteglobalVar++; +// remotefooCls.[|remoteclsSVar|]++; +// remotemodVar++; +// } +// +// module remotetestMod { +// var remoteboo = remotefoo; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsSVar: number", + "textSpan": { + "start": 93, + "length": 13 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 86, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 1431, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 93, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 86, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 233, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 413, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 647, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 857, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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 +// /*FIND ALL REFS*/[|remoteglobalVar|]++; +// remotefooCls.remoteclsSVar++; +// remotemodVar++; +// } +// +// module remotetestMod { +// var remoteboo = remotefoo; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "var", + "name": "var remoteglobalVar: number", + "textSpan": { + "start": 4, + "length": 15 + }, + "displayParts": [ + { + "text": "var", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remoteglobalVar", + "kind": "localName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 0, + "length": 32 + } + }, + "references": [ + { + "textSpan": { + "start": 1358, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1386, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1478, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 1496, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1514, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1552, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 4, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 0, + "length": 32 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 176, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 431, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 614, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 823, + "length": 15 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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++; +// /*FIND ALL REFS*/[|remotefooCls|].remoteclsSVar++; +// remotemodVar++; +// } +// +// module remotetestMod { +// var remoteboo = remotefoo; +// } +// } + +// === /tests/cases/fourslash/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: [|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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "class", + "name": "class remotefooCls", + "textSpan": { + "start": 40, + "length": 12 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + } + ], + "contextSpan": { + "start": 34, + "length": 277 + } + }, + "references": [ + { + "textSpan": { + "start": 1298, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1345, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 1418, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 40, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 34, + "length": 277 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 220, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 400, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 634, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 844, + "length": 12 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/remoteGetReferences_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./*FIND ALL REFS*/[|remoteclsSVar|]++; +// remotemodVar++; +// } +// +// module remotetestMod { +// var remoteboo = remotefoo; +// } +// } + +// === /tests/cases/fourslash/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: 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(str) { +// +// +// +// return str + " "; +// +// }); + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "kind": "property", + "name": "(property) remotefooCls.remoteclsSVar: number", + "textSpan": { + "start": 93, + "length": 13 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "remotefooCls", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "remoteclsSVar", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "number", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 86, + "length": 25 + } + }, + "references": [ + { + "textSpan": { + "start": 1431, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_1.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 93, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "contextSpan": { + "start": 86, + "length": 25 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 233, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 413, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 647, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + }, + { + "textSpan": { + "start": 857, + "length": 13 + }, + "fileName": "/tests/cases/fourslash/remoteGetReferences_2.ts", + "isWriteAccess": true, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts b/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts index aafb491008b..4017383e2e5 100644 --- a/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts +++ b/tests/cases/fourslash/cancellationWhenfindingAllRefsOnDefinition.ts @@ -7,9 +7,9 @@ //// //// } //// -//// [|public /**/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}start|](){ +//// public /*1*/start(){ //// return this; -//// }|] +//// } //// //// public stop(){ //// return this; @@ -20,9 +20,11 @@ ////import Second = require("./findAllRefsOnDefinition-import"); //// ////var second = new Second.Test() -////second.[|start|](); +////second./*2*/start(); ////second.stop(); +let count = 1; + checkRefs(); cancellation.setCancelled(); @@ -33,5 +35,5 @@ cancellation.resetCancelled(); checkRefs(); function checkRefs() { - verify.singleReferenceGroup("(method) Test.start(): this", "start"); + verify.baselineFindAllReferencesMulti(count++, '1'); } diff --git a/tests/cases/fourslash/findAllRefsPrimitive.ts b/tests/cases/fourslash/findAllRefsPrimitive.ts index 016b9e4bbb9..5b810c7a43c 100644 --- a/tests/cases/fourslash/findAllRefsPrimitive.ts +++ b/tests/cases/fourslash/findAllRefsPrimitive.ts @@ -3,28 +3,28 @@ /// // @Filename: a.ts -////const x: [|any|] = 0; +////const x: /*1*/[|any|] = 0; ////const any = 2; -////const y: [|any|] = any; +////const y: /*2*/[|any|] = any; -////function f(b: [|boolean|]): [|boolean|]; +////function f(b: /*3*/[|boolean|]): /*4*/[|boolean|]; -////type T = [|never|]; type U = [|never|]; +////type T = /*5*/[|never|]; type U = /*6*/[|never|]; -////function n(x: [|number|]): [|number|]; +////function n(x: /*7*/[|number|]): /*8*/[|number|]; -////function o(x: [|object|]): [|object|]; +////function o(x: /*9*/[|object|]): /*10*/[|object|]; -////function s(x: [|string|]): [|string|]; +////function s(x: /*11*/[|string|]): /*12*/[|string|]; -////function sy(s: [|symbol|]): [|symbol|]; +////function sy(s: /*13*/[|symbol|]): /*14*/[|symbol|]; -////function v(v: [|void|]): [|void|]; +////function v(v: /*15*/[|void|]): /*16*/[|void|]; // @Filename: b.ts -// const z: [|any|] = 0; +//// const z: /*17*/[|any|] = 0; -test.rangesByText().forEach((ranges, text) => verify.singleReferenceGroup(text, ranges)); +verify.baselineFindAllReferences('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17'); verify.rangesWithSameTextAreDocumentHighlights(); goTo.rangeStart(test.ranges()[0]); diff --git a/tests/cases/fourslash/findReferencesAfterEdit.ts b/tests/cases/fourslash/findReferencesAfterEdit.ts index 4974132dd12..1fed3434cb2 100644 --- a/tests/cases/fourslash/findReferencesAfterEdit.ts +++ b/tests/cases/fourslash/findReferencesAfterEdit.ts @@ -2,19 +2,19 @@ // @Filename: a.ts ////interface A { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}foo|]: string;|] +//// /*1*/foo: string; ////} // @Filename: b.ts /////// /////**/ ////function foo(x: A) { -//// x.[|foo|] +//// x./*2*/foo ////} -verify.singleReferenceGroup("(property) A.foo: string", "foo"); +verify.baselineFindAllReferencesMulti(1, '1', '2'); goTo.marker(""); edit.insert("\n"); -verify.singleReferenceGroup("(property) A.foo: string", "foo"); +verify.baselineFindAllReferencesMulti(2, '1', '2'); diff --git a/tests/cases/fourslash/findReferencesJSXTagName3.ts b/tests/cases/fourslash/findReferencesJSXTagName3.ts index 2613f864730..b55a4a8e694 100644 --- a/tests/cases/fourslash/findReferencesJSXTagName3.ts +++ b/tests/cases/fourslash/findReferencesJSXTagName3.ts @@ -6,27 +6,30 @@ ////namespace JSX { //// export interface Element { } //// export interface IntrinsicElements { -//// [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}div|]: any;|] +//// [|[|/*1*/div|]: any;|] //// } ////} //// -////[|const [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}Comp|] = () => -//// [|<[|{| "contextRangeIndex": 4 |}div|]> +////[|const [|/*6*/Comp|] = () => +//// [|<[|/*2*/div|]> //// Some content -//// [|<[|{| "contextRangeIndex": 6 |}div|]>More content|] -//// |];|] +//// [|<[|/*3*/div|]>More content|] +//// |];|] //// -////const x = [|<[|{| "contextRangeIndex": 10 |}Comp|]> +////const x = [|<[|/*7*/Comp|]> //// Content -////|]; +////|]; const [d0Def, d0, c0Def, c0, d1Def, d1, d2Def, d2, d3, d4, c1Def, c1, c2] = test.ranges(); const allD = [d0, d1, d2, d3, d4]; const allC = [c0, c1, c2]; -verify.singleReferenceGroup("(property) JSX.IntrinsicElements.div: any", allD); -verify.singleReferenceGroup("const Comp: () => JSX.Element", allC); +verify.baselineFindAllReferences( + // div occurrences + '1', '2', '3', '4', '5', + // Comp occurrences + '6', '7', '8'); // For document highlights, we will just do tag matching if on a tag. Otherwise we find-all-references. verify.documentHighlightsOf(d0, [d0, d1, d2, d3, d4]); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index d6e0d3ce80c..486d24d4922 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -322,6 +322,7 @@ declare namespace FourSlashInterface { verifyGetEmitOutputForCurrentFile(expected: string): void; verifyGetEmitOutputContentsForCurrentFile(expected: ts.OutputFile[]): void; baselineFindAllReferences(...markerNames: string[]): void; + baselineFindAllReferencesMulti(seq: number, ...markerNames: string[]): void; baselineGetFileReferences(fileName: string): void; symbolAtLocation(startRange: Range, ...declarationRanges: Range[]): void; typeOfSymbolAtLocation(range: Range, symbol: any, expected: string): void; diff --git a/tests/cases/fourslash/jsDocServices.ts b/tests/cases/fourslash/jsDocServices.ts index 01619abe44d..3710647aff3 100644 --- a/tests/cases/fourslash/jsDocServices.ts +++ b/tests/cases/fourslash/jsDocServices.ts @@ -7,8 +7,8 @@ /////** //// * @param /*use*/[|foo|] I pity the foo //// */ -////function f([|[|/*def*/{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 1 |}foo|]: I|]) { -//// return [|foo|]; +////function f([|[|/*def*/{| "contextRangeIndex": 1 |}foo|]: I|]) { +//// return /*use2*/[|foo|]; ////} const [r0, r1Def, r1, r2] = test.ranges(); @@ -20,6 +20,6 @@ verify.goToType("use", "I"); goTo.marker("use"); verify.quickInfoIs("(parameter) foo: I", "I pity the foo"); -verify.singleReferenceGroup("(parameter) foo: I", ranges); +verify.baselineFindAllReferences("use", "def", "use2"); verify.rangesAreDocumentHighlights(ranges); verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/jsdocTypedefTagServices.ts b/tests/cases/fourslash/jsdocTypedefTagServices.ts index e59713c3b23..b89958fc5d2 100644 --- a/tests/cases/fourslash/jsdocTypedefTagServices.ts +++ b/tests/cases/fourslash/jsdocTypedefTagServices.ts @@ -5,7 +5,7 @@ /////** //// * Doc comment -//// * [|@typedef /*def*/[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}Product|] +//// * [|@typedef /*def*/[|{| "contextRangeIndex": 0 |}Product|] //// * @property {string} title //// |]*/ @@ -25,5 +25,5 @@ verify.goToDefinition("use", "def"); verify.rangesAreOccurrences(/*isWriteAccesss*/ undefined, ranges); verify.rangesAreDocumentHighlights(ranges); -verify.singleReferenceGroup(desc, ranges); +verify.baselineFindAllReferences("use", "def"); verify.rangesAreRenameLocations(ranges); diff --git a/tests/cases/fourslash/localGetReferences.ts b/tests/cases/fourslash/localGetReferences.ts index 752835b51e2..b7d07f13fc0 100644 --- a/tests/cases/fourslash/localGetReferences.ts +++ b/tests/cases/fourslash/localGetReferences.ts @@ -1,66 +1,66 @@ /// // @Filename: localGetReferences_1.ts -////// Comment Refence Test: g/*1*/lobalVar +////// Comment Refence Test: g/*43*/lobalVar ////// References to a variable declared in global. -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 0 |}globalVar|]: number = 2;|] +/////*1*/var /*2*/globalVar: number = 2; //// ////class fooCls { //// // References to static variable declared in a class. -//// [|static [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}clsSVar|] = 1;|] +//// /*3*/static /*4*/clsSVar = 1; //// // References to a variable declared in a class. -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}clsVar|] = 1;|] +//// /*5*/clsVar = 1; //// -//// constructor ([|public [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}clsParam|]: number|]) { +//// constructor (/*6*/public /*7*/clsParam: number) { //// //Increments -//// [|{| "isWriteAccess": true |}globalVar|]++; -//// this.[|{| "isWriteAccess": true |}clsVar|]++; -//// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; +//// /*8*/globalVar++; +//// this./*9*/clsVar++; +//// fooCls./*10*/clsSVar++; //// // References to a class parameter. -//// this.[|{| "isWriteAccess": true |}clsParam|]++; +//// this./*11*/clsParam++; //// modTest.modVar++; //// } ////} //// ////// References to a function parameter. -////[|function [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 12 |}foo|]([|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 14 |}x|]: number|]) { +/////*12*/function /*13*/foo(/*14*/x: number) { //// // References to a variable declared in a function. -//// [|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 16 |}fnVar|] = 1;|] +//// /*15*/var /*16*/fnVar = 1; //// //// //Increments -//// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; -//// [|{| "isWriteAccess": true |}globalVar|]++; +//// fooCls./*17*/clsSVar++; +//// /*18*/globalVar++; //// modTest.modVar++; -//// [|{| "isWriteAccess": true |}fnVar|]++; +//// /*19*/fnVar++; //// //// //Return -//// return [|{| "isWriteAccess": true |}x|]++; -////}|] +//// return /*20*/x++; +////} //// ////module modTest { //// //Declare //// export var modVar:number; //// //// //Increments -//// [|{| "isWriteAccess": true |}globalVar|]++; -//// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; +//// /*21*/globalVar++; +//// fooCls./*22*/clsSVar++; //// modVar++; //// //// class testCls { -//// static boo = [|foo|]; +//// static boo = /*23*/foo; //// } //// //// function testFn(){ -//// static boo = [|foo|]; +//// static boo = /*24*/foo; //// //// //Increments -//// [|{| "isWriteAccess": true |}globalVar|]++; -//// fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; +//// /*25*/globalVar++; +//// fooCls./*26*/clsSVar++; //// modVar++; //// } //// //// module testMod { -//// var boo = [|foo|]; +//// var boo = /*27*/foo; //// } ////} //// @@ -69,26 +69,26 @@ //// //////Arguments ////// References to a class argument. -////clsTest = new fooCls([|globalVar|]); +////clsTest = new fooCls(/*28*/globalVar); ////// References to a function argument. -////[|foo|]([|globalVar|]); +/////*29*/foo(/*30*/globalVar); //// //////Increments -////fooCls.[|{| "isWriteAccess": true |}clsSVar|]++; +////fooCls./*31*/clsSVar++; ////modTest.modVar++; -////[|{| "isWriteAccess": true |}globalVar|] = [|globalVar|] + [|globalVar|]; +/////*32*/globalVar = /*33*/globalVar + /*34*/globalVar; //// //////ETC - Other cases -////[|{| "isWriteAccess": true |}globalVar|] = 3; +/////*35*/globalVar = 3; ////// References to illegal assignment. -////[|{| "isWriteAccess": true |}foo|] = [|foo|] + 1; -/////*3*/err = err++; -/////*4*/ +/////*36*/foo = /*37*/foo + 1; +/////*44*/err = err++; +/////*45*/ //////Shadowed fn Parameter -////function shdw([|[|{| "isWriteAccess": true, "isDefinition": true, "shadow": true, "contextRangeIndex": 39 |}globalVar|]: number|]) { +////function shdw(/*38*/globalVar: number) { //// //Increments -//// [|{| "isWriteAccess": true, "shadow": true |}globalVar|]++; -//// return [|{| "shadow": true |}globalVar|]; +//// /*39*/globalVar++; +//// return /*40*/globalVar; ////} //// //////Remotes @@ -117,12 +117,12 @@ ////array.forEach( //// //// -////function([|{| "isWriteAccess": true, "isDefinition": true |}str|]) { +////function(/*41*/str) { //// //// //// //// // Reference misses function parameter. -//// return [|str|] + " "; +//// return /*42*/str + " "; //// ////}); @@ -185,55 +185,9 @@ //// } ////} -// References to comment / unresolved symbol / no context -verify.baselineFindAllReferences('1', '3', '4') - -test.rangesByText().forEach((ranges, text) => { - switch (text) { - case "var globalVar: number = 2;": - case "static clsSVar = 1;": - case "clsVar = 1;": - case "public clsParam: number": - case `function foo(x: number) { - // References to a variable declared in a function. - var fnVar = 1; - - //Increments - fooCls.clsSVar++; - globalVar++; - modTest.modVar++; - fnVar++; - - //Return - return x++; -}`: - case "x: number": - case "var fnVar = 1;": - case "globalVar: number": - return; - } - - if (text === "globalVar") { - verify.singleReferenceGroup("(parameter) globalVar: number", ranges.filter(isShadow)); - verify.singleReferenceGroup("var globalVar: number", ranges.filter(r => !isShadow(r))); - return; - } - - const definition = (() => { - switch (text) { - case "fnVar": return "(local var) fnVar: number"; - case "clsSVar": return "(property) fooCls.clsSVar: number"; - case "clsVar": return "(property) fooCls.clsVar: number"; - case "clsParam": return "(property) fooCls.clsParam: number"; - case "foo": return "function foo(x: number): number"; - case "x": return "(parameter) x: number"; - case "str": return "(parameter) str: string"; - default: throw new Error(text); - } - })(); - verify.singleReferenceGroup(definition, ranges); -}); - -function isShadow(r) { - return r.marker && r.marker.data && r.marker.data.shadow; -} +verify.baselineFindAllReferences( + '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/tests/cases/fourslash/remoteGetReferences.ts b/tests/cases/fourslash/remoteGetReferences.ts index 5636be5d242..060b16ebe65 100644 --- a/tests/cases/fourslash/remoteGetReferences.ts +++ b/tests/cases/fourslash/remoteGetReferences.ts @@ -86,19 +86,19 @@ //// //////Remotes //////Type test -////var remoteclsTest: [|remotefooCls|]; +////var remoteclsTest: /*1*/remotefooCls; //// //////Arguments -////remoteclsTest = new [|remotefooCls|]([|remoteglobalVar|]); -////remotefoo([|remoteglobalVar|]); +////remoteclsTest = new /*2*/remotefooCls(/*3*/remoteglobalVar); +////remotefoo(/*4*/remoteglobalVar); //// //////Increments -////[|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; +/////*5*/remotefooCls./*6*/remoteclsSVar++; ////remotemodTest.remotemodVar++; -////[|{| "isWriteAccess": true |}remoteglobalVar|] = [|remoteglobalVar|] + [|remoteglobalVar|]; +/////*7*/remoteglobalVar = /*8*/remoteglobalVar + /*9*/remoteglobalVar; //// //////ETC - Other cases -////[|{| "isWriteAccess": true |}remoteglobalVar|] = 3; +/////*10*/remoteglobalVar = 3; //// //////Find References misses method param ////var @@ -119,30 +119,30 @@ ////}); // @Filename: remoteGetReferences_2.ts -////[|var [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 10 |}remoteglobalVar|]: number = 2;|] +/////*11*/var /*12*/remoteglobalVar: number = 2; //// -////[|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 12 |}remotefooCls|] { +/////*13*/class /*14*/remotefooCls { //// //Declare -//// [|[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 14 |}remoteclsVar|] = 1;|] -//// [|static [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 16 |}remoteclsSVar|] = 1;|] +//// /*15*/remoteclsVar = 1; +//// /*16*/static /*17*/remoteclsSVar = 1; //// //// constructor(public remoteclsParam: number) { //// //Increments -//// [|{| "isWriteAccess": true |}remoteglobalVar|]++; -//// this.[|{| "isWriteAccess": true |}remoteclsVar|]++; -//// [|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; +//// /*18*/remoteglobalVar++; +//// this./*19*/remoteclsVar++; +//// /*20*/remotefooCls./*21*/remoteclsSVar++; //// this.remoteclsParam++; //// remotemodTest.remotemodVar++; //// } -////}|] +////} //// ////function remotefoo(remotex: number) { //// //Declare //// var remotefnVar = 1; //// //// //Increments -//// [|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; -//// [|{| "isWriteAccess": true |}remoteglobalVar|]++; +//// /*22*/remotefooCls./*23*/remoteclsSVar++; +//// /*24*/remoteglobalVar++; //// remotemodTest.remotemodVar++; //// remotefnVar++; //// @@ -155,8 +155,8 @@ //// export var remotemodVar: number; //// //// //Increments -//// [|{| "isWriteAccess": true |}remoteglobalVar|]++; -//// [|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; +//// /*25*/remoteglobalVar++; +//// /*26*/remotefooCls./*27*/remoteclsSVar++; //// remotemodVar++; //// //// class remotetestCls { @@ -167,8 +167,8 @@ //// static remoteboo = remotefoo; //// //// //Increments -//// [|{| "isWriteAccess": true |}remoteglobalVar|]++; -//// [|remotefooCls|].[|{| "isWriteAccess": true |}remoteclsSVar|]++; +//// /*28*/remoteglobalVar++; +//// /*29*/remotefooCls./*30*/remoteclsSVar++; //// remotemodVar++; //// } //// @@ -177,36 +177,7 @@ //// } ////} -test.rangesByText().forEach((ranges, text) => { - // Definitions - if (text === "var remoteglobalVar: number = 2;" || - text === `class remotefooCls { - //Declare - remoteclsVar = 1; - static remoteclsSVar = 1; - - constructor(public remoteclsParam: number) { - //Increments - remoteglobalVar++; - this.remoteclsVar++; - remotefooCls.remoteclsSVar++; - this.remoteclsParam++; - remotemodTest.remotemodVar++; - } -}` || - text == "remoteclsVar = 1;" || - text === "static remoteclsSVar = 1;" - ) return; - - const definition = (() => { - switch (text) { - case "remotefooCls": return "class remotefooCls"; - case "remoteglobalVar": return "var remoteglobalVar: number"; - case "remoteclsSVar": return "(property) remotefooCls.remoteclsSVar: number"; - case "remoteclsVar": return "(property) remotefooCls.remoteclsVar: number"; - default: throw new Error(text); - } - })(); - - verify.singleReferenceGroup(definition, ranges); -}); +verify.baselineFindAllReferences( + '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'); \ No newline at end of file From 276719753e0d84ca74e26a6189f672c504522848 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Mon, 4 Apr 2022 16:57:26 -0700 Subject: [PATCH 20/41] Allow arrow function parameter parsing to bail out during speculation, redo (#48493) * Allow arrow function parameter parsing to bail out during speculation, redo * Add correct baselines * Allow await/yield keywords for more graceful error reporting * Add test for other parser issue * Address some PR feedback * Add extra comment * Add async variants --- src/compiler/parser.ts | 61 ++++++-- ...tConfuseParenthesizedObjectForArrowHead.js | 29 ++++ ...useParenthesizedObjectForArrowHead.symbols | 27 ++++ ...nfuseParenthesizedObjectForArrowHead.types | 38 +++++ .../arrowFunctionParsingGenericInObject.js | 75 +++++++++ ...rrowFunctionParsingGenericInObject.symbols | 133 ++++++++++++++++ .../arrowFunctionParsingGenericInObject.types | 145 ++++++++++++++++++ ...tConfuseParenthesizedObjectForArrowHead.ts | 14 ++ .../arrowFunctionParsingGenericInObject.ts | 40 +++++ 9 files changed, 548 insertions(+), 14 deletions(-) create mode 100644 tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js create mode 100644 tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.symbols create mode 100644 tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.types create mode 100644 tests/baselines/reference/arrowFunctionParsingGenericInObject.js create mode 100644 tests/baselines/reference/arrowFunctionParsingGenericInObject.symbols create mode 100644 tests/baselines/reference/arrowFunctionParsingGenericInObject.types create mode 100644 tests/cases/compiler/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts create mode 100644 tests/cases/compiler/arrowFunctionParsingGenericInObject.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 5f9c7f0085e..059083df5ca 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2374,7 +2374,7 @@ namespace ts { return createNodeArray(list, listPos); } - function parseListElement(parsingContext: ParsingContext, parseElement: () => T): T { + function parseListElement(parsingContext: ParsingContext, parseElement: () => T): T { const node = currentNode(parsingContext); if (node) { return consumeNode(node) as T; @@ -2719,7 +2719,9 @@ namespace ts { } // Parses a comma-delimited list of elements - function parseDelimitedList(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray { + function parseDelimitedList(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray; + function parseDelimitedList(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray> | undefined; + function parseDelimitedList(kind: ParsingContext, parseElement: () => T, considerSemicolonAsDelimiter?: boolean): NodeArray> | undefined { const saveParsingContext = parsingContext; parsingContext |= 1 << kind; const list = []; @@ -2729,7 +2731,11 @@ namespace ts { while (true) { if (isListElement(kind, /*inErrorRecovery*/ false)) { const startPos = scanner.getStartPos(); - list.push(parseListElement(kind, parseElement)); + const result = parseListElement(kind, parseElement); + if (!result) { + return undefined; + } + list.push(result as NonNullable); commaStart = scanner.getTokenPos(); if (parseOptional(SyntaxKind.CommaToken)) { @@ -3239,15 +3245,24 @@ namespace ts { return name; } - function parseParameterInOuterAwaitContext() { - return parseParameterWorker(/*inOuterAwaitContext*/ true); + function isParameterNameStart() { + // Be permissive about await and yield by calling isBindingIdentifier instead of isIdentifier; disallowing + // them during a speculative parse leads to many more follow-on errors than allowing the function to parse then later + // complaining about the use of the keywords. + return isBindingIdentifier() || token() === SyntaxKind.OpenBracketToken || token() === SyntaxKind.OpenBraceToken; } - function parseParameter(): ParameterDeclaration { - return parseParameterWorker(/*inOuterAwaitContext*/ false); + function parseParameter(inOuterAwaitContext: boolean): ParameterDeclaration { + return parseParameterWorker(inOuterAwaitContext); } - function parseParameterWorker(inOuterAwaitContext: boolean): ParameterDeclaration { + function parseParameterForSpeculation(inOuterAwaitContext: boolean): ParameterDeclaration | undefined { + return parseParameterWorker(inOuterAwaitContext, /*allowAmbiguity*/ false); + } + + function parseParameterWorker(inOuterAwaitContext: boolean): ParameterDeclaration; + function parseParameterWorker(inOuterAwaitContext: boolean, allowAmbiguity: false): ParameterDeclaration | undefined; + function parseParameterWorker(inOuterAwaitContext: boolean, allowAmbiguity = true): ParameterDeclaration | undefined { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); @@ -3277,13 +3292,20 @@ namespace ts { const savedTopLevel = topLevel; topLevel = false; + const modifiers = parseModifiers(); + const dotDotDotToken = parseOptionalToken(SyntaxKind.DotDotDotToken); + + if (!allowAmbiguity && !isParameterNameStart()) { + return undefined; + } + const node = withJSDoc( finishNode( factory.createParameterDeclaration( decorators, modifiers, - parseOptionalToken(SyntaxKind.DotDotDotToken), + dotDotDotToken, parseNameOfParameter(modifiers), parseOptionalToken(SyntaxKind.QuestionToken), parseTypeAnnotation(), @@ -3322,7 +3344,9 @@ namespace ts { return false; } - function parseParametersWorker(flags: SignatureFlags) { + function parseParametersWorker(flags: SignatureFlags, allowAmbiguity: true): NodeArray; + function parseParametersWorker(flags: SignatureFlags, allowAmbiguity: false): NodeArray | undefined; + function parseParametersWorker(flags: SignatureFlags, allowAmbiguity: boolean): NodeArray | undefined { // FormalParameters [Yield,Await]: (modified) // [empty] // FormalParameterList[?Yield,Await] @@ -3344,7 +3368,7 @@ namespace ts { const parameters = flags & SignatureFlags.JSDoc ? parseDelimitedList(ParsingContext.JSDocParameters, parseJSDocParameter) : - parseDelimitedList(ParsingContext.Parameters, savedAwaitContext ? parseParameterInOuterAwaitContext : parseParameter); + parseDelimitedList(ParsingContext.Parameters, () => allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext)); setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); @@ -3370,7 +3394,7 @@ namespace ts { return createMissingList(); } - const parameters = parseParametersWorker(flags); + const parameters = parseParametersWorker(flags, /*allowAmbiguity*/ true); parseExpected(SyntaxKind.CloseParenToken); return parameters; } @@ -3463,7 +3487,7 @@ namespace ts { } function parseIndexSignatureDeclaration(pos: number, hasJSDoc: boolean, decorators: NodeArray | undefined, modifiers: NodeArray | undefined): IndexSignatureDeclaration { - const parameters = parseBracketedList(ParsingContext.Parameters, parseParameter, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); + const parameters = parseBracketedList(ParsingContext.Parameters, () => parseParameter(/*inOuterAwaitContext*/ false), SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken); const type = parseTypeAnnotation(); parseTypeMemberSemicolon(); const node = factory.createIndexSignature(decorators, modifiers, parameters, type); @@ -4641,7 +4665,16 @@ namespace ts { parameters = createMissingList(); } else { - parameters = parseParametersWorker(isAsync); + if (!allowAmbiguity) { + const maybeParameters = parseParametersWorker(isAsync, allowAmbiguity); + if (!maybeParameters) { + return undefined; + } + parameters = maybeParameters; + } + else { + parameters = parseParametersWorker(isAsync, allowAmbiguity); + } if (!parseExpected(SyntaxKind.CloseParenToken) && !allowAmbiguity) { return undefined; } diff --git a/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js new file mode 100644 index 00000000000..fbd013629a6 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js @@ -0,0 +1,29 @@ +//// [arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts] +// regression test for https://github.com/microsoft/TypeScript/issues/32914 +declare var value: boolean; +declare var a: any; + +const test = () => ({ + // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. + prop: !value, // remove ! to see that errors will be gone + run: () => { //replace arrow function with regular function to see that errors will be gone + // comment next line or remove "()" to see that errors will be gone + if(!a.b()) { return 'special'; } + + return 'default'; + } +}); + + +//// [arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.js] +var test = function () { return ({ + // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. + prop: !value, + run: function () { + // comment next line or remove "()" to see that errors will be gone + if (!a.b()) { + return 'special'; + } + return 'default'; + } +}); }; diff --git a/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.symbols b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.symbols new file mode 100644 index 00000000000..bd50c7118ae --- /dev/null +++ b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts === +// regression test for https://github.com/microsoft/TypeScript/issues/32914 +declare var value: boolean; +>value : Symbol(value, Decl(arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts, 1, 11)) + +declare var a: any; +>a : Symbol(a, Decl(arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts, 2, 11)) + +const test = () => ({ +>test : Symbol(test, Decl(arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts, 4, 5)) + + // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. + prop: !value, // remove ! to see that errors will be gone +>prop : Symbol(prop, Decl(arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts, 4, 21)) +>value : Symbol(value, Decl(arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts, 1, 11)) + + run: () => { //replace arrow function with regular function to see that errors will be gone +>run : Symbol(run, Decl(arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts, 6, 17)) + + // comment next line or remove "()" to see that errors will be gone + if(!a.b()) { return 'special'; } +>a : Symbol(a, Decl(arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts, 2, 11)) + + return 'default'; + } +}); + diff --git a/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.types b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.types new file mode 100644 index 00000000000..22f3dea71fa --- /dev/null +++ b/tests/baselines/reference/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.types @@ -0,0 +1,38 @@ +=== tests/cases/compiler/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts === +// regression test for https://github.com/microsoft/TypeScript/issues/32914 +declare var value: boolean; +>value : boolean + +declare var a: any; +>a : any + +const test = () => ({ +>test : () => { prop: boolean; run: () => "special" | "default"; } +>() => ({ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }}) : () => { prop: boolean; run: () => "special" | "default"; } +>({ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }}) : { prop: boolean; run: () => "special" | "default"; } +>{ // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. prop: !value, // remove ! to see that errors will be gone run: () => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; }} : { prop: boolean; run: () => "special" | "default"; } + + // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. + prop: !value, // remove ! to see that errors will be gone +>prop : boolean +>!value : boolean +>value : boolean + + run: () => { //replace arrow function with regular function to see that errors will be gone +>run : () => "special" | "default" +>() => { //replace arrow function with regular function to see that errors will be gone // comment next line or remove "()" to see that errors will be gone if(!a.b()) { return 'special'; } return 'default'; } : () => "special" | "default" + + // comment next line or remove "()" to see that errors will be gone + if(!a.b()) { return 'special'; } +>!a.b() : boolean +>a.b() : any +>a.b : any +>a : any +>b : any +>'special' : "special" + + return 'default'; +>'default' : "default" + } +}); + diff --git a/tests/baselines/reference/arrowFunctionParsingGenericInObject.js b/tests/baselines/reference/arrowFunctionParsingGenericInObject.js new file mode 100644 index 00000000000..9c8d515d860 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionParsingGenericInObject.js @@ -0,0 +1,75 @@ +//// [arrowFunctionParsingGenericInObject.ts] +const fn1 = () => ({ + test: (value: T): T => value, + extraValue: () => {}, +}) + +const fn1async = () => ({ + test: async (value: T): Promise => value, + extraValue: () => {}, +}) + +const fn2 = () => ({ + test: (value: T): T => value, + extraValue: () => {}, +}) + +const fn2async = () => ({ + test: async (value: T): Promise => value, + extraValue: () => {}, +}) + +const fn3 = () => ({ + extraValue: () => {}, + test: (value: T): T => value, +}) + +const fn3async = () => ({ + extraValue: () => {}, + test: async (value: T): Promise => value, +}) + +const fn4 = () => ({ + extraValue: '', + test: (value: T): T => value, +}) + +const fn4async = () => ({ + extraValue: '', + test: async (value: T): Promise => value, +}) + + +//// [arrowFunctionParsingGenericInObject.js] +const fn1 = () => ({ + test: (value) => value, + extraValue: () => { }, +}); +const fn1async = () => ({ + test: async (value) => value, + extraValue: () => { }, +}); +const fn2 = () => ({ + test: (value) => value, + extraValue: () => { }, +}); +const fn2async = () => ({ + test: async (value) => value, + extraValue: () => { }, +}); +const fn3 = () => ({ + extraValue: () => { }, + test: (value) => value, +}); +const fn3async = () => ({ + extraValue: () => { }, + test: async (value) => value, +}); +const fn4 = () => ({ + extraValue: '', + test: (value) => value, +}); +const fn4async = () => ({ + extraValue: '', + test: async (value) => value, +}); diff --git a/tests/baselines/reference/arrowFunctionParsingGenericInObject.symbols b/tests/baselines/reference/arrowFunctionParsingGenericInObject.symbols new file mode 100644 index 00000000000..38df0d50b28 --- /dev/null +++ b/tests/baselines/reference/arrowFunctionParsingGenericInObject.symbols @@ -0,0 +1,133 @@ +=== tests/cases/compiler/arrowFunctionParsingGenericInObject.ts === +const fn1 = () => ({ +>fn1 : Symbol(fn1, Decl(arrowFunctionParsingGenericInObject.ts, 0, 5)) + + test: (value: T): T => value, +>test : Symbol(test, Decl(arrowFunctionParsingGenericInObject.ts, 0, 20)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 1, 11)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 1, 26)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 1, 11)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 1, 11)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 1, 26)) + + extraValue: () => {}, +>extraValue : Symbol(extraValue, Decl(arrowFunctionParsingGenericInObject.ts, 1, 48)) + +}) + +const fn1async = () => ({ +>fn1async : Symbol(fn1async, Decl(arrowFunctionParsingGenericInObject.ts, 5, 5)) + + test: async (value: T): Promise => value, +>test : Symbol(test, Decl(arrowFunctionParsingGenericInObject.ts, 5, 25)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 6, 17)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 6, 32)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 6, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 6, 17)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 6, 32)) + + extraValue: () => {}, +>extraValue : Symbol(extraValue, Decl(arrowFunctionParsingGenericInObject.ts, 6, 63)) + +}) + +const fn2 = () => ({ +>fn2 : Symbol(fn2, Decl(arrowFunctionParsingGenericInObject.ts, 10, 5)) + + test: (value: T): T => value, +>test : Symbol(test, Decl(arrowFunctionParsingGenericInObject.ts, 10, 20)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 11, 11)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 11, 14)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 11, 11)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 11, 11)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 11, 14)) + + extraValue: () => {}, +>extraValue : Symbol(extraValue, Decl(arrowFunctionParsingGenericInObject.ts, 11, 36)) + +}) + +const fn2async = () => ({ +>fn2async : Symbol(fn2async, Decl(arrowFunctionParsingGenericInObject.ts, 15, 5)) + + test: async (value: T): Promise => value, +>test : Symbol(test, Decl(arrowFunctionParsingGenericInObject.ts, 15, 25)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 16, 17)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 16, 20)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 16, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 16, 17)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 16, 20)) + + extraValue: () => {}, +>extraValue : Symbol(extraValue, Decl(arrowFunctionParsingGenericInObject.ts, 16, 51)) + +}) + +const fn3 = () => ({ +>fn3 : Symbol(fn3, Decl(arrowFunctionParsingGenericInObject.ts, 20, 5)) + + extraValue: () => {}, +>extraValue : Symbol(extraValue, Decl(arrowFunctionParsingGenericInObject.ts, 20, 20)) + + test: (value: T): T => value, +>test : Symbol(test, Decl(arrowFunctionParsingGenericInObject.ts, 21, 25)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 22, 11)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 22, 26)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 22, 11)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 22, 11)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 22, 26)) + +}) + +const fn3async = () => ({ +>fn3async : Symbol(fn3async, Decl(arrowFunctionParsingGenericInObject.ts, 25, 5)) + + extraValue: () => {}, +>extraValue : Symbol(extraValue, Decl(arrowFunctionParsingGenericInObject.ts, 25, 25)) + + test: async (value: T): Promise => value, +>test : Symbol(test, Decl(arrowFunctionParsingGenericInObject.ts, 26, 25)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 27, 17)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 27, 32)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 27, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 27, 17)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 27, 32)) + +}) + +const fn4 = () => ({ +>fn4 : Symbol(fn4, Decl(arrowFunctionParsingGenericInObject.ts, 30, 5)) + + extraValue: '', +>extraValue : Symbol(extraValue, Decl(arrowFunctionParsingGenericInObject.ts, 30, 20)) + + test: (value: T): T => value, +>test : Symbol(test, Decl(arrowFunctionParsingGenericInObject.ts, 31, 19)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 32, 11)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 32, 26)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 32, 11)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 32, 11)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 32, 26)) + +}) + +const fn4async = () => ({ +>fn4async : Symbol(fn4async, Decl(arrowFunctionParsingGenericInObject.ts, 35, 5)) + + extraValue: '', +>extraValue : Symbol(extraValue, Decl(arrowFunctionParsingGenericInObject.ts, 35, 25)) + + test: async (value: T): Promise => value, +>test : Symbol(test, Decl(arrowFunctionParsingGenericInObject.ts, 36, 19)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 37, 17)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 37, 32)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 37, 17)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --)) +>T : Symbol(T, Decl(arrowFunctionParsingGenericInObject.ts, 37, 17)) +>value : Symbol(value, Decl(arrowFunctionParsingGenericInObject.ts, 37, 32)) + +}) + diff --git a/tests/baselines/reference/arrowFunctionParsingGenericInObject.types b/tests/baselines/reference/arrowFunctionParsingGenericInObject.types new file mode 100644 index 00000000000..e8017bbf69e --- /dev/null +++ b/tests/baselines/reference/arrowFunctionParsingGenericInObject.types @@ -0,0 +1,145 @@ +=== tests/cases/compiler/arrowFunctionParsingGenericInObject.ts === +const fn1 = () => ({ +>fn1 : () => { test: (value: T) => T; extraValue: () => void; } +>() => ({ test: (value: T): T => value, extraValue: () => {},}) : () => { test: (value: T) => T; extraValue: () => void; } +>({ test: (value: T): T => value, extraValue: () => {},}) : { test: (value: T) => T; extraValue: () => void; } +>{ test: (value: T): T => value, extraValue: () => {},} : { test: (value: T) => T; extraValue: () => void; } + + test: (value: T): T => value, +>test : (value: T) => T +>(value: T): T => value : (value: T) => T +>value : T +>value : T + + extraValue: () => {}, +>extraValue : () => void +>() => {} : () => void + +}) + +const fn1async = () => ({ +>fn1async : () => { test: (value: T) => Promise; extraValue: () => void; } +>() => ({ test: async (value: T): Promise => value, extraValue: () => {},}) : () => { test: (value: T) => Promise; extraValue: () => void; } +>({ test: async (value: T): Promise => value, extraValue: () => {},}) : { test: (value: T) => Promise; extraValue: () => void; } +>{ test: async (value: T): Promise => value, extraValue: () => {},} : { test: (value: T) => Promise; extraValue: () => void; } + + test: async (value: T): Promise => value, +>test : (value: T) => Promise +>async (value: T): Promise => value : (value: T) => Promise +>value : T +>value : T + + extraValue: () => {}, +>extraValue : () => void +>() => {} : () => void + +}) + +const fn2 = () => ({ +>fn2 : () => { test: (value: T) => T; extraValue: () => void; } +>() => ({ test: (value: T): T => value, extraValue: () => {},}) : () => { test: (value: T) => T; extraValue: () => void; } +>({ test: (value: T): T => value, extraValue: () => {},}) : { test: (value: T) => T; extraValue: () => void; } +>{ test: (value: T): T => value, extraValue: () => {},} : { test: (value: T) => T; extraValue: () => void; } + + test: (value: T): T => value, +>test : (value: T) => T +>(value: T): T => value : (value: T) => T +>value : T +>value : T + + extraValue: () => {}, +>extraValue : () => void +>() => {} : () => void + +}) + +const fn2async = () => ({ +>fn2async : () => { test: (value: T) => Promise; extraValue: () => void; } +>() => ({ test: async (value: T): Promise => value, extraValue: () => {},}) : () => { test: (value: T) => Promise; extraValue: () => void; } +>({ test: async (value: T): Promise => value, extraValue: () => {},}) : { test: (value: T) => Promise; extraValue: () => void; } +>{ test: async (value: T): Promise => value, extraValue: () => {},} : { test: (value: T) => Promise; extraValue: () => void; } + + test: async (value: T): Promise => value, +>test : (value: T) => Promise +>async (value: T): Promise => value : (value: T) => Promise +>value : T +>value : T + + extraValue: () => {}, +>extraValue : () => void +>() => {} : () => void + +}) + +const fn3 = () => ({ +>fn3 : () => { extraValue: () => void; test: (value: T) => T; } +>() => ({ extraValue: () => {}, test: (value: T): T => value,}) : () => { extraValue: () => void; test: (value: T) => T; } +>({ extraValue: () => {}, test: (value: T): T => value,}) : { extraValue: () => void; test: (value: T) => T; } +>{ extraValue: () => {}, test: (value: T): T => value,} : { extraValue: () => void; test: (value: T) => T; } + + extraValue: () => {}, +>extraValue : () => void +>() => {} : () => void + + test: (value: T): T => value, +>test : (value: T) => T +>(value: T): T => value : (value: T) => T +>value : T +>value : T + +}) + +const fn3async = () => ({ +>fn3async : () => { extraValue: () => void; test: (value: T) => Promise; } +>() => ({ extraValue: () => {}, test: async (value: T): Promise => value,}) : () => { extraValue: () => void; test: (value: T) => Promise; } +>({ extraValue: () => {}, test: async (value: T): Promise => value,}) : { extraValue: () => void; test: (value: T) => Promise; } +>{ extraValue: () => {}, test: async (value: T): Promise => value,} : { extraValue: () => void; test: (value: T) => Promise; } + + extraValue: () => {}, +>extraValue : () => void +>() => {} : () => void + + test: async (value: T): Promise => value, +>test : (value: T) => Promise +>async (value: T): Promise => value : (value: T) => Promise +>value : T +>value : T + +}) + +const fn4 = () => ({ +>fn4 : () => { extraValue: string; test: (value: T) => T; } +>() => ({ extraValue: '', test: (value: T): T => value,}) : () => { extraValue: string; test: (value: T) => T; } +>({ extraValue: '', test: (value: T): T => value,}) : { extraValue: string; test: (value: T) => T; } +>{ extraValue: '', test: (value: T): T => value,} : { extraValue: string; test: (value: T) => T; } + + extraValue: '', +>extraValue : string +>'' : "" + + test: (value: T): T => value, +>test : (value: T) => T +>(value: T): T => value : (value: T) => T +>value : T +>value : T + +}) + +const fn4async = () => ({ +>fn4async : () => { extraValue: string; test: (value: T) => Promise; } +>() => ({ extraValue: '', test: async (value: T): Promise => value,}) : () => { extraValue: string; test: (value: T) => Promise; } +>({ extraValue: '', test: async (value: T): Promise => value,}) : { extraValue: string; test: (value: T) => Promise; } +>{ extraValue: '', test: async (value: T): Promise => value,} : { extraValue: string; test: (value: T) => Promise; } + + extraValue: '', +>extraValue : string +>'' : "" + + test: async (value: T): Promise => value, +>test : (value: T) => Promise +>async (value: T): Promise => value : (value: T) => Promise +>value : T +>value : T + +}) + diff --git a/tests/cases/compiler/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts b/tests/cases/compiler/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts new file mode 100644 index 00000000000..0584dc586a5 --- /dev/null +++ b/tests/cases/compiler/arrowFunctionParsingDoesNotConfuseParenthesizedObjectForArrowHead.ts @@ -0,0 +1,14 @@ +// regression test for https://github.com/microsoft/TypeScript/issues/32914 +declare var value: boolean; +declare var a: any; + +const test = () => ({ + // "Identifier expected." error on "!" and two "Duplicate identifier '(Missing)'." errors on space. + prop: !value, // remove ! to see that errors will be gone + run: () => { //replace arrow function with regular function to see that errors will be gone + // comment next line or remove "()" to see that errors will be gone + if(!a.b()) { return 'special'; } + + return 'default'; + } +}); diff --git a/tests/cases/compiler/arrowFunctionParsingGenericInObject.ts b/tests/cases/compiler/arrowFunctionParsingGenericInObject.ts new file mode 100644 index 00000000000..539f9fa64af --- /dev/null +++ b/tests/cases/compiler/arrowFunctionParsingGenericInObject.ts @@ -0,0 +1,40 @@ +// @target: esnext +const fn1 = () => ({ + test: (value: T): T => value, + extraValue: () => {}, +}) + +const fn1async = () => ({ + test: async (value: T): Promise => value, + extraValue: () => {}, +}) + +const fn2 = () => ({ + test: (value: T): T => value, + extraValue: () => {}, +}) + +const fn2async = () => ({ + test: async (value: T): Promise => value, + extraValue: () => {}, +}) + +const fn3 = () => ({ + extraValue: () => {}, + test: (value: T): T => value, +}) + +const fn3async = () => ({ + extraValue: () => {}, + test: async (value: T): Promise => value, +}) + +const fn4 = () => ({ + extraValue: '', + test: (value: T): T => value, +}) + +const fn4async = () => ({ + extraValue: '', + test: async (value: T): Promise => value, +}) From 25aecd4c3eb645553445657abc2533f2c929e3ed Mon Sep 17 00:00:00 2001 From: Minh Quy Date: Tue, 5 Apr 2022 02:57:34 +0200 Subject: [PATCH 21/41] fix(48109) - 'Convert to arrow function' refactoring adds extra indent (#48440) * fix(48109) - Remove extra indent when converting to arrow function * fix(48109) - Only treat curly brace in object literal as block * Apply suggestions from code review Co-authored-by: Daniel Rosenwasser --- src/services/formatting/smartIndenter.ts | 13 +++++---- ...nOrFunctionExpression_ToAnon_FnArgument.ts | 4 +-- ...rFunctionExpression_ToArrow_FnArgIndent.ts | 19 +++++++++++++ ...nExpression_ToArrow_FunctionFnArgIndent.ts | 28 +++++++++++++++++++ 4 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FnArgIndent.ts create mode 100644 tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FunctionFnArgIndent.ts diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index fc65d3581bd..78b8a95890e 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -56,9 +56,9 @@ namespace ts.formatting { // for block indentation, we should look for a line which contains something that's not // whitespace. const currentToken = getTokenAtPosition(sourceFile, position); - // for object literal, we want to the indentation work like block - // if { starts in any position (can be in the middle of line) - // the following indentation should treat { as starting of that line (including leading whitespace) + // For object literals, we want indentation to work just like with blocks. + // If the `{` starts in any position (even in the middle of a line), then + // the following indentation should treat `{` as the start of that line (including leading whitespace). // ``` // const a: { x: undefined, y: undefined } = {} // leading 4 whitespaces and { starts in the middle of line // -> @@ -76,7 +76,8 @@ namespace ts.formatting { // y: undefined, // } // ``` - if (options.indentStyle === IndentStyle.Block || currentToken.kind === SyntaxKind.OpenBraceToken) { + const isObjectLiteral = currentToken.kind === SyntaxKind.OpenBraceToken && currentToken.parent.kind === SyntaxKind.ObjectLiteralExpression; + if (options.indentStyle === IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } @@ -91,7 +92,9 @@ namespace ts.formatting { const containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !rangeContainsRange(containerList, precedingToken)) { - return getActualIndentationForListStartLine(containerList, sourceFile, options) + options.indentSize!; // TODO: GH#18217 + const useTheSameBaseIndentation = [SyntaxKind.FunctionExpression, SyntaxKind.ArrowFunction].indexOf(currentToken.parent.kind) !== -1; + const indentSize = useTheSameBaseIndentation ? 0 : options.indentSize!; + return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } return getSmartIndent(sourceFile, position, precedingToken, lineAtPosition, assumeNewLineBeforeCloseBrace, options); diff --git a/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToAnon_FnArgument.ts b/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToAnon_FnArgument.ts index c07a741f1ab..28ad1354991 100644 --- a/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToAnon_FnArgument.ts +++ b/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToAnon_FnArgument.ts @@ -10,6 +10,6 @@ edit.applyRefactor({ actionDescription: "Convert to anonymous function", newContent: `function doSomething(a){} doSomething(function() { - return 1 + 1; - });`, + return 1 + 1; +});`, }); diff --git a/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FnArgIndent.ts b/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FnArgIndent.ts new file mode 100644 index 00000000000..3c9fe02b6a2 --- /dev/null +++ b/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FnArgIndent.ts @@ -0,0 +1,19 @@ +/// + +////console.log(function /*a*/()/*b*/ { +//// console.log(1); +//// console.log(2); +//// return 3; +////}) + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Convert arrow function or function expression", + actionName: "Convert to arrow function", + actionDescription: "Convert to arrow function", + newContent: `console.log(() => { + console.log(1); + console.log(2); + return 3; +})`, +}); diff --git a/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FunctionFnArgIndent.ts b/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FunctionFnArgIndent.ts new file mode 100644 index 00000000000..3108527c7d7 --- /dev/null +++ b/tests/cases/fourslash/refactorConvertArrowFunctionOrFunctionExpression_ToArrow_FunctionFnArgIndent.ts @@ -0,0 +1,28 @@ +/// + +////function foo() { +//// const a = { +//// b: builder.create(function /*a*/()/*b*/ { +//// console.log(1); +//// console.log(2); +//// return 3; +//// }) +//// } +////} + + +goTo.select("a", "b"); +edit.applyRefactor({ + refactorName: "Convert arrow function or function expression", + actionName: "Convert to arrow function", + actionDescription: "Convert to arrow function", + newContent: `function foo() { + const a = { + b: builder.create(() => { + console.log(1); + console.log(2); + return 3; + }) + } +}`, +}); From 370d34cdca7e3ab1d64ccea82040d9292fadbdda Mon Sep 17 00:00:00 2001 From: Zzzen Date: Wed, 6 Apr 2022 00:33:19 +0800 Subject: [PATCH 22/41] narrow type for generic variables inside TypeQuery (#48434) --- src/compiler/checker.ts | 1 + .../narrowingOfQualifiedNames.errors.txt | 21 ++++++ .../reference/narrowingOfQualifiedNames.js | 33 +++++++++ .../narrowingOfQualifiedNames.symbols | 73 +++++++++++++++++++ .../reference/narrowingOfQualifiedNames.types | 73 +++++++++++++++++++ .../compiler/narrowingOfQualifiedNames.ts | 21 ++++++ 6 files changed, 222 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7e144dd26f3..a93ca5297bb 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -25311,6 +25311,7 @@ namespace ts { // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. return parent.kind === SyntaxKind.PropertyAccessExpression || + parent.kind === SyntaxKind.QualifiedName || parent.kind === SyntaxKind.CallExpression && (parent as CallExpression).expression === node || parent.kind === SyntaxKind.ElementAccessExpression && (parent as ElementAccessExpression).expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression((parent as ElementAccessExpression).argumentExpression))); diff --git a/tests/baselines/reference/narrowingOfQualifiedNames.errors.txt b/tests/baselines/reference/narrowingOfQualifiedNames.errors.txt index 588ee1d5da1..80551ebc33d 100644 --- a/tests/baselines/reference/narrowingOfQualifiedNames.errors.txt +++ b/tests/baselines/reference/narrowingOfQualifiedNames.errors.txt @@ -71,4 +71,25 @@ tests/cases/compiler/narrowingOfQualifiedNames.ts(38,29): error TS2532: Object i } } } + } + + // Repro from #48289 + + type Fish = { type: 'fish', hasFins: true } + type Dog = { type: 'dog', saysWoof: true } + + type Pet = Fish | Dog; + + function handleDogBroken(pet: PetType) { + if(pet.type === 'dog') { + const _okay1 = pet.saysWoof; + const _okay2: typeof pet.saysWoof = pet.saysWoof; + } + } + + function handleDogWorking(pet: Pet) { + if(pet.type === 'dog') { + const _okay1 = pet.saysWoof; + const _okay2: typeof pet.saysWoof = pet.saysWoof; + } } \ No newline at end of file diff --git a/tests/baselines/reference/narrowingOfQualifiedNames.js b/tests/baselines/reference/narrowingOfQualifiedNames.js index e3d2816849e..c6ce04dba5c 100644 --- a/tests/baselines/reference/narrowingOfQualifiedNames.js +++ b/tests/baselines/reference/narrowingOfQualifiedNames.js @@ -63,6 +63,27 @@ function init2(foo: DeepOptional) { } } } +} + +// Repro from #48289 + +type Fish = { type: 'fish', hasFins: true } +type Dog = { type: 'dog', saysWoof: true } + +type Pet = Fish | Dog; + +function handleDogBroken(pet: PetType) { + if(pet.type === 'dog') { + const _okay1 = pet.saysWoof; + const _okay2: typeof pet.saysWoof = pet.saysWoof; + } +} + +function handleDogWorking(pet: Pet) { + if(pet.type === 'dog') { + const _okay1 = pet.saysWoof; + const _okay2: typeof pet.saysWoof = pet.saysWoof; + } } //// [narrowingOfQualifiedNames.js] @@ -94,3 +115,15 @@ function init2(foo) { } } } +function handleDogBroken(pet) { + if (pet.type === 'dog') { + var _okay1 = pet.saysWoof; + var _okay2 = pet.saysWoof; + } +} +function handleDogWorking(pet) { + if (pet.type === 'dog') { + var _okay1 = pet.saysWoof; + var _okay2 = pet.saysWoof; + } +} diff --git a/tests/baselines/reference/narrowingOfQualifiedNames.symbols b/tests/baselines/reference/narrowingOfQualifiedNames.symbols index f7a4e26d713..1c2a585c585 100644 --- a/tests/baselines/reference/narrowingOfQualifiedNames.symbols +++ b/tests/baselines/reference/narrowingOfQualifiedNames.symbols @@ -253,3 +253,76 @@ function init2(foo: DeepOptional) { } } } + +// Repro from #48289 + +type Fish = { type: 'fish', hasFins: true } +>Fish : Symbol(Fish, Decl(narrowingOfQualifiedNames.ts, 64, 1)) +>type : Symbol(type, Decl(narrowingOfQualifiedNames.ts, 68, 13)) +>hasFins : Symbol(hasFins, Decl(narrowingOfQualifiedNames.ts, 68, 27)) + +type Dog = { type: 'dog', saysWoof: true } +>Dog : Symbol(Dog, Decl(narrowingOfQualifiedNames.ts, 68, 43)) +>type : Symbol(type, Decl(narrowingOfQualifiedNames.ts, 69, 12)) +>saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) + +type Pet = Fish | Dog; +>Pet : Symbol(Pet, Decl(narrowingOfQualifiedNames.ts, 69, 42)) +>Fish : Symbol(Fish, Decl(narrowingOfQualifiedNames.ts, 64, 1)) +>Dog : Symbol(Dog, Decl(narrowingOfQualifiedNames.ts, 68, 43)) + +function handleDogBroken(pet: PetType) { +>handleDogBroken : Symbol(handleDogBroken, Decl(narrowingOfQualifiedNames.ts, 71, 22)) +>PetType : Symbol(PetType, Decl(narrowingOfQualifiedNames.ts, 73, 25)) +>Pet : Symbol(Pet, Decl(narrowingOfQualifiedNames.ts, 69, 42)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 73, 46)) +>PetType : Symbol(PetType, Decl(narrowingOfQualifiedNames.ts, 73, 25)) + + if(pet.type === 'dog') { +>pet.type : Symbol(type, Decl(narrowingOfQualifiedNames.ts, 68, 13), Decl(narrowingOfQualifiedNames.ts, 69, 12)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 73, 46)) +>type : Symbol(type, Decl(narrowingOfQualifiedNames.ts, 68, 13), Decl(narrowingOfQualifiedNames.ts, 69, 12)) + + const _okay1 = pet.saysWoof; +>_okay1 : Symbol(_okay1, Decl(narrowingOfQualifiedNames.ts, 75, 13)) +>pet.saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 73, 46)) +>saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) + + const _okay2: typeof pet.saysWoof = pet.saysWoof; +>_okay2 : Symbol(_okay2, Decl(narrowingOfQualifiedNames.ts, 76, 13)) +>pet.saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 73, 46)) +>saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) +>pet.saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 73, 46)) +>saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) + } +} + +function handleDogWorking(pet: Pet) { +>handleDogWorking : Symbol(handleDogWorking, Decl(narrowingOfQualifiedNames.ts, 78, 1)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 80, 26)) +>Pet : Symbol(Pet, Decl(narrowingOfQualifiedNames.ts, 69, 42)) + + if(pet.type === 'dog') { +>pet.type : Symbol(type, Decl(narrowingOfQualifiedNames.ts, 68, 13), Decl(narrowingOfQualifiedNames.ts, 69, 12)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 80, 26)) +>type : Symbol(type, Decl(narrowingOfQualifiedNames.ts, 68, 13), Decl(narrowingOfQualifiedNames.ts, 69, 12)) + + const _okay1 = pet.saysWoof; +>_okay1 : Symbol(_okay1, Decl(narrowingOfQualifiedNames.ts, 82, 13)) +>pet.saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 80, 26)) +>saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) + + const _okay2: typeof pet.saysWoof = pet.saysWoof; +>_okay2 : Symbol(_okay2, Decl(narrowingOfQualifiedNames.ts, 83, 13)) +>pet.saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 80, 26)) +>saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) +>pet.saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) +>pet : Symbol(pet, Decl(narrowingOfQualifiedNames.ts, 80, 26)) +>saysWoof : Symbol(saysWoof, Decl(narrowingOfQualifiedNames.ts, 69, 25)) + } +} diff --git a/tests/baselines/reference/narrowingOfQualifiedNames.types b/tests/baselines/reference/narrowingOfQualifiedNames.types index f9ec86f075a..59349ce8e18 100644 --- a/tests/baselines/reference/narrowingOfQualifiedNames.types +++ b/tests/baselines/reference/narrowingOfQualifiedNames.types @@ -257,3 +257,76 @@ function init2(foo: DeepOptional) { } } } + +// Repro from #48289 + +type Fish = { type: 'fish', hasFins: true } +>Fish : Fish +>type : "fish" +>hasFins : true +>true : true + +type Dog = { type: 'dog', saysWoof: true } +>Dog : Dog +>type : "dog" +>saysWoof : true +>true : true + +type Pet = Fish | Dog; +>Pet : Pet + +function handleDogBroken(pet: PetType) { +>handleDogBroken : (pet: PetType) => void +>pet : PetType + + if(pet.type === 'dog') { +>pet.type === 'dog' : boolean +>pet.type : "fish" | "dog" +>pet : Pet +>type : "fish" | "dog" +>'dog' : "dog" + + const _okay1 = pet.saysWoof; +>_okay1 : true +>pet.saysWoof : true +>pet : Dog +>saysWoof : true + + const _okay2: typeof pet.saysWoof = pet.saysWoof; +>_okay2 : true +>pet.saysWoof : true +>pet : Dog +>saysWoof : true +>pet.saysWoof : true +>pet : Dog +>saysWoof : true + } +} + +function handleDogWorking(pet: Pet) { +>handleDogWorking : (pet: Pet) => void +>pet : Pet + + if(pet.type === 'dog') { +>pet.type === 'dog' : boolean +>pet.type : "fish" | "dog" +>pet : Pet +>type : "fish" | "dog" +>'dog' : "dog" + + const _okay1 = pet.saysWoof; +>_okay1 : true +>pet.saysWoof : true +>pet : Dog +>saysWoof : true + + const _okay2: typeof pet.saysWoof = pet.saysWoof; +>_okay2 : true +>pet.saysWoof : true +>pet : Dog +>saysWoof : true +>pet.saysWoof : true +>pet : Dog +>saysWoof : true + } +} diff --git a/tests/cases/compiler/narrowingOfQualifiedNames.ts b/tests/cases/compiler/narrowingOfQualifiedNames.ts index 45dcf5e55c0..e74da83c954 100644 --- a/tests/cases/compiler/narrowingOfQualifiedNames.ts +++ b/tests/cases/compiler/narrowingOfQualifiedNames.ts @@ -64,4 +64,25 @@ function init2(foo: DeepOptional) { } } } +} + +// Repro from #48289 + +type Fish = { type: 'fish', hasFins: true } +type Dog = { type: 'dog', saysWoof: true } + +type Pet = Fish | Dog; + +function handleDogBroken(pet: PetType) { + if(pet.type === 'dog') { + const _okay1 = pet.saysWoof; + const _okay2: typeof pet.saysWoof = pet.saysWoof; + } +} + +function handleDogWorking(pet: Pet) { + if(pet.type === 'dog') { + const _okay1 = pet.saysWoof; + const _okay2: typeof pet.saysWoof = pet.saysWoof; + } } \ No newline at end of file From f654f18d861f96097515c849044df637a328419e Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 5 Apr 2022 13:00:37 -0400 Subject: [PATCH 23/41] fix: ensure ts source file with no-default-lib that augments the global scope gets emitted with incremental program (#48412) * fix: do not classify non-declaration files as default library source files * Add test. --- src/compiler/program.ts | 4 + src/testRunner/unittests/tsc/incremental.ts | 31 +++++++ ...ault-lib-that-augments-the-global-scope.js | 93 +++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 tests/baselines/reference/tsc/incremental/initial-build/ts-file-with-no-default-lib-that-augments-the-global-scope.js diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 2c9f07fe0bb..021c34ce3a7 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1958,6 +1958,10 @@ namespace ts { } function isSourceFileDefaultLibrary(file: SourceFile): boolean { + if (!file.isDeclarationFile) { + return false; + } + if (file.hasNoDefaultLib) { return true; } diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index 13a644a6208..2085038fd80 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -449,5 +449,36 @@ declare global { }, `\ninterface ReadonlyArray { readonly length: number }`), incrementalScenarios: noChangeOnlyRuns, }); + + verifyTsc({ + scenario: "incremental", + subScenario: "ts file with no-default-lib that augments the global scope", + fs: () => loadProjectFromFiles({ + "/src/project/src/main.ts": Utils.dedent` + /// + /// + + declare global { + interface Test { + } + } + + export {}; + `, + "/src/project/tsconfig.json": Utils.dedent` + { + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "incremental": true, + "outDir": "dist", + }, + }`, + }), + commandLineArgs: ["--p", "src/project", "--rootDir", "src/project/src"], + modifyFs: (fs) => { + fs.writeFileSync("/lib/lib.esnext.d.ts", libContent); + } + }); }); } diff --git a/tests/baselines/reference/tsc/incremental/initial-build/ts-file-with-no-default-lib-that-augments-the-global-scope.js b/tests/baselines/reference/tsc/incremental/initial-build/ts-file-with-no-default-lib-that-augments-the-global-scope.js new file mode 100644 index 00000000000..0ae751e9f56 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/initial-build/ts-file-with-no-default-lib-that-augments-the-global-scope.js @@ -0,0 +1,93 @@ +Input:: +//// [/lib/lib.d.ts] + + +//// [/lib/lib.esnext.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +declare const console: { log(msg: any): void; }; + +//// [/src/project/src/main.ts] +/// +/// + +declare global { + interface Test { + } +} + +export {}; + + +//// [/src/project/tsconfig.json] +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "incremental": true, + "outDir": "dist", + }, +} + + + +Output:: +/lib/tsc --p src/project --rootDir src/project/src +exitCode:: ExitStatus.Success + + +//// [/src/project/dist/main.js] +/// +/// +export {}; + + +//// [/src/project/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../lib/lib.esnext.d.ts","./src/main.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"-2443389309-/// \n/// \n\ndeclare global {\n interface Test {\n }\n}\n\nexport {};\n","affectsGlobalScope":true}],"options":{"module":99,"outDir":"./dist","rootDir":"./src","target":99},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2]},"version":"FakeTSVersion"} + +//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../lib/lib.esnext.d.ts", + "./src/main.ts" + ], + "fileInfos": { + "../../lib/lib.esnext.d.ts": { + "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true + }, + "./src/main.ts": { + "version": "-2443389309-/// \n/// \n\ndeclare global {\n interface Test {\n }\n}\n\nexport {};\n", + "signature": "-2443389309-/// \n/// \n\ndeclare global {\n interface Test {\n }\n}\n\nexport {};\n", + "affectsGlobalScope": true + } + }, + "options": { + "module": 99, + "outDir": "./dist", + "rootDir": "./src", + "target": 99 + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.esnext.d.ts", + "./src/main.ts" + ] + }, + "version": "FakeTSVersion", + "size": 935 +} + From 6e0447fdf165b1cec9fc80802abcc15bd23a268f Mon Sep 17 00:00:00 2001 From: Minh Quy Date: Tue, 5 Apr 2022 20:53:19 +0200 Subject: [PATCH 24/41] [Feature] - Automatically create sort groups based on newlines (#48330) Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com> --- src/services/organizeImports.ts | 51 +++++++++++++++++-- .../unittests/services/organizeImports.ts | 17 ------- .../reference/organizeImports/SortComments.ts | 17 ------- .../TopLevelAndAmbientModule.ts | 2 +- tests/cases/fourslash/organizeImports6.ts | 10 +++- .../organizeImportsGroup_CommentInNewline.ts | 21 ++++++++ .../organizeImportsGroup_MultiNewlines.ts | 21 ++++++++ ...eImportsGroup_MultilineCommentInNewline.ts | 25 +++++++++ .../fourslash/organizeImportsGroup_Newline.ts | 19 +++++++ 9 files changed, 141 insertions(+), 42 deletions(-) delete mode 100644 tests/baselines/reference/organizeImports/SortComments.ts create mode 100644 tests/cases/fourslash/organizeImportsGroup_CommentInNewline.ts create mode 100644 tests/cases/fourslash/organizeImportsGroup_MultiNewlines.ts create mode 100644 tests/cases/fourslash/organizeImportsGroup_MultilineCommentInNewline.ts create mode 100644 tests/cases/fourslash/organizeImportsGroup_Newline.ts diff --git a/src/services/organizeImports.ts b/src/services/organizeImports.ts index d01f2eae5f6..7533a548933 100644 --- a/src/services/organizeImports.ts +++ b/src/services/organizeImports.ts @@ -15,7 +15,6 @@ namespace ts.OrganizeImports { preferences: UserPreferences, skipDestructiveCodeActions?: boolean ) { - const changeTracker = textChanges.ChangeTracker.fromContext({ host, formatContext, preferences }); const coalesceAndOrganizeImports = (importGroup: readonly ImportDeclaration[]) => stableSort( @@ -23,8 +22,8 @@ namespace ts.OrganizeImports { (s1, s2) => compareImportsOrRequireStatements(s1, s2)); // All of the old ImportDeclarations in the file, in syntactic order. - const topLevelImportDecls = sourceFile.statements.filter(isImportDeclaration); - organizeImportsWorker(topLevelImportDecls, coalesceAndOrganizeImports); + const topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)); + topLevelImportGroupDecls.forEach(importGroupDecl => organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports)); // All of the old ExportDeclarations in the file, in syntactic order. const topLevelExportDecls = sourceFile.statements.filter(isExportDeclaration); @@ -33,8 +32,8 @@ namespace ts.OrganizeImports { for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) { if (!ambientModule.body) continue; - const ambientModuleImportDecls = ambientModule.body.statements.filter(isImportDeclaration); - organizeImportsWorker(ambientModuleImportDecls, coalesceAndOrganizeImports); + const ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration)); + ambientModuleImportGroupDecls.forEach(importGroupDecl => organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports)); const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration); organizeImportsWorker(ambientModuleExportDecls, coalesceExports); @@ -88,6 +87,48 @@ namespace ts.OrganizeImports { } } + function groupImportsByNewlineContiguous(sourceFile: SourceFile, importDecls: ImportDeclaration[]): ImportDeclaration[][] { + const scanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/ false, sourceFile.languageVariant); + const groupImports: ImportDeclaration[][] = []; + let groupIndex = 0; + for (const topLevelImportDecl of importDecls) { + if (isNewGroup(sourceFile, topLevelImportDecl, scanner)) { + groupIndex++; + } + + if (!groupImports[groupIndex]) { + groupImports[groupIndex] = []; + } + + groupImports[groupIndex].push(topLevelImportDecl); + } + + return groupImports; + } + + // a new group is created if an import includes at least two new line + // new line from multi-line comment doesn't count + function isNewGroup(sourceFile: SourceFile, topLevelImportDecl: ImportDeclaration, scanner: Scanner) { + const startPos = topLevelImportDecl.getFullStart(); + const endPos = topLevelImportDecl.getStart(); + scanner.setText(sourceFile.text, startPos, endPos - startPos); + + let numberOfNewLines = 0; + while (scanner.getTokenPos() < endPos) { + const tokenKind = scanner.scan(); + + if (tokenKind === SyntaxKind.NewLineTrivia) { + numberOfNewLines++; + + if (numberOfNewLines >= 2) { + return true; + } + } + } + + return false; + } + function removeUnusedImports(oldImports: readonly ImportDeclaration[], sourceFile: SourceFile, program: Program, skipDestructiveCodeActions: boolean | undefined) { // As a precaution, consider unused import detection to be destructive (GH #43051) if (skipDestructiveCodeActions) { diff --git a/src/testRunner/unittests/services/organizeImports.ts b/src/testRunner/unittests/services/organizeImports.ts index f3b222bb767..4ddd1b608d0 100644 --- a/src/testRunner/unittests/services/organizeImports.ts +++ b/src/testRunner/unittests/services/organizeImports.ts @@ -679,23 +679,6 @@ import "lib1"; { path: "/lib1.ts", content: "" }, { path: "/lib2.ts", content: "" }); - testOrganizeImports("SortComments", - /*skipDestructiveCodeActions*/ false, - { - path: "/test.ts", - content: ` -// Header -import "lib3"; -// Comment2 -import "lib2"; -// Comment1 -import "lib1"; -`, - }, - { path: "/lib1.ts", content: "" }, - { path: "/lib2.ts", content: "" }, - { path: "/lib3.ts", content: "" }); - testOrganizeImports("AmbientModule", /*skipDestructiveCodeActions*/ false, { diff --git a/tests/baselines/reference/organizeImports/SortComments.ts b/tests/baselines/reference/organizeImports/SortComments.ts deleted file mode 100644 index 761bca1a212..00000000000 --- a/tests/baselines/reference/organizeImports/SortComments.ts +++ /dev/null @@ -1,17 +0,0 @@ -// ==ORIGINAL== - -// Header -import "lib3"; -// Comment2 -import "lib2"; -// Comment1 -import "lib1"; - -// ==ORGANIZED== - -// Header -// Comment1 -import "lib1"; -// Comment2 -import "lib2"; -import "lib3"; diff --git a/tests/baselines/reference/organizeImports/TopLevelAndAmbientModule.ts b/tests/baselines/reference/organizeImports/TopLevelAndAmbientModule.ts index d6f3158efe8..8bbab4f4ff5 100644 --- a/tests/baselines/reference/organizeImports/TopLevelAndAmbientModule.ts +++ b/tests/baselines/reference/organizeImports/TopLevelAndAmbientModule.ts @@ -17,7 +17,6 @@ D(); // ==ORGANIZED== -import "lib"; import D from "lib"; declare module "mod" { @@ -26,5 +25,6 @@ declare module "mod" { function F(f1: {} = F1, f2: {} = F2) {} } +import "lib"; D(); diff --git a/tests/cases/fourslash/organizeImports6.ts b/tests/cases/fourslash/organizeImports6.ts index f5fa3b8269d..75e1491c1d1 100644 --- a/tests/cases/fourslash/organizeImports6.ts +++ b/tests/cases/fourslash/organizeImports6.ts @@ -16,6 +16,12 @@ //// anotherThing; verify.organizeImports( -`import * as anotherThing from "someopath"; /* small comment */ // single line one. +`/* some comment here +* and there +*/ +import * as anotherThing from "someopath"; /* small comment */ // single line one. +/* some comment here +* and there +*/ -anotherThing;`); \ No newline at end of file +anotherThing;`); diff --git a/tests/cases/fourslash/organizeImportsGroup_CommentInNewline.ts b/tests/cases/fourslash/organizeImportsGroup_CommentInNewline.ts new file mode 100644 index 00000000000..8a20bf185e9 --- /dev/null +++ b/tests/cases/fourslash/organizeImportsGroup_CommentInNewline.ts @@ -0,0 +1,21 @@ +/// + +////// polyfill +////import c from "C"; +////// not polyfill +////import d from "D"; +////import a from "A"; +////import b from "B"; +//// +////console.log(a, b, c, d) + +verify.organizeImports( +`// polyfill +import c from "C"; +// not polyfill +import a from "A"; +import b from "B"; +import d from "D"; + +console.log(a, b, c, d)` +); diff --git a/tests/cases/fourslash/organizeImportsGroup_MultiNewlines.ts b/tests/cases/fourslash/organizeImportsGroup_MultiNewlines.ts new file mode 100644 index 00000000000..cce8b8f603f --- /dev/null +++ b/tests/cases/fourslash/organizeImportsGroup_MultiNewlines.ts @@ -0,0 +1,21 @@ +/// + +////import c from "C"; +//// +//// +////import d from "D"; +////import a from "A"; +////import b from "B"; +//// +////console.log(a, b, c, d) + +verify.organizeImports( +`import c from "C"; + + +import a from "A"; +import b from "B"; +import d from "D"; + +console.log(a, b, c, d)` +); diff --git a/tests/cases/fourslash/organizeImportsGroup_MultilineCommentInNewline.ts b/tests/cases/fourslash/organizeImportsGroup_MultilineCommentInNewline.ts new file mode 100644 index 00000000000..04fff1675ac --- /dev/null +++ b/tests/cases/fourslash/organizeImportsGroup_MultilineCommentInNewline.ts @@ -0,0 +1,25 @@ +/// + +////// polyfill +////import c from "C"; +/////* +////* demo +////*/ +////import d from "D"; +////import a from "A"; +////import b from "B"; +//// +////console.log(a, b, c, d) + +verify.organizeImports( +`// polyfill +import c from "C"; +/* +* demo +*/ +import a from "A"; +import b from "B"; +import d from "D"; + +console.log(a, b, c, d)` +); diff --git a/tests/cases/fourslash/organizeImportsGroup_Newline.ts b/tests/cases/fourslash/organizeImportsGroup_Newline.ts new file mode 100644 index 00000000000..9f904ef3769 --- /dev/null +++ b/tests/cases/fourslash/organizeImportsGroup_Newline.ts @@ -0,0 +1,19 @@ +/// + +////import c from "C"; +//// +////import d from "D"; +////import a from "A"; // not count +////import b from "B"; +//// +////console.log(a, b, c, d) + +verify.organizeImports( +`import c from "C"; + +import a from "A"; // not count +import b from "B"; +import d from "D"; + +console.log(a, b, c, d)` +); From 7da80d79e2b9a320f98697e2bbe389d5e3485e56 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 5 Apr 2022 12:35:28 -0700 Subject: [PATCH 25/41] Add 'extends' clause to 'infer' type (#48112) * Add 'extends' clause to 'infer' type * Revise parse for infer..extends, improve parenthesizer * More aggressive parens to match existing DT tests * tests 'infer' constraint using outer type parameter * Adds a test showing 'infer' cannot reference other 'infer' in same 'extends' * Emit extends clause for synthetic infer typesduring declaration emit --- src/compiler/checker.ts | 41 +- src/compiler/diagnosticMessages.json | 4 + src/compiler/emitter.ts | 68 ++- src/compiler/factory/nodeFactory.ts | 64 ++- src/compiler/factory/parenthesizerRules.ts | 231 +++++++- src/compiler/parser.ts | 64 ++- src/compiler/types.ts | 52 +- src/services/textChanges.ts | 11 +- ...sions.parsesCorrectly.nonNullableType.json | 3 +- ...ions.parsesCorrectly.nonNullableType2.json | 3 +- ...ressions.parsesCorrectly.nullableType.json | 3 +- ...essions.parsesCorrectly.nullableType2.json | 3 +- .../reference/ambientConstLiterals.types | 6 +- .../reference/api/tsserverlibrary.d.ts | 21 +- tests/baselines/reference/api/typescript.d.ts | 21 +- .../bitwiseNotOperatorWithEnumType.types | 2 +- tests/baselines/reference/constEnums.types | 28 +- tests/baselines/reference/declFileEnums.types | 2 +- .../declarationEmitSpreadStringlyKeyedEnum.js | 14 +- ...clarationEmitSpreadStringlyKeyedEnum.types | 18 +- .../decrementOperatorWithEnumType.types | 2 +- ...peratorWithEnumTypeInvalidOperations.types | 2 +- .../deleteOperatorWithEnumType.types | 2 +- .../reference/doubleUnderscoreEnumEmit.types | 4 +- tests/baselines/reference/enumErrors.types | 6 +- .../reference/enumIdentifierLiterals.types | 10 +- .../enumWithNegativeInfinityProperty.types | 2 +- .../enumWithQuotedElementName1.types | 2 +- .../enumWithQuotedElementName2.types | 2 +- .../reference/enumWithUnicodeEscape1.types | 2 +- .../incrementOperatorWithEnumType.types | 2 +- ...peratorWithEnumTypeInvalidOperations.types | 2 +- .../reference/inferTypes1.errors.txt | 16 +- tests/baselines/reference/inferTypes1.js | 4 +- tests/baselines/reference/inferTypes1.symbols | 32 +- tests/baselines/reference/inferTypes1.types | 4 +- .../reference/inferTypesWithExtends1.js | 298 ++++++++++ .../reference/inferTypesWithExtends1.symbols | 531 ++++++++++++++++++ .../reference/inferTypesWithExtends1.types | 331 +++++++++++ .../inferTypesWithExtends2.errors.txt | 21 + .../reference/inferTypesWithExtends2.js | 13 + .../reference/inferTypesWithExtends2.symbols | 32 ++ .../reference/inferTypesWithExtends2.types | 20 + .../reference/infiniteConstraints.types | 4 +- .../reference/keyofAndIndexedAccess2.types | 2 +- .../literalsInComputedProperties1.types | 8 +- .../negateOperatorWithEnumType.types | 4 +- tests/baselines/reference/parserEnum5.types | 4 +- tests/baselines/reference/parserEnum7.types | 6 +- .../reference/plusOperatorWithEnumType.types | 2 +- .../typeofOperatorWithEnumType.types | 2 +- .../reference/voidOperatorWithEnumType.types | 2 +- .../types/conditional/inferTypes1.ts | 4 +- .../conditional/inferTypesWithExtends1.ts | 138 +++++ .../conditional/inferTypesWithExtends2.ts | 11 + .../cases/fourslash/refactorExtractType48.ts | 4 +- 56 files changed, 1948 insertions(+), 242 deletions(-) create mode 100644 tests/baselines/reference/inferTypesWithExtends1.js create mode 100644 tests/baselines/reference/inferTypesWithExtends1.symbols create mode 100644 tests/baselines/reference/inferTypesWithExtends1.types create mode 100644 tests/baselines/reference/inferTypesWithExtends2.errors.txt create mode 100644 tests/baselines/reference/inferTypesWithExtends2.js create mode 100644 tests/baselines/reference/inferTypesWithExtends2.symbols create mode 100644 tests/baselines/reference/inferTypesWithExtends2.types create mode 100644 tests/cases/conformance/types/conditional/inferTypesWithExtends1.ts create mode 100644 tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a93ca5297bb..d08091584cf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5009,7 +5009,20 @@ namespace ts { if (type.flags & TypeFlags.TypeParameter || objectFlags & ObjectFlags.ClassOrInterface) { if (type.flags & TypeFlags.TypeParameter && contains(context.inferTypeParameters, type)) { context.approximateLength += (symbolName(type.symbol).length + 6); - return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type as TypeParameter, context, /*constraintNode*/ undefined)); + let constraintNode: TypeNode | undefined; + const constraint = getConstraintOfTypeParameter(type as TypeParameter); + if (constraint) { + // If the infer type has a constraint that is not the same as the constraint + // we would have normally inferred based on context, we emit the constraint + // using `infer T extends ?`. We omit inferred constraints from type references + // as they may be elided. + const inferredConstraint = getInferredTypeParameterConstraint(type as TypeParameter, /*omitTypeReferences*/ true); + if (!(inferredConstraint && isTypeIdenticalTo(constraint, inferredConstraint))) { + context.approximateLength += 9; + constraintNode = constraint && typeToTypeNodeHelper(constraint, context); + } + } + return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type as TypeParameter, context, constraintNode)); } if (context.flags & NodeBuilderFlags.GenerateNamesForShadowedTypeParams && type.flags & TypeFlags.TypeParameter && @@ -13257,7 +13270,7 @@ namespace ts { return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0]; } - function getInferredTypeParameterConstraint(typeParameter: TypeParameter) { + function getInferredTypeParameterConstraint(typeParameter: TypeParameter, omitTypeReferences?: boolean) { let inferences: Type[] | undefined; if (typeParameter.symbol?.declarations) { for (const declaration of typeParameter.symbol.declarations) { @@ -13267,7 +13280,7 @@ namespace ts { // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent); - if (grandParent.kind === SyntaxKind.TypeReference) { + if (grandParent.kind === SyntaxKind.TypeReference && !omitTypeReferences) { const typeReference = grandParent as TypeReferenceNode; const typeParameters = getTypeParametersForTypeReference(typeReference); if (typeParameters) { @@ -35614,6 +35627,22 @@ namespace ts { grammarErrorOnNode(node, Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); + const symbol = getSymbolOfNode(node.typeParameter); + if (symbol.declarations && symbol.declarations.length > 1) { + const links = getSymbolLinks(symbol); + if (!links.typeParametersChecked) { + links.typeParametersChecked = true; + const typeParameter = getDeclaredTypeOfTypeParameter(symbol); + const declarations: TypeParameterDeclaration[] = getDeclarationsOfKind(symbol, SyntaxKind.TypeParameter); + if (!areTypeParametersIdentical(declarations, [typeParameter], decl => [decl])) { + // Report an error on every conflicting declaration. + const name = symbolToString(symbol); + for (const declaration of declarations) { + error(declaration.name, Diagnostics.All_declarations_of_0_must_have_identical_constraints, name); + } + } + } + } registerForUnusedIdentifiersCheck(node); } @@ -39124,7 +39153,7 @@ namespace ts { } const type = getDeclaredTypeOfSymbol(symbol) as InterfaceType; - if (!areTypeParametersIdentical(declarations, type.localTypeParameters!)) { + if (!areTypeParametersIdentical(declarations, type.localTypeParameters!, getEffectiveTypeParameterDeclarations)) { // Report an error on every conflicting declaration. const name = symbolToString(symbol); for (const declaration of declarations) { @@ -39134,13 +39163,13 @@ namespace ts { } } - function areTypeParametersIdentical(declarations: readonly (ClassDeclaration | InterfaceDeclaration)[], targetParameters: TypeParameter[]) { + function areTypeParametersIdentical(declarations: readonly T[], targetParameters: TypeParameter[], getTypeParameterDeclarations: (node: T) => readonly TypeParameterDeclaration[]) { const maxTypeArgumentCount = length(targetParameters); const minTypeArgumentCount = getMinTypeArgumentCount(targetParameters); for (const declaration of declarations) { // If this declaration has too few or too many type parameters, we report an error - const sourceParameters = getEffectiveTypeParameterDeclarations(declaration); + const sourceParameters = getTypeParameterDeclarations(declaration); const numTypeParameters = sourceParameters.length; if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { return false; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 9ef4e2c6c16..3bc61d247ac 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3433,6 +3433,10 @@ "category": "Error", "code": 2837 }, + "All declarations of '{0}' must have identical constraints.": { + "category": "Error", + "code": 2838 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e06b0e6b8b1..a0fbb74b33b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -909,6 +909,9 @@ namespace ts { let currentParenthesizerRule: ((node: Node) => Node) | undefined; const { enter: enterComment, exit: exitComment } = performance.createTimerIf(extendedDiagnostics, "commentTime", "beforeComment", "afterComment"); const parenthesizer = factory.parenthesizer; + const typeArgumentParenthesizerRuleSelector: OrdinalParentheizerRuleSelector = { + select: index => index === 0 ? parenthesizer.parenthesizeLeadingTypeArgument : undefined + }; const emitBinaryExpression = createEmitBinaryExpression(); reset(); @@ -2241,7 +2244,7 @@ namespace ts { } function emitArrayType(node: ArrayTypeNode) { - emit(node.elementType, parenthesizer.parenthesizeElementTypeOfArrayType); + emit(node.elementType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType); writePunctuation("["); writePunctuation("]"); } @@ -2254,7 +2257,7 @@ namespace ts { function emitTupleType(node: TupleTypeNode) { emitTokenWithComment(SyntaxKind.OpenBracketToken, node.pos, writePunctuation, node); const flags = getEmitFlags(node) & EmitFlags.SingleLine ? ListFormat.SingleLineTupleTypeElements : ListFormat.MultiLineTupleTypeElements; - emitList(node, node.elements, flags | ListFormat.NoSpaceIfEmpty); + emitList(node, node.elements, flags | ListFormat.NoSpaceIfEmpty, parenthesizer.parenthesizeElementTypeOfTupleType); emitTokenWithComment(SyntaxKind.CloseBracketToken, node.elements.end, writePunctuation, node); } @@ -2268,24 +2271,24 @@ namespace ts { } function emitOptionalType(node: OptionalTypeNode) { - emit(node.type, parenthesizer.parenthesizeElementTypeOfArrayType); + emit(node.type, parenthesizer.parenthesizeTypeOfOptionalType); writePunctuation("?"); } function emitUnionType(node: UnionTypeNode) { - emitList(node, node.types, ListFormat.UnionTypeConstituents, parenthesizer.parenthesizeMemberOfElementType); + emitList(node, node.types, ListFormat.UnionTypeConstituents, parenthesizer.parenthesizeConstituentTypeOfUnionType); } function emitIntersectionType(node: IntersectionTypeNode) { - emitList(node, node.types, ListFormat.IntersectionTypeConstituents, parenthesizer.parenthesizeMemberOfElementType); + emitList(node, node.types, ListFormat.IntersectionTypeConstituents, parenthesizer.parenthesizeConstituentTypeOfIntersectionType); } function emitConditionalType(node: ConditionalTypeNode) { - emit(node.checkType, parenthesizer.parenthesizeMemberOfConditionalType); + emit(node.checkType, parenthesizer.parenthesizeCheckTypeOfConditionalType); writeSpace(); writeKeyword("extends"); writeSpace(); - emit(node.extendsType, parenthesizer.parenthesizeMemberOfConditionalType); + emit(node.extendsType, parenthesizer.parenthesizeExtendsTypeOfConditionalType); writeSpace(); writePunctuation("?"); writeSpace(); @@ -2315,11 +2318,15 @@ namespace ts { function emitTypeOperator(node: TypeOperatorNode) { writeTokenText(node.operator, writeKeyword); writeSpace(); - emit(node.type, parenthesizer.parenthesizeMemberOfElementType); + + const parenthesizerRule = node.operator === SyntaxKind.ReadonlyKeyword ? + parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : + parenthesizer.parenthesizeOperandOfTypeOperator; + emit(node.type, parenthesizerRule); } function emitIndexedAccessType(node: IndexedAccessTypeNode) { - emit(node.objectType, parenthesizer.parenthesizeMemberOfElementType); + emit(node.objectType, parenthesizer.parenthesizeNonArrayTypeOfPostfixType); writePunctuation("["); emit(node.indexType); writePunctuation("]"); @@ -4256,7 +4263,7 @@ namespace ts { } function emitTypeArguments(parentNode: Node, typeArguments: NodeArray | undefined) { - emitList(parentNode, typeArguments, ListFormat.TypeArguments, parenthesizer.parenthesizeMemberOfElementType); + emitList(parentNode, typeArguments, ListFormat.TypeArguments, typeArgumentParenthesizerRuleSelector); } function emitTypeParameters(parentNode: SignatureDeclaration | InterfaceDeclaration | TypeAliasDeclaration | ClassDeclaration | ClassExpression, typeParameters: NodeArray | undefined) { @@ -4324,15 +4331,15 @@ namespace ts { } } - function emitList(parentNode: Node | undefined, children: NodeArray | undefined, format: ListFormat, parenthesizerRule?: (node: Node) => Node, start?: number, count?: number) { + function emitList(parentNode: Node | undefined, children: NodeArray | undefined, format: ListFormat, parenthesizerRule?: ParenthesizerRuleOrSelector, start?: number, count?: number) { emitNodeList(emit, parentNode, children, format, parenthesizerRule, start, count); } - function emitExpressionList(parentNode: Node | undefined, children: NodeArray | undefined, format: ListFormat, parenthesizerRule?: (node: Expression) => Expression, start?: number, count?: number) { + function emitExpressionList(parentNode: Node | undefined, children: NodeArray | undefined, format: ListFormat, parenthesizerRule?: ParenthesizerRuleOrSelector, start?: number, count?: number) { emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count); } - function emitNodeList(emit: (node: Node, parenthesizerRule?: ((node: Node) => Node) | undefined) => void, parentNode: Node | undefined, children: NodeArray | undefined, format: ListFormat, parenthesizerRule: ((node: Node) => Node) | undefined, start = 0, count = children ? children.length - start : 0) { + function emitNodeList(emit: (node: Node, parenthesizerRule?: ((node: Node) => Node) | undefined) => void, parentNode: Node | undefined, children: NodeArray | undefined, format: ListFormat, parenthesizerRule: ParenthesizerRuleOrSelector | undefined, start = 0, count = children ? children.length - start : 0) { const isUndefined = children === undefined; if (isUndefined && format & ListFormat.OptionalIfUndefined) { return; @@ -4388,6 +4395,8 @@ namespace ts { increaseIndent(); } + const emitListItem = getEmitListItem(emit, parenthesizerRule); + // Emit each child. let previousSibling: Node | undefined; let previousSourceFileTextKind: ReturnType; @@ -4443,12 +4452,7 @@ namespace ts { } nextListElementPos = child.pos; - if (emit.length === 1) { - emit(child); - } - else { - emit(child, parenthesizerRule); - } + emitListItem(child, emit, parenthesizerRule, i); if (shouldDecreaseIndentAfterEmit) { decreaseIndent(); @@ -5890,4 +5894,30 @@ namespace ts { CountMask = 0x0FFFFFFF, // Temp variable counter _i = 0x10000000, // Use/preference flag for '_i' } + + interface OrdinalParentheizerRuleSelector { + select(index: number): ((node: T) => T) | undefined; + } + + type ParenthesizerRule = (node: T) => T; + + type ParenthesizerRuleOrSelector = OrdinalParentheizerRuleSelector | ParenthesizerRule; + + function emitListItemNoParenthesizer(node: Node, emit: (node: Node, parenthesizerRule?: ((node: Node) => Node) | undefined) => void, _parenthesizerRule: ParenthesizerRuleOrSelector | undefined, _index: number) { + emit(node); + } + + function emitListItemWithParenthesizerRuleSelector(node: Node, emit: (node: Node, parenthesizerRule?: ((node: Node) => Node) | undefined) => void, parenthesizerRuleSelector: OrdinalParentheizerRuleSelector, index: number) { + emit(node, parenthesizerRuleSelector.select(index)); + } + + function emitListItemWithParenthesizerRule(node: Node, emit: (node: Node, parenthesizerRule?: ((node: Node) => Node) | undefined) => void, parenthesizerRule: ParenthesizerRule | undefined, _index: number) { + emit(node, parenthesizerRule); + } + + function getEmitListItem | undefined>(emit: (node: Node, parenthesizerRule?: ((node: Node) => Node) | undefined) => void, parenthesizerRule: R): (node: Node, emit: (node: Node, parenthesizerRule?: ((node: Node) => Node) | undefined) => void, parenthesizerRule: R, index: number) => void { + return emit.length === 1 ? emitListItemNoParenthesizer : + typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : + emitListItemWithParenthesizerRule; + } } diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 412fc581085..cbeb8df5e5b 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -34,6 +34,8 @@ namespace ts { const getJSDocPrimaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => () => createJSDocPrimaryTypeWorker(kind)); const getJSDocUnaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => (type: T["type"]) => createJSDocUnaryTypeWorker(kind, type)); const getJSDocUnaryTypeUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, type: T["type"]) => updateJSDocUnaryTypeWorker(kind, node, type)); + const getJSDocPrePostfixUnaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => (type: T["type"], postfix?: boolean) => createJSDocPrePostfixUnaryTypeWorker(kind, type, postfix)); + const getJSDocPrePostfixUnaryTypeUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, type: T["type"]) => updateJSDocPrePostfixUnaryTypeWorker(kind, node, type)); const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: NodeArray) => createJSDocSimpleTagWorker(kind, tagName, comment)); const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: NodeArray) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: NodeArray) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); @@ -42,6 +44,8 @@ namespace ts { const factory: NodeFactory = { get parenthesizer() { return parenthesizerRules(); }, get converters() { return converters(); }, + baseFactory, + flags, createNodeArray, createNumericLiteral, createBigIntLiteral, @@ -317,10 +321,10 @@ namespace ts { // lazily load factory members for JSDoc types with similar structure get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(SyntaxKind.JSDocAllType); }, get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(SyntaxKind.JSDocUnknownType); }, - get createJSDocNonNullableType() { return getJSDocUnaryTypeCreateFunction(SyntaxKind.JSDocNonNullableType); }, - get updateJSDocNonNullableType() { return getJSDocUnaryTypeUpdateFunction(SyntaxKind.JSDocNonNullableType); }, - get createJSDocNullableType() { return getJSDocUnaryTypeCreateFunction(SyntaxKind.JSDocNullableType); }, - get updateJSDocNullableType() { return getJSDocUnaryTypeUpdateFunction(SyntaxKind.JSDocNullableType); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(SyntaxKind.JSDocNonNullableType); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(SyntaxKind.JSDocNonNullableType); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(SyntaxKind.JSDocNullableType); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(SyntaxKind.JSDocNullableType); }, get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(SyntaxKind.JSDocOptionalType); }, get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(SyntaxKind.JSDocOptionalType); }, get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(SyntaxKind.JSDocVariadicType); }, @@ -1912,7 +1916,7 @@ namespace ts { // @api function createArrayTypeNode(elementType: TypeNode) { const node = createBaseNode(SyntaxKind.ArrayType); - node.elementType = parenthesizerRules().parenthesizeElementTypeOfArrayType(elementType); + node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = TransformFlags.ContainsTypeScript; return node; } @@ -1927,7 +1931,7 @@ namespace ts { // @api function createTupleTypeNode(elements: readonly (TypeNode | NamedTupleMember)[]) { const node = createBaseNode(SyntaxKind.TupleType); - node.elements = createNodeArray(elements); + node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = TransformFlags.ContainsTypeScript; return node; } @@ -1963,7 +1967,7 @@ namespace ts { // @api function createOptionalTypeNode(type: TypeNode) { const node = createBaseNode(SyntaxKind.OptionalType); - node.type = parenthesizerRules().parenthesizeElementTypeOfArrayType(type); + node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = TransformFlags.ContainsTypeScript; return node; } @@ -1990,44 +1994,44 @@ namespace ts { : node; } - function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: readonly TypeNode[]) { + function createUnionOrIntersectionTypeNode(kind: SyntaxKind.UnionType | SyntaxKind.IntersectionType, types: readonly TypeNode[], parenthesize: (nodes: readonly TypeNode[]) => readonly TypeNode[]) { const node = createBaseNode(kind); - node.types = parenthesizerRules().parenthesizeConstituentTypesOfUnionOrIntersectionType(types); + node.types = factory.createNodeArray(parenthesize(types)); node.transformFlags = TransformFlags.ContainsTypeScript; return node; } - function updateUnionOrIntersectionTypeNode(node: T, types: NodeArray): T { + function updateUnionOrIntersectionTypeNode(node: T, types: NodeArray, parenthesize: (nodes: readonly TypeNode[]) => readonly TypeNode[]): T { return node.types !== types - ? update(createUnionOrIntersectionTypeNode(node.kind, types) as T, node) + ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize) as T, node) : node; } // @api function createUnionTypeNode(types: readonly TypeNode[]): UnionTypeNode { - return createUnionOrIntersectionTypeNode(SyntaxKind.UnionType, types) as UnionTypeNode; + return createUnionOrIntersectionTypeNode(SyntaxKind.UnionType, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType) as UnionTypeNode; } // @api function updateUnionTypeNode(node: UnionTypeNode, types: NodeArray) { - return updateUnionOrIntersectionTypeNode(node, types); + return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function createIntersectionTypeNode(types: readonly TypeNode[]): IntersectionTypeNode { - return createUnionOrIntersectionTypeNode(SyntaxKind.IntersectionType, types) as IntersectionTypeNode; + return createUnionOrIntersectionTypeNode(SyntaxKind.IntersectionType, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType) as IntersectionTypeNode; } // @api function updateIntersectionTypeNode(node: IntersectionTypeNode, types: NodeArray) { - return updateUnionOrIntersectionTypeNode(node, types); + return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function createConditionalTypeNode(checkType: TypeNode, extendsType: TypeNode, trueType: TypeNode, falseType: TypeNode) { const node = createBaseNode(SyntaxKind.ConditionalType); - node.checkType = parenthesizerRules().parenthesizeMemberOfConditionalType(checkType); - node.extendsType = parenthesizerRules().parenthesizeMemberOfConditionalType(extendsType); + node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); + node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; node.falseType = falseType; node.transformFlags = TransformFlags.ContainsTypeScript; @@ -2154,7 +2158,9 @@ namespace ts { function createTypeOperatorNode(operator: SyntaxKind.KeyOfKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.ReadonlyKeyword, type: TypeNode): TypeOperatorNode { const node = createBaseNode(SyntaxKind.TypeOperator); node.operator = operator; - node.type = parenthesizerRules().parenthesizeMemberOfElementType(type); + node.type = operator === SyntaxKind.ReadonlyKeyword ? + parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : + parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = TransformFlags.ContainsTypeScript; return node; } @@ -2169,7 +2175,7 @@ namespace ts { // @api function createIndexedAccessTypeNode(objectType: TypeNode, indexType: TypeNode) { const node = createBaseNode(SyntaxKind.IndexedAccessType); - node.objectType = parenthesizerRules().parenthesizeMemberOfElementType(objectType); + node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = TransformFlags.ContainsTypeScript; return node; @@ -4360,12 +4366,21 @@ namespace ts { } // @api - // createJSDocNonNullableType // createJSDocNullableType + // createJSDocNonNullableType + function createJSDocPrePostfixUnaryTypeWorker(kind: T["kind"], type: T["type"], postfix = false): T { + const node = createJSDocUnaryTypeWorker( + kind, + postfix ? type && parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(type) : type + ) as Mutable; + node.postfix = postfix; + return node; + } + + // @api // createJSDocOptionalType // createJSDocVariadicType // createJSDocNamepathType - function createJSDocUnaryTypeWorker(kind: T["kind"], type: T["type"]): T { const node = createBaseNode(kind); node.type = type; @@ -4375,6 +4390,13 @@ namespace ts { // @api // updateJSDocNonNullableType // updateJSDocNullableType + function updateJSDocPrePostfixUnaryTypeWorker(kind: T["kind"], node: T, type: T["type"]): T { + return node.type !== type + ? update(createJSDocPrePostfixUnaryTypeWorker(kind, type, node.postfix), node) + : node; + } + + // @api // updateJSDocOptionalType // updateJSDocVariadicType // updateJSDocNamepathType diff --git a/src/compiler/factory/parenthesizerRules.ts b/src/compiler/factory/parenthesizerRules.ts index 1e2cb936582..c824c13fd16 100644 --- a/src/compiler/factory/parenthesizerRules.ts +++ b/src/compiler/factory/parenthesizerRules.ts @@ -25,11 +25,20 @@ namespace ts { parenthesizeExpressionForDisallowedComma, parenthesizeExpressionOfExpressionStatement, parenthesizeConciseBodyOfArrowFunction, - parenthesizeMemberOfConditionalType, - parenthesizeMemberOfElementType, - parenthesizeElementTypeOfArrayType, - parenthesizeConstituentTypesOfUnionOrIntersectionType, + parenthesizeCheckTypeOfConditionalType, + parenthesizeExtendsTypeOfConditionalType, + parenthesizeConstituentTypesOfUnionType, + parenthesizeConstituentTypeOfUnionType, + parenthesizeConstituentTypesOfIntersectionType, + parenthesizeConstituentTypeOfIntersectionType, + parenthesizeOperandOfTypeOperator, + parenthesizeOperandOfReadonlyTypeOperator, + parenthesizeNonArrayTypeOfPostfixType, + parenthesizeElementTypesOfTupleType, + parenthesizeElementTypeOfTupleType, + parenthesizeTypeOfOptionalType, parenthesizeTypeArguments, + parenthesizeLeadingTypeArgument, }; function getParenthesizeLeftSideOfBinaryForOperator(operatorKind: BinaryOperator) { @@ -388,38 +397,199 @@ namespace ts { return body; } - function parenthesizeMemberOfConditionalType(member: TypeNode): TypeNode { - return member.kind === SyntaxKind.ConditionalType ? factory.createParenthesizedType(member) : member; - } + // Type[Extends] : + // FunctionOrConstructorType + // ConditionalType[?Extends] - function parenthesizeMemberOfElementType(member: TypeNode): TypeNode { - switch (member.kind) { - case SyntaxKind.UnionType: - case SyntaxKind.IntersectionType: + // ConditionalType[Extends] : + // UnionType[?Extends] + // [~Extends] UnionType[~Extends] `extends` Type[+Extends] `?` Type[~Extends] `:` Type[~Extends] + // + // - The check type (the `UnionType`, above) does not allow function, constructor, or conditional types (they must be parenthesized) + // - The extends type (the first `Type`, above) does not allow conditional types (they must be parenthesized). Function and constructor types are fine. + // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type + function parenthesizeCheckTypeOfConditionalType(checkType: TypeNode): TypeNode { + switch (checkType.kind) { case SyntaxKind.FunctionType: case SyntaxKind.ConstructorType: - return factory.createParenthesizedType(member); + case SyntaxKind.ConditionalType: + return factory.createParenthesizedType(checkType); } - return parenthesizeMemberOfConditionalType(member); + return checkType; } - function parenthesizeElementTypeOfArrayType(member: TypeNode): TypeNode { - switch (member.kind) { - case SyntaxKind.TypeQuery: + function parenthesizeExtendsTypeOfConditionalType(extendsType: TypeNode): TypeNode { + switch (extendsType.kind) { + case SyntaxKind.ConditionalType: + return factory.createParenthesizedType(extendsType); + } + return extendsType; + } + + // UnionType[Extends] : + // `|`? IntersectionType[?Extends] + // UnionType[?Extends] `|` IntersectionType[?Extends] + // + // - A union type constituent has the same precedence as the check type of a conditional type + function parenthesizeConstituentTypeOfUnionType(type: TypeNode) { + switch (type.kind) { + case SyntaxKind.UnionType: // Not strictly necessary, but a union containing a union should have been flattened + case SyntaxKind.IntersectionType: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + return factory.createParenthesizedType(type); + } + return parenthesizeCheckTypeOfConditionalType(type); + } + + function parenthesizeConstituentTypesOfUnionType(members: readonly TypeNode[]): NodeArray { + return factory.createNodeArray(sameMap(members, parenthesizeConstituentTypeOfUnionType)); + } + + // IntersectionType[Extends] : + // `&`? TypeOperator[?Extends] + // IntersectionType[?Extends] `&` TypeOperator[?Extends] + // + // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) + function parenthesizeConstituentTypeOfIntersectionType(type: TypeNode) { + switch (type.kind) { + case SyntaxKind.UnionType: + case SyntaxKind.IntersectionType: // Not strictly necessary, but an intersection containing an intersection should have been flattened + return factory.createParenthesizedType(type); + } + return parenthesizeConstituentTypeOfUnionType(type); + } + + function parenthesizeConstituentTypesOfIntersectionType(members: readonly TypeNode[]): NodeArray { + return factory.createNodeArray(sameMap(members, parenthesizeConstituentTypeOfIntersectionType)); + } + + // TypeOperator[Extends] : + // PostfixType + // InferType[?Extends] + // `keyof` TypeOperator[?Extends] + // `unique` TypeOperator[?Extends] + // `readonly` TypeOperator[?Extends] + // + function parenthesizeOperandOfTypeOperator(type: TypeNode) { + switch (type.kind) { + case SyntaxKind.IntersectionType: + return factory.createParenthesizedType(type); + } + return parenthesizeConstituentTypeOfIntersectionType(type); + } + + function parenthesizeOperandOfReadonlyTypeOperator(type: TypeNode) { + switch (type.kind) { case SyntaxKind.TypeOperator: - case SyntaxKind.InferType: - return factory.createParenthesizedType(member); + return factory.createParenthesizedType(type); } - return parenthesizeMemberOfElementType(member); + return parenthesizeOperandOfTypeOperator(type); } - function parenthesizeConstituentTypesOfUnionOrIntersectionType(members: readonly TypeNode[]): NodeArray { - return factory.createNodeArray(sameMap(members, parenthesizeMemberOfElementType)); + // PostfixType : + // NonArrayType + // NonArrayType [no LineTerminator here] `!` // JSDoc + // NonArrayType [no LineTerminator here] `?` // JSDoc + // IndexedAccessType + // ArrayType + // + // IndexedAccessType : + // NonArrayType `[` Type[~Extends] `]` + // + // ArrayType : + // NonArrayType `[` `]` + // + function parenthesizeNonArrayTypeOfPostfixType(type: TypeNode) { + switch (type.kind) { + case SyntaxKind.InferType: + case SyntaxKind.TypeOperator: + case SyntaxKind.TypeQuery: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + return factory.createParenthesizedType(type); + } + return parenthesizeOperandOfTypeOperator(type); + } + // TupleType : + // `[` Elision? `]` + // `[` NamedTupleElementTypes `]` + // `[` NamedTupleElementTypes `,` Elision? `]` + // `[` TupleElementTypes `]` + // `[` TupleElementTypes `,` Elision? `]` + // + // NamedTupleElementTypes : + // Elision? NamedTupleMember + // NamedTupleElementTypes `,` Elision? NamedTupleMember + // + // NamedTupleMember : + // Identifier `?`? `:` Type[~Extends] + // `...` Identifier `:` Type[~Extends] + // + // TupleElementTypes : + // Elision? TupleElementType + // TupleElementTypes `,` Elision? TupleElementType + // + // TupleElementType : + // Type[~Extends] // NOTE: Needs cover grammar to disallow JSDoc postfix-optional + // OptionalType + // RestType + // + // OptionalType : + // Type[~Extends] `?` // NOTE: Needs cover grammar to disallow JSDoc postfix-optional + // + // RestType : + // `...` Type[~Extends] + // + function parenthesizeElementTypesOfTupleType(types: readonly (TypeNode | NamedTupleMember)[]): NodeArray { + return factory.createNodeArray(sameMap(types, parenthesizeElementTypeOfTupleType)); + } + + function parenthesizeElementTypeOfTupleType(type: TypeNode | NamedTupleMember): TypeNode { + if (hasJSDocPostfixQuestion(type)) return factory.createParenthesizedType(type); + return type; + } + + function hasJSDocPostfixQuestion(type: TypeNode | NamedTupleMember): boolean { + if (isJSDocNullableType(type)) return type.postfix; + if (isNamedTupleMember(type)) return hasJSDocPostfixQuestion(type.type); + if (isFunctionTypeNode(type) || isConstructorTypeNode(type) || isTypeOperatorNode(type)) return hasJSDocPostfixQuestion(type.type); + if (isConditionalTypeNode(type)) return hasJSDocPostfixQuestion(type.falseType); + if (isUnionTypeNode(type)) return hasJSDocPostfixQuestion(last(type.types)); + if (isIntersectionTypeNode(type)) return hasJSDocPostfixQuestion(last(type.types)); + if (isInferTypeNode(type)) return !!type.typeParameter.constraint && hasJSDocPostfixQuestion(type.typeParameter.constraint); + return false; + } + + function parenthesizeTypeOfOptionalType(type: TypeNode): TypeNode { + if (hasJSDocPostfixQuestion(type)) return factory.createParenthesizedType(type); + return parenthesizeNonArrayTypeOfPostfixType(type); + } + + // function parenthesizeMemberOfElementType(member: TypeNode): TypeNode { + // switch (member.kind) { + // case SyntaxKind.UnionType: + // case SyntaxKind.IntersectionType: + // case SyntaxKind.FunctionType: + // case SyntaxKind.ConstructorType: + // return factory.createParenthesizedType(member); + // } + // return parenthesizeMemberOfConditionalType(member); + // } + + // function parenthesizeElementTypeOfArrayType(member: TypeNode): TypeNode { + // switch (member.kind) { + // case SyntaxKind.TypeQuery: + // case SyntaxKind.TypeOperator: + // case SyntaxKind.InferType: + // return factory.createParenthesizedType(member); + // } + // return parenthesizeMemberOfElementType(member); + // } + + function parenthesizeLeadingTypeArgument(node: TypeNode) { + return isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node; } function parenthesizeOrdinalTypeArgument(node: TypeNode, i: number) { - return i === 0 && isFunctionOrConstructorTypeNode(node) && node.typeParameters ? factory.createParenthesizedType(node) : node; + return i === 0 ? parenthesizeLeadingTypeArgument(node) : node; } function parenthesizeTypeArguments(typeArguments: NodeArray | undefined): NodeArray | undefined { @@ -446,10 +616,19 @@ namespace ts { parenthesizeExpressionForDisallowedComma: identity, parenthesizeExpressionOfExpressionStatement: identity, parenthesizeConciseBodyOfArrowFunction: identity, - parenthesizeMemberOfConditionalType: identity, - parenthesizeMemberOfElementType: identity, - parenthesizeElementTypeOfArrayType: identity, - parenthesizeConstituentTypesOfUnionOrIntersectionType: nodes => cast(nodes, isNodeArray), + parenthesizeCheckTypeOfConditionalType: identity, + parenthesizeExtendsTypeOfConditionalType: identity, + parenthesizeConstituentTypesOfUnionType: nodes => cast(nodes, isNodeArray), + parenthesizeConstituentTypeOfUnionType: identity, + parenthesizeConstituentTypesOfIntersectionType: nodes => cast(nodes, isNodeArray), + parenthesizeConstituentTypeOfIntersectionType: identity, + parenthesizeOperandOfTypeOperator: identity, + parenthesizeOperandOfReadonlyTypeOperator: identity, + parenthesizeNonArrayTypeOfPostfixType: identity, + parenthesizeElementTypesOfTupleType: nodes => cast(nodes, isNodeArray), + parenthesizeElementTypeOfTupleType: identity, + parenthesizeTypeOfOptionalType: identity, parenthesizeTypeArguments: nodes => nodes && cast(nodes, isNodeArray), + parenthesizeLeadingTypeArgument: identity, }; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 059083df5ca..7642612e27a 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1391,6 +1391,14 @@ namespace ts { return doInsideOfContext(NodeFlags.DisallowInContext, func); } + function allowConditionalTypesAnd(func: () => T): T { + return doOutsideOfContext(NodeFlags.DisallowConditionalTypesContext, func); + } + + function disallowConditionalTypesAnd(func: () => T): T { + return doInsideOfContext(NodeFlags.DisallowConditionalTypesContext, func); + } + function doInYieldContext(func: () => T): T { return doInsideOfContext(NodeFlags.YieldContext, func); } @@ -1427,6 +1435,10 @@ namespace ts { return inContext(NodeFlags.DisallowInContext); } + function inDisallowConditionalTypesContext() { + return inContext(NodeFlags.DisallowConditionalTypesContext); + } + function inDecoratorContext() { return inContext(NodeFlags.DecoratorContext); } @@ -3073,7 +3085,7 @@ namespace ts { function parseJSDocNonNullableType(): TypeNode { const pos = getNodePos(); nextToken(); - return finishNode(factory.createJSDocNonNullableType(parseNonArrayType()), pos); + return finishNode(factory.createJSDocNonNullableType(parseNonArrayType(), /*postfix*/ false), pos); } function parseJSDocUnknownOrNullableType(): JSDocUnknownType | JSDocNullableType { @@ -3100,7 +3112,7 @@ namespace ts { return finishNode(factory.createJSDocUnknownType(), pos); } else { - return finishNode(factory.createJSDocNullableType(parseType()), pos); + return finishNode(factory.createJSDocNullableType(parseType(), /*postfix*/ false), pos); } } @@ -3323,7 +3335,7 @@ namespace ts { function parseReturnType(returnToken: SyntaxKind.ColonToken | SyntaxKind.EqualsGreaterThanToken, isType: boolean): TypeNode | undefined; function parseReturnType(returnToken: SyntaxKind.ColonToken | SyntaxKind.EqualsGreaterThanToken, isType: boolean) { if (shouldParseReturnType(returnToken, isType)) { - return parseTypeOrTypePredicate(); + return allowConditionalTypesAnd(parseTypeOrTypePredicate); } } @@ -3948,7 +3960,7 @@ namespace ts { switch (token()) { case SyntaxKind.ExclamationToken: nextToken(); - type = finishNode(factory.createJSDocNonNullableType(type), pos); + type = finishNode(factory.createJSDocNonNullableType(type, /*postfix*/ true), pos); break; case SyntaxKind.QuestionToken: // If next token is start of a type we have a conditional type @@ -3956,7 +3968,7 @@ namespace ts { return type; } nextToken(); - type = finishNode(factory.createJSDocNullableType(type), pos); + type = finishNode(factory.createJSDocNullableType(type, /*postfix*/ true), pos); break; case SyntaxKind.OpenBracketToken: parseExpected(SyntaxKind.OpenBracketToken); @@ -3983,17 +3995,21 @@ namespace ts { return finishNode(factory.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos); } - function parseTypeParameterOfInferType() { + function tryParseConstraintOfInferType() { + if (parseOptional(SyntaxKind.ExtendsKeyword)) { + const constraint = disallowConditionalTypesAnd(parseType); + if (inDisallowConditionalTypesContext() || token() !== SyntaxKind.QuestionToken) { + return constraint; + } + } + } + + function parseTypeParameterOfInferType(): TypeParameterDeclaration { const pos = getNodePos(); - return finishNode( - factory.createTypeParameterDeclaration( - /*modifiers*/ undefined, - parseIdentifier(), - /*constraint*/ undefined, - /*defaultType*/ undefined - ), - pos - ); + const name = parseIdentifier(); + const constraint = tryParse(tryParseConstraintOfInferType); + const node = factory.createTypeParameterDeclaration(/*modifiers*/ undefined, name, constraint); + return finishNode(node, pos); } function parseInferType(): InferTypeNode { @@ -4012,7 +4028,7 @@ namespace ts { case SyntaxKind.InferKeyword: return parseInferType(); } - return parsePostfixTypeOrHigher(); + return allowConditionalTypesAnd(parsePostfixTypeOrHigher); } function parseFunctionOrConstructorTypeToError( @@ -4161,24 +4177,22 @@ namespace ts { } function parseType(): TypeNode { - // The rules about 'yield' only apply to actual code/expression contexts. They don't - // apply to 'type' contexts. So we disable these parameters here before moving on. - return doOutsideOfContext(NodeFlags.TypeExcludesFlags, parseTypeWorker); - } + if (contextFlags & NodeFlags.TypeExcludesFlags) { + return doOutsideOfContext(NodeFlags.TypeExcludesFlags, parseType); + } - function parseTypeWorker(noConditionalTypes?: boolean): TypeNode { if (isStartOfFunctionTypeOrConstructorType()) { return parseFunctionOrConstructorType(); } const pos = getNodePos(); const type = parseUnionTypeOrHigher(); - if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(SyntaxKind.ExtendsKeyword)) { + if (!inDisallowConditionalTypesContext() && !scanner.hasPrecedingLineBreak() && parseOptional(SyntaxKind.ExtendsKeyword)) { // The type following 'extends' is not permitted to be another conditional type - const extendsType = parseTypeWorker(/*noConditionalTypes*/ true); + const extendsType = disallowConditionalTypesAnd(parseType); parseExpected(SyntaxKind.QuestionToken); - const trueType = parseTypeWorker(); + const trueType = allowConditionalTypesAnd(parseType); parseExpected(SyntaxKind.ColonToken); - const falseType = parseTypeWorker(); + const falseType = allowConditionalTypesAnd(parseType); return finishNode(factory.createConditionalTypeNode(type, extendsType, trueType, falseType), pos); } return type; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 396805f71a6..cbaf27144f1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -763,10 +763,11 @@ namespace ts { YieldContext = 1 << 13, // If node was parsed in the 'yield' context created when parsing a generator DecoratorContext = 1 << 14, // If node was parsed as part of a decorator AwaitContext = 1 << 15, // If node was parsed in the 'await' context created when parsing an async function - ThisNodeHasError = 1 << 16, // If the parser encountered an error when parsing the code that created this node - JavaScriptFile = 1 << 17, // If node was parsed in a JavaScript - ThisNodeOrAnySubNodesHasError = 1 << 18, // If this node or any of its children had an error - HasAggregatedChildData = 1 << 19, // If we've computed data from children and cached it in this node + DisallowConditionalTypesContext = 1 << 16, // If node was parsed in a context where conditional types are not allowed + ThisNodeHasError = 1 << 17, // If the parser encountered an error when parsing the code that created this node + JavaScriptFile = 1 << 18, // If node was parsed in a JavaScript + ThisNodeOrAnySubNodesHasError = 1 << 19, // If this node or any of its children had an error + HasAggregatedChildData = 1 << 20, // If we've computed data from children and cached it in this node // These flags will be set when the parser encounters a dynamic import expression or 'import.meta' to avoid // walking the tree if the flags are not set. However, these flags are just a approximation @@ -777,15 +778,15 @@ namespace ts { // removal, it is likely that users will add the import anyway. // The advantage of this approach is its simplicity. For the case of batch compilation, // we guarantee that users won't have to pay the price of walking the tree if a dynamic import isn't used. - /* @internal */ PossiblyContainsDynamicImport = 1 << 20, - /* @internal */ PossiblyContainsImportMeta = 1 << 21, + /* @internal */ PossiblyContainsDynamicImport = 1 << 21, + /* @internal */ PossiblyContainsImportMeta = 1 << 22, - JSDoc = 1 << 22, // If node was parsed inside jsdoc - /* @internal */ Ambient = 1 << 23, // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier. - /* @internal */ InWithStatement = 1 << 24, // If any ancestor of node was the `statement` of a WithStatement (not the `expression`) - JsonFile = 1 << 25, // If node was parsed in a Json - /* @internal */ TypeCached = 1 << 26, // If a type was cached for node at any point - /* @internal */ Deprecated = 1 << 27, // If has '@deprecated' JSDoc tag + JSDoc = 1 << 23, // If node was parsed inside jsdoc + /* @internal */ Ambient = 1 << 24, // If node was inside an ambient context -- a declaration file, or inside something with the `declare` modifier. + /* @internal */ InWithStatement = 1 << 25, // If any ancestor of node was the `statement` of a WithStatement (not the `expression`) + JsonFile = 1 << 26, // If node was parsed in a Json + /* @internal */ TypeCached = 1 << 27, // If a type was cached for node at any point + /* @internal */ Deprecated = 1 << 28, // If has '@deprecated' JSDoc tag BlockScoped = Let | Const, @@ -793,7 +794,7 @@ namespace ts { ReachabilityAndEmitFlags = ReachabilityCheckFlags | HasAsyncFunctions, // Parsing context flags - ContextFlags = DisallowInContext | YieldContext | DecoratorContext | AwaitContext | JavaScriptFile | InWithStatement | Ambient, + ContextFlags = DisallowInContext | DisallowConditionalTypesContext | YieldContext | DecoratorContext | AwaitContext | JavaScriptFile | InWithStatement | Ambient, // Exclude these flags when parsing a Type TypeExcludesFlags = YieldContext | AwaitContext, @@ -3234,11 +3235,13 @@ namespace ts { export interface JSDocNonNullableType extends JSDocType { readonly kind: SyntaxKind.JSDocNonNullableType; readonly type: TypeNode; + readonly postfix: boolean; } export interface JSDocNullableType extends JSDocType { readonly kind: SyntaxKind.JSDocNullableType; readonly type: TypeNode; + readonly postfix: boolean; } export interface JSDocOptionalType extends JSDocType { @@ -7129,10 +7132,19 @@ namespace ts { parenthesizeExpressionOfExpressionStatement(expression: Expression): Expression; parenthesizeConciseBodyOfArrowFunction(body: Expression): Expression; parenthesizeConciseBodyOfArrowFunction(body: ConciseBody): ConciseBody; - parenthesizeMemberOfConditionalType(member: TypeNode): TypeNode; - parenthesizeMemberOfElementType(member: TypeNode): TypeNode; - parenthesizeElementTypeOfArrayType(member: TypeNode): TypeNode; - parenthesizeConstituentTypesOfUnionOrIntersectionType(members: readonly TypeNode[]): NodeArray; + parenthesizeCheckTypeOfConditionalType(type: TypeNode): TypeNode; + parenthesizeExtendsTypeOfConditionalType(type: TypeNode): TypeNode; + parenthesizeOperandOfTypeOperator(type: TypeNode): TypeNode; + parenthesizeOperandOfReadonlyTypeOperator(type: TypeNode): TypeNode; + parenthesizeNonArrayTypeOfPostfixType(type: TypeNode): TypeNode; + parenthesizeElementTypesOfTupleType(types: readonly (TypeNode | NamedTupleMember)[]): NodeArray; + parenthesizeElementTypeOfTupleType(type: TypeNode | NamedTupleMember): TypeNode | NamedTupleMember; + parenthesizeTypeOfOptionalType(type: TypeNode): TypeNode; + parenthesizeConstituentTypeOfUnionType(type: TypeNode): TypeNode; + parenthesizeConstituentTypesOfUnionType(constituents: readonly TypeNode[]): NodeArray; + parenthesizeConstituentTypeOfIntersectionType(type: TypeNode): TypeNode; + parenthesizeConstituentTypesOfIntersectionType(constituents: readonly TypeNode[]): NodeArray; + parenthesizeLeadingTypeArgument(typeNode: TypeNode): TypeNode; parenthesizeTypeArguments(typeParameters: readonly TypeNode[] | undefined): NodeArray | undefined; } @@ -7151,6 +7163,8 @@ namespace ts { export interface NodeFactory { /* @internal */ readonly parenthesizer: ParenthesizerRules; /* @internal */ readonly converters: NodeConverters; + /* @internal */ readonly baseFactory: BaseNodeFactory; + /* @internal */ readonly flags: NodeFactoryFlags; createNodeArray(elements?: readonly T[], hasTrailingComma?: boolean): NodeArray; // @@ -7549,9 +7563,9 @@ namespace ts { createJSDocAllType(): JSDocAllType; createJSDocUnknownType(): JSDocUnknownType; - createJSDocNonNullableType(type: TypeNode): JSDocNonNullableType; + createJSDocNonNullableType(type: TypeNode, postfix?: boolean): JSDocNonNullableType; updateJSDocNonNullableType(node: JSDocNonNullableType, type: TypeNode): JSDocNonNullableType; - createJSDocNullableType(type: TypeNode): JSDocNullableType; + createJSDocNullableType(type: TypeNode, postfix?: boolean): JSDocNullableType; updateJSDocNullableType(node: JSDocNullableType, type: TypeNode): JSDocNullableType; createJSDocOptionalType(type: TypeNode): JSDocOptionalType; updateJSDocOptionalType(node: JSDocOptionalType, type: TypeNode): JSDocOptionalType; diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index be02cb0a4f2..9765e8a4fda 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -1119,8 +1119,17 @@ namespace ts.textChanges { return skipTrivia(s, 0) === s.length; } + // A transformation context that won't perform parenthesization, as some parenthesization rules + // are more aggressive than is strictly necessary. + const textChangesTransformationContext: TransformationContext = { + ...nullTransformationContext, + factory: createNodeFactory( + nullTransformationContext.factory.flags | NodeFactoryFlags.NoParenthesizerRules, + nullTransformationContext.factory.baseFactory), + }; + export function assignPositionsToNode(node: Node): Node { - const visited = visitEachChild(node, assignPositionsToNode, nullTransformationContext, assignPositionsToNodeArray, assignPositionsToNode); + const visited = visitEachChild(node, assignPositionsToNode, textChangesTransformationContext, assignPositionsToNodeArray, assignPositionsToNode); // create proxy node for non synthesized nodes const newNode = nodeIsSynthesized(visited) ? visited : Object.create(visited) as Node; setTextRangePosEnd(newNode, getPos(node), getEnd(node)); diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json index 6753df2cc06..9f308351045 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json @@ -12,5 +12,6 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 1 - } + }, + "postfix": false } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json index e579a0db6e3..0b4718e71ac 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json @@ -12,5 +12,6 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 1 - } + }, + "postfix": true } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json index bdc4edb280e..17b7fa941cc 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json @@ -12,5 +12,6 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 1 - } + }, + "postfix": false } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json index 44f20173cd3..76313b04a41 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json @@ -12,5 +12,6 @@ "flags": "JSDoc", "modifierFlagsCache": 0, "transformFlags": 1 - } + }, + "postfix": true } \ No newline at end of file diff --git a/tests/baselines/reference/ambientConstLiterals.types b/tests/baselines/reference/ambientConstLiterals.types index 664e730dd63..2f7e3b678b0 100644 --- a/tests/baselines/reference/ambientConstLiterals.types +++ b/tests/baselines/reference/ambientConstLiterals.types @@ -12,7 +12,7 @@ enum E { A, B, C, "non identifier" } >A : E.A >B : E.B >C : E.C ->"non identifier" : typeof E["non identifier"] +>"non identifier" : (typeof E)["non identifier"] const c1 = "abc"; >c1 : "abc" @@ -54,8 +54,8 @@ const c8 = E.A; >A : E.A const c8b = E["non identifier"]; ->c8b : typeof E["non identifier"] ->E["non identifier"] : typeof E["non identifier"] +>c8b : (typeof E)["non identifier"] +>E["non identifier"] : (typeof E)["non identifier"] >E : typeof E >"non identifier" : "non identifier" diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index ce6ba3b45cc..85204ebc69e 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -523,16 +523,17 @@ declare namespace ts { YieldContext = 8192, DecoratorContext = 16384, AwaitContext = 32768, - ThisNodeHasError = 65536, - JavaScriptFile = 131072, - ThisNodeOrAnySubNodesHasError = 262144, - HasAggregatedChildData = 524288, - JSDoc = 4194304, - JsonFile = 33554432, + DisallowConditionalTypesContext = 65536, + ThisNodeHasError = 131072, + JavaScriptFile = 262144, + ThisNodeOrAnySubNodesHasError = 524288, + HasAggregatedChildData = 1048576, + JSDoc = 8388608, + JsonFile = 67108864, BlockScoped = 3, ReachabilityCheckFlags = 768, ReachabilityAndEmitFlags = 2816, - ContextFlags = 25358336, + ContextFlags = 50720768, TypeExcludesFlags = 40960, } export enum ModifierFlags { @@ -1805,10 +1806,12 @@ declare namespace ts { export interface JSDocNonNullableType extends JSDocType { readonly kind: SyntaxKind.JSDocNonNullableType; readonly type: TypeNode; + readonly postfix: boolean; } export interface JSDocNullableType extends JSDocType { readonly kind: SyntaxKind.JSDocNullableType; readonly type: TypeNode; + readonly postfix: boolean; } export interface JSDocOptionalType extends JSDocType { readonly kind: SyntaxKind.JSDocOptionalType; @@ -3654,9 +3657,9 @@ declare namespace ts { updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference; createJSDocAllType(): JSDocAllType; createJSDocUnknownType(): JSDocUnknownType; - createJSDocNonNullableType(type: TypeNode): JSDocNonNullableType; + createJSDocNonNullableType(type: TypeNode, postfix?: boolean): JSDocNonNullableType; updateJSDocNonNullableType(node: JSDocNonNullableType, type: TypeNode): JSDocNonNullableType; - createJSDocNullableType(type: TypeNode): JSDocNullableType; + createJSDocNullableType(type: TypeNode, postfix?: boolean): JSDocNullableType; updateJSDocNullableType(node: JSDocNullableType, type: TypeNode): JSDocNullableType; createJSDocOptionalType(type: TypeNode): JSDocOptionalType; updateJSDocOptionalType(node: JSDocOptionalType, type: TypeNode): JSDocOptionalType; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index c225bd3a9fe..d97c42d74ea 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -523,16 +523,17 @@ declare namespace ts { YieldContext = 8192, DecoratorContext = 16384, AwaitContext = 32768, - ThisNodeHasError = 65536, - JavaScriptFile = 131072, - ThisNodeOrAnySubNodesHasError = 262144, - HasAggregatedChildData = 524288, - JSDoc = 4194304, - JsonFile = 33554432, + DisallowConditionalTypesContext = 65536, + ThisNodeHasError = 131072, + JavaScriptFile = 262144, + ThisNodeOrAnySubNodesHasError = 524288, + HasAggregatedChildData = 1048576, + JSDoc = 8388608, + JsonFile = 67108864, BlockScoped = 3, ReachabilityCheckFlags = 768, ReachabilityAndEmitFlags = 2816, - ContextFlags = 25358336, + ContextFlags = 50720768, TypeExcludesFlags = 40960, } export enum ModifierFlags { @@ -1805,10 +1806,12 @@ declare namespace ts { export interface JSDocNonNullableType extends JSDocType { readonly kind: SyntaxKind.JSDocNonNullableType; readonly type: TypeNode; + readonly postfix: boolean; } export interface JSDocNullableType extends JSDocType { readonly kind: SyntaxKind.JSDocNullableType; readonly type: TypeNode; + readonly postfix: boolean; } export interface JSDocOptionalType extends JSDocType { readonly kind: SyntaxKind.JSDocOptionalType; @@ -3654,9 +3657,9 @@ declare namespace ts { updateExternalModuleReference(node: ExternalModuleReference, expression: Expression): ExternalModuleReference; createJSDocAllType(): JSDocAllType; createJSDocUnknownType(): JSDocUnknownType; - createJSDocNonNullableType(type: TypeNode): JSDocNonNullableType; + createJSDocNonNullableType(type: TypeNode, postfix?: boolean): JSDocNonNullableType; updateJSDocNonNullableType(node: JSDocNonNullableType, type: TypeNode): JSDocNonNullableType; - createJSDocNullableType(type: TypeNode): JSDocNullableType; + createJSDocNullableType(type: TypeNode, postfix?: boolean): JSDocNullableType; updateJSDocNullableType(node: JSDocNullableType, type: TypeNode): JSDocNullableType; createJSDocOptionalType(type: TypeNode): JSDocOptionalType; updateJSDocOptionalType(node: JSDocOptionalType, type: TypeNode): JSDocOptionalType; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types index 8400808656b..3ecc4a705a2 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types +++ b/tests/baselines/reference/bitwiseNotOperatorWithEnumType.types @@ -5,7 +5,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // enum type var var ResultIsNumber1 = ~ENUM1; diff --git a/tests/baselines/reference/constEnums.types b/tests/baselines/reference/constEnums.types index cee4da5c2e1..a5b83c46a4e 100644 --- a/tests/baselines/reference/constEnums.types +++ b/tests/baselines/reference/constEnums.types @@ -184,25 +184,25 @@ const enum Comments { >Comments : Comments "//", ->"//" : typeof Comments["//"] +>"//" : (typeof Comments)["//"] "/*", ->"/*" : typeof Comments["/*"] +>"/*" : (typeof Comments)["/*"] "*/", ->"*/" : typeof Comments["*/"] +>"*/" : (typeof Comments)["*/"] "///", ->"///" : typeof Comments["///"] +>"///" : (typeof Comments)["///"] "#", ->"#" : typeof Comments["#"] +>"#" : (typeof Comments)["#"] "", ->"-->" : typeof Comments["-->"] +>"-->" : (typeof Comments)["-->"] } module A { @@ -624,37 +624,37 @@ function baz(c: Comments) { >c : Comments case Comments["//"]: ->Comments["//"] : typeof Comments["//"] +>Comments["//"] : (typeof Comments)["//"] >Comments : typeof Comments >"//" : "//" case Comments["/*"]: ->Comments["/*"] : typeof Comments["/*"] +>Comments["/*"] : (typeof Comments)["/*"] >Comments : typeof Comments >"/*" : "/*" case Comments["*/"]: ->Comments["*/"] : typeof Comments["*/"] +>Comments["*/"] : (typeof Comments)["*/"] >Comments : typeof Comments >"*/" : "*/" case Comments["///"]: ->Comments["///"] : typeof Comments["///"] +>Comments["///"] : (typeof Comments)["///"] >Comments : typeof Comments >"///" : "///" case Comments["#"]: ->Comments["#"] : typeof Comments["#"] +>Comments["#"] : (typeof Comments)["#"] >Comments : typeof Comments >"#" : "#" case Comments[""]: ->Comments["-->"] : typeof Comments["-->"] +>Comments["-->"] : (typeof Comments)["-->"] >Comments : typeof Comments >"-->" : "-->" diff --git a/tests/baselines/reference/declFileEnums.types b/tests/baselines/reference/declFileEnums.types index ef3b86f95c4..a756898784e 100644 --- a/tests/baselines/reference/declFileEnums.types +++ b/tests/baselines/reference/declFileEnums.types @@ -83,7 +83,7 @@ enum e5 { >"Sunday" : e5.Sunday "Weekend days" ->"Weekend days" : typeof e5["Weekend days"] +>"Weekend days" : (typeof e5)["Weekend days"] } diff --git a/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.js b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.js index d24b12c25ff..8ae33d5edd4 100644 --- a/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.js +++ b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.js @@ -42,12 +42,12 @@ declare enum AgeGroups { } export declare const SpotifyAgeGroupEnum: { [x: number]: string; - "0-17": typeof AgeGroups["0-17"]; - "18-22": typeof AgeGroups["18-22"]; - "23-27": typeof AgeGroups["23-27"]; - "28-34": typeof AgeGroups["28-34"]; - "35-44": typeof AgeGroups["35-44"]; - "45-59": typeof AgeGroups["45-59"]; - "60-150": typeof AgeGroups["60-150"]; + "0-17": (typeof AgeGroups)["0-17"]; + "18-22": (typeof AgeGroups)["18-22"]; + "23-27": (typeof AgeGroups)["23-27"]; + "28-34": (typeof AgeGroups)["28-34"]; + "35-44": (typeof AgeGroups)["35-44"]; + "45-59": (typeof AgeGroups)["45-59"]; + "60-150": (typeof AgeGroups)["60-150"]; }; export {}; diff --git a/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.types b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.types index 82c31d18e68..7124555580f 100644 --- a/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.types +++ b/tests/baselines/reference/declarationEmitSpreadStringlyKeyedEnum.types @@ -1,16 +1,16 @@ === tests/cases/compiler/declarationEmitSpreadStringlyKeyedEnum.ts === enum AgeGroups { "0-17" , "18-22" , "23-27" , "28-34" , "35-44" , "45-59" , "60-150" } >AgeGroups : AgeGroups ->"0-17" : typeof AgeGroups["0-17"] ->"18-22" : typeof AgeGroups["18-22"] ->"23-27" : typeof AgeGroups["23-27"] ->"28-34" : typeof AgeGroups["28-34"] ->"35-44" : typeof AgeGroups["35-44"] ->"45-59" : typeof AgeGroups["45-59"] ->"60-150" : typeof AgeGroups["60-150"] +>"0-17" : (typeof AgeGroups)["0-17"] +>"18-22" : (typeof AgeGroups)["18-22"] +>"23-27" : (typeof AgeGroups)["23-27"] +>"28-34" : (typeof AgeGroups)["28-34"] +>"35-44" : (typeof AgeGroups)["35-44"] +>"45-59" : (typeof AgeGroups)["45-59"] +>"60-150" : (typeof AgeGroups)["60-150"] export const SpotifyAgeGroupEnum = { ...AgeGroups }; ->SpotifyAgeGroupEnum : { [x: number]: string; "0-17": typeof AgeGroups["0-17"]; "18-22": typeof AgeGroups["18-22"]; "23-27": typeof AgeGroups["23-27"]; "28-34": typeof AgeGroups["28-34"]; "35-44": typeof AgeGroups["35-44"]; "45-59": typeof AgeGroups["45-59"]; "60-150": typeof AgeGroups["60-150"]; } ->{ ...AgeGroups } : { [x: number]: string; "0-17": typeof AgeGroups["0-17"]; "18-22": typeof AgeGroups["18-22"]; "23-27": typeof AgeGroups["23-27"]; "28-34": typeof AgeGroups["28-34"]; "35-44": typeof AgeGroups["35-44"]; "45-59": typeof AgeGroups["45-59"]; "60-150": typeof AgeGroups["60-150"]; } +>SpotifyAgeGroupEnum : { [x: number]: string; "0-17": (typeof AgeGroups)["0-17"]; "18-22": (typeof AgeGroups)["18-22"]; "23-27": (typeof AgeGroups)["23-27"]; "28-34": (typeof AgeGroups)["28-34"]; "35-44": (typeof AgeGroups)["35-44"]; "45-59": (typeof AgeGroups)["45-59"]; "60-150": (typeof AgeGroups)["60-150"]; } +>{ ...AgeGroups } : { [x: number]: string; "0-17": (typeof AgeGroups)["0-17"]; "18-22": (typeof AgeGroups)["18-22"]; "23-27": (typeof AgeGroups)["23-27"]; "28-34": (typeof AgeGroups)["28-34"]; "35-44": (typeof AgeGroups)["35-44"]; "45-59": (typeof AgeGroups)["45-59"]; "60-150": (typeof AgeGroups)["60-150"]; } >AgeGroups : typeof AgeGroups diff --git a/tests/baselines/reference/decrementOperatorWithEnumType.types b/tests/baselines/reference/decrementOperatorWithEnumType.types index 81f2a638fb4..45b86f2d2fa 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumType.types +++ b/tests/baselines/reference/decrementOperatorWithEnumType.types @@ -5,7 +5,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // expression var ResultIsNumber1 = --ENUM1["A"]; diff --git a/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.types b/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.types index 1e469c9312c..3f25332999c 100644 --- a/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.types +++ b/tests/baselines/reference/decrementOperatorWithEnumTypeInvalidOperations.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // enum type var var ResultIsNumber1 = --ENUM; diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.types b/tests/baselines/reference/deleteOperatorWithEnumType.types index 1ba8b696c5e..143bbda531a 100644 --- a/tests/baselines/reference/deleteOperatorWithEnumType.types +++ b/tests/baselines/reference/deleteOperatorWithEnumType.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // enum type var var ResultIsBoolean1 = delete ENUM; diff --git a/tests/baselines/reference/doubleUnderscoreEnumEmit.types b/tests/baselines/reference/doubleUnderscoreEnumEmit.types index 16690df1086..c1758414f1f 100644 --- a/tests/baselines/reference/doubleUnderscoreEnumEmit.types +++ b/tests/baselines/reference/doubleUnderscoreEnumEmit.types @@ -7,11 +7,11 @@ enum Foo { >1 : 1 "(Anonymous function)" = 2, ->"(Anonymous function)" : typeof Foo["(Anonymous function)"] +>"(Anonymous function)" : (typeof Foo)["(Anonymous function)"] >2 : 2 "(Anonymous class)" = 4, ->"(Anonymous class)" : typeof Foo["(Anonymous class)"] +>"(Anonymous class)" : (typeof Foo)["(Anonymous class)"] >4 : 4 "__call" = 10 diff --git a/tests/baselines/reference/enumErrors.types b/tests/baselines/reference/enumErrors.types index 05a74414ef0..5888e0e3e67 100644 --- a/tests/baselines/reference/enumErrors.types +++ b/tests/baselines/reference/enumErrors.types @@ -132,11 +132,11 @@ enum E13 { postColonValueComma: 2, >postColonValueComma : E13.postColonValueComma ->2 : typeof E13["2"] +>2 : (typeof E13)["2"] postColonValueSemicolon: 3; >postColonValueSemicolon : E13.postColonValueSemicolon ->3 : typeof E13["3"] +>3 : (typeof E13)["3"] }; @@ -146,7 +146,7 @@ enum E14 { a, b: any "hello" += 1, c, d} >b : E14.b >any : E14.any >"hello" : E14.hello ->1 : typeof E14["1"] +>1 : (typeof E14)["1"] >c : E14.c >d : E14.d diff --git a/tests/baselines/reference/enumIdentifierLiterals.types b/tests/baselines/reference/enumIdentifierLiterals.types index 7d5463c3740..e37e8f3a159 100644 --- a/tests/baselines/reference/enumIdentifierLiterals.types +++ b/tests/baselines/reference/enumIdentifierLiterals.types @@ -3,17 +3,17 @@ enum Nums { >Nums : Nums 1.0, ->1.0 : typeof Nums["1"] +>1.0 : (typeof Nums)["1"] 11e-1, ->11e-1 : typeof Nums["1.1"] +>11e-1 : (typeof Nums)["1.1"] 0.12e1, ->0.12e1 : typeof Nums["1.2"] +>0.12e1 : (typeof Nums)["1.2"] "13e-1", ->"13e-1" : typeof Nums["13e-1"] +>"13e-1" : (typeof Nums)["13e-1"] 0xF00D ->0xF00D : typeof Nums["61453"] +>0xF00D : (typeof Nums)["61453"] } diff --git a/tests/baselines/reference/enumWithNegativeInfinityProperty.types b/tests/baselines/reference/enumWithNegativeInfinityProperty.types index b1cbe05f53e..3a795236c47 100644 --- a/tests/baselines/reference/enumWithNegativeInfinityProperty.types +++ b/tests/baselines/reference/enumWithNegativeInfinityProperty.types @@ -3,7 +3,7 @@ enum A { >A : A "-Infinity" = 1 ->"-Infinity" : typeof A["-Infinity"] +>"-Infinity" : (typeof A)["-Infinity"] >1 : 1 } diff --git a/tests/baselines/reference/enumWithQuotedElementName1.types b/tests/baselines/reference/enumWithQuotedElementName1.types index b3b708184ae..2fd0e3f442c 100644 --- a/tests/baselines/reference/enumWithQuotedElementName1.types +++ b/tests/baselines/reference/enumWithQuotedElementName1.types @@ -3,5 +3,5 @@ enum E { >E : E 'fo"o', ->'fo"o' : typeof E["fo\"o"] +>'fo"o' : (typeof E)["fo\"o"] } diff --git a/tests/baselines/reference/enumWithQuotedElementName2.types b/tests/baselines/reference/enumWithQuotedElementName2.types index 67fa731e88c..ce871d05352 100644 --- a/tests/baselines/reference/enumWithQuotedElementName2.types +++ b/tests/baselines/reference/enumWithQuotedElementName2.types @@ -3,5 +3,5 @@ enum E { >E : E "fo'o", ->"fo'o" : typeof E["fo'o"] +>"fo'o" : (typeof E)["fo'o"] } diff --git a/tests/baselines/reference/enumWithUnicodeEscape1.types b/tests/baselines/reference/enumWithUnicodeEscape1.types index 701f0f9bd3b..e33394fba31 100644 --- a/tests/baselines/reference/enumWithUnicodeEscape1.types +++ b/tests/baselines/reference/enumWithUnicodeEscape1.types @@ -3,6 +3,6 @@ enum E { >E : E 'gold \u2730' ->'gold \u2730' : typeof E["gold \u2730"] +>'gold \u2730' : (typeof E)["gold \u2730"] } diff --git a/tests/baselines/reference/incrementOperatorWithEnumType.types b/tests/baselines/reference/incrementOperatorWithEnumType.types index deb056503a6..6c7c1720bf6 100644 --- a/tests/baselines/reference/incrementOperatorWithEnumType.types +++ b/tests/baselines/reference/incrementOperatorWithEnumType.types @@ -5,7 +5,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // expression var ResultIsNumber1 = ++ENUM1["B"]; diff --git a/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.types b/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.types index d4458ca41bb..5c33351ea23 100644 --- a/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.types +++ b/tests/baselines/reference/incrementOperatorWithEnumTypeInvalidOperations.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // enum type var var ResultIsNumber1 = ++ENUM; diff --git a/tests/baselines/reference/inferTypes1.errors.txt b/tests/baselines/reference/inferTypes1.errors.txt index be2fa68bfbb..277f3e912d2 100644 --- a/tests/baselines/reference/inferTypes1.errors.txt +++ b/tests/baselines/reference/inferTypes1.errors.txt @@ -8,9 +8,9 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(55,25): error TS2344: T tests/cases/conformance/types/conditional/inferTypes1.ts(56,25): error TS2344: Type 'Function' does not satisfy the constraint '(x: any) => any'. Type 'Function' provides no match for the signature '(x: any): any'. tests/cases/conformance/types/conditional/inferTypes1.ts(82,12): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. -tests/cases/conformance/types/conditional/inferTypes1.ts(83,15): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. -tests/cases/conformance/types/conditional/inferTypes1.ts(83,41): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. -tests/cases/conformance/types/conditional/inferTypes1.ts(83,51): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. +tests/cases/conformance/types/conditional/inferTypes1.ts(83,16): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. +tests/cases/conformance/types/conditional/inferTypes1.ts(83,43): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. +tests/cases/conformance/types/conditional/inferTypes1.ts(83,53): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. tests/cases/conformance/types/conditional/inferTypes1.ts(84,15): error TS2304: Cannot find name 'U'. tests/cases/conformance/types/conditional/inferTypes1.ts(84,15): error TS4081: Exported type alias 'T62' has or is using private name 'U'. tests/cases/conformance/types/conditional/inferTypes1.ts(84,43): error TS2304: Cannot find name 'U'. @@ -120,12 +120,12 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(153,40): error TS2322: type T60 = infer U; // Error ~~~~~~~ !!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - type T61 = infer A extends infer B ? infer C : infer D; // Error - ~~~~~~~ + type T61 = (infer A) extends infer B ? infer C : infer D; // Error + ~~~~~~~ !!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - ~~~~~~~ + ~~~~~~~ !!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. - ~~~~~~~ + ~~~~~~~ !!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type. type T62 = U extends (infer U)[] ? U : U; // Error ~ @@ -136,7 +136,7 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(153,40): error TS2322: !!! error TS2304: Cannot find name 'U'. ~ !!! error TS4081: Exported type alias 'T62' has or is using private name 'U'. - type T63 = T extends (infer A extends infer B ? infer C : infer D) ? string : number; + type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; type T70 = { x: T }; type T71 = T extends T70 ? T70 : never; diff --git a/tests/baselines/reference/inferTypes1.js b/tests/baselines/reference/inferTypes1.js index e3e2b88dd4e..35421c73ad2 100644 --- a/tests/baselines/reference/inferTypes1.js +++ b/tests/baselines/reference/inferTypes1.js @@ -81,9 +81,9 @@ type T53 = X3<{ a: (x: number) => void, b: (x: string) => void }>; // never type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number type T60 = infer U; // Error -type T61 = infer A extends infer B ? infer C : infer D; // Error +type T61 = (infer A) extends infer B ? infer C : infer D; // Error type T62 = U extends (infer U)[] ? U : U; // Error -type T63 = T extends (infer A extends infer B ? infer C : infer D) ? string : number; +type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; type T70 = { x: T }; type T71 = T extends T70 ? T70 : never; diff --git a/tests/baselines/reference/inferTypes1.symbols b/tests/baselines/reference/inferTypes1.symbols index 7e798851840..33d8052a8c7 100644 --- a/tests/baselines/reference/inferTypes1.symbols +++ b/tests/baselines/reference/inferTypes1.symbols @@ -349,33 +349,33 @@ type T60 = infer U; // Error >T60 : Symbol(T60, Decl(inferTypes1.ts, 79, 57)) >U : Symbol(U, Decl(inferTypes1.ts, 81, 16)) -type T61 = infer A extends infer B ? infer C : infer D; // Error +type T61 = (infer A) extends infer B ? infer C : infer D; // Error >T61 : Symbol(T61, Decl(inferTypes1.ts, 81, 19)) >T : Symbol(T, Decl(inferTypes1.ts, 82, 9)) ->A : Symbol(A, Decl(inferTypes1.ts, 82, 19)) ->B : Symbol(B, Decl(inferTypes1.ts, 82, 35)) ->C : Symbol(C, Decl(inferTypes1.ts, 82, 45)) ->D : Symbol(D, Decl(inferTypes1.ts, 82, 55)) +>A : Symbol(A, Decl(inferTypes1.ts, 82, 20)) +>B : Symbol(B, Decl(inferTypes1.ts, 82, 37)) +>C : Symbol(C, Decl(inferTypes1.ts, 82, 47)) +>D : Symbol(D, Decl(inferTypes1.ts, 82, 57)) type T62 = U extends (infer U)[] ? U : U; // Error ->T62 : Symbol(T62, Decl(inferTypes1.ts, 82, 58)) +>T62 : Symbol(T62, Decl(inferTypes1.ts, 82, 60)) >T : Symbol(T, Decl(inferTypes1.ts, 83, 9)) >U : Symbol(U) >U : Symbol(U, Decl(inferTypes1.ts, 83, 30)) >U : Symbol(U, Decl(inferTypes1.ts, 83, 30)) >U : Symbol(U) -type T63 = T extends (infer A extends infer B ? infer C : infer D) ? string : number; +type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; >T63 : Symbol(T63, Decl(inferTypes1.ts, 83, 44)) >T : Symbol(T, Decl(inferTypes1.ts, 84, 9)) >T : Symbol(T, Decl(inferTypes1.ts, 84, 9)) ->A : Symbol(A, Decl(inferTypes1.ts, 84, 30)) ->B : Symbol(B, Decl(inferTypes1.ts, 84, 46)) ->C : Symbol(C, Decl(inferTypes1.ts, 84, 56)) ->D : Symbol(D, Decl(inferTypes1.ts, 84, 66)) +>A : Symbol(A, Decl(inferTypes1.ts, 84, 31)) +>B : Symbol(B, Decl(inferTypes1.ts, 84, 48)) +>C : Symbol(C, Decl(inferTypes1.ts, 84, 58)) +>D : Symbol(D, Decl(inferTypes1.ts, 84, 68)) type T70 = { x: T }; ->T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 88)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 90)) >T : Symbol(T, Decl(inferTypes1.ts, 86, 9)) >x : Symbol(x, Decl(inferTypes1.ts, 86, 30)) >T : Symbol(T, Decl(inferTypes1.ts, 86, 9)) @@ -384,9 +384,9 @@ type T71 = T extends T70 ? T70 : never; >T71 : Symbol(T71, Decl(inferTypes1.ts, 86, 38)) >T : Symbol(T, Decl(inferTypes1.ts, 87, 9)) >T : Symbol(T, Decl(inferTypes1.ts, 87, 9)) ->T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 88)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 90)) >U : Symbol(U, Decl(inferTypes1.ts, 87, 33)) ->T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 88)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 90)) >U : Symbol(U, Decl(inferTypes1.ts, 87, 33)) type T72 = { y: T }; @@ -401,7 +401,7 @@ type T73 = T extends T72 ? T70 : never; // Error >T : Symbol(T, Decl(inferTypes1.ts, 90, 9)) >T72 : Symbol(T72, Decl(inferTypes1.ts, 87, 54)) >U : Symbol(U, Decl(inferTypes1.ts, 90, 33)) ->T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 88)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 90)) >U : Symbol(U, Decl(inferTypes1.ts, 90, 33)) type T74 = { x: T, y: U }; @@ -420,7 +420,7 @@ type T75 = T extends T74 ? T70 | T72 | T74 : ne >T74 : Symbol(T74, Decl(inferTypes1.ts, 90, 54)) >U : Symbol(U, Decl(inferTypes1.ts, 93, 33), Decl(inferTypes1.ts, 93, 42)) >U : Symbol(U, Decl(inferTypes1.ts, 93, 33), Decl(inferTypes1.ts, 93, 42)) ->T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 88)) +>T70 : Symbol(T70, Decl(inferTypes1.ts, 84, 90)) >U : Symbol(U, Decl(inferTypes1.ts, 93, 33), Decl(inferTypes1.ts, 93, 42)) >T72 : Symbol(T72, Decl(inferTypes1.ts, 87, 54)) >U : Symbol(U, Decl(inferTypes1.ts, 93, 33), Decl(inferTypes1.ts, 93, 42)) diff --git a/tests/baselines/reference/inferTypes1.types b/tests/baselines/reference/inferTypes1.types index 4ef817304b4..c7a609b3eae 100644 --- a/tests/baselines/reference/inferTypes1.types +++ b/tests/baselines/reference/inferTypes1.types @@ -253,13 +253,13 @@ type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number type T60 = infer U; // Error >T60 : U -type T61 = infer A extends infer B ? infer C : infer D; // Error +type T61 = (infer A) extends infer B ? infer C : infer D; // Error >T61 : T61 type T62 = U extends (infer U)[] ? U : U; // Error >T62 : any -type T63 = T extends (infer A extends infer B ? infer C : infer D) ? string : number; +type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; >T63 : T63 type T70 = { x: T }; diff --git a/tests/baselines/reference/inferTypesWithExtends1.js b/tests/baselines/reference/inferTypesWithExtends1.js new file mode 100644 index 00000000000..6ce07398723 --- /dev/null +++ b/tests/baselines/reference/inferTypesWithExtends1.js @@ -0,0 +1,298 @@ +//// [inferTypesWithExtends1.ts] +// infer to tuple element +type X1 = + T extends [infer U extends string] ? ["string", U] : + T extends [infer U extends number] ? ["number", U] : + never; + +type X1_T1 = X1<["a"]>; // ["string", "a"] +type X1_T2 = X1<[1]>; // ["number", 1] +type X1_T3 = X1<[object]>; // never + +// infer to argument +type X2 void> = + T extends (a: infer U extends string) => void ? ["string", U] : + T extends (a: infer U extends number) => void ? ["number", U] : + never; + +type X2_T1 = X2<(a: "a") => void>; // ["string", "a"] +type X2_T2 = X2<(a: 1) => void>; // ["number", 1] +type X2_T3 = X2<(a: object) => void>; // never + +// infer to return type +type X3 any> = + T extends (...args: any[]) => (infer U extends string) ? ["string", U] : + T extends (...args: any[]) => (infer U extends number) ? ["number", U] : + never; + +type X3_T1 = X3<() => "a">; // ["string", "a"] +type X3_T2 = X3<() => 1>; // ["number", 1] +type X3_T3 = X3<() => object>; // never + +// infer to instance type +type X4 any> = + T extends new (...args: any[]) => (infer U extends { a: string }) ? ["string", U] : + T extends new (...args: any[]) => (infer U extends { a: number }) ? ["number", U] : + never; + +type X4_T1 = X4 { a: "a" }>; // ["string", { a: "a" }] +type X4_T2 = X4 { a: 1 }>; // ["number", { a: 1 }] +type X4_T3 = X4 { a: object }>; // never + +// infer to type argument +type X5 = + T extends Promise ? ["string", U] : + T extends Promise ? ["number", U] : + never; + +type X5_T1 = X5>; // ["string", "a" | "b"] +type X5_T2 = X5>; // ["number", 1 | 2] +type X5_T3 = X5>; // never + +// infer to property type +type X6 = + T extends { a: infer U extends string } ? ["string", U] : + T extends { a: infer U extends number } ? ["number", U] : + never; + +type X6_T1 = X6<{ a: "a" }>; // ["string", "a"] +type X6_T2 = X6<{ a: 1 }>; // ["number", 1] +type X6_T3 = X6<{ a: object }>; // never + +// infer twice with same constraint +type X7 = + T extends { a: infer U extends string, b: infer U extends string } ? ["string", U] : + T extends { a: infer U extends number, b: infer U extends number } ? ["number", U] : + never; + +type X7_T1 = X7<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +type X7_T2 = X7<{ a: 1, b: 2 }>; // ["number", 1 | 2] +type X7_T3 = X7<{ a: object, b: object }>; // never +type X7_T4 = X7<{ a: "a", b: 1 }>; // never + +// infer twice with missing second constraint (same behavior as class/interface) +type X8 = + T extends { a: infer U extends string, b: infer U } ? ["string", U] : + T extends { a: infer U extends number, b: infer U } ? ["number", U] : + never; + +type X8_T1 = X8<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +type X8_T2 = X8<{ a: 1, b: 2 }>; // ["number", 1 | 2] +type X8_T3 = X8<{ a: object, b: object }>; // never +type X8_T4 = X8<{ a: "a", b: 1 }>; // never + +// infer twice with missing first constraint (same behavior as class/interface) +type X9 = + T extends { a: infer U, b: infer U extends string } ? ["string", U] : + T extends { a: infer U, b: infer U extends number } ? ["number", U] : + never; + +type X9_T1 = X9<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +type X9_T2 = X9<{ a: 1, b: 2 }>; // ["number", 1 | 2] +type X9_T3 = X9<{ a: object, b: object }>; // never +type X9_T4 = X9<{ a: "a", b: 1 }>; // never + +// Speculative lookahead for `infer T extends U ?` +type X10 = T extends (infer U extends number ? 1 : 0) ? 1 : 0; // ok, parsed as conditional +type X10_Y1 = X10; +type X10_T1_T1 = X10_Y1; + +type X11 = T extends ((infer U) extends number ? 1 : 0) ? 1 : 0; // ok, parsed as conditional +type X12 = T extends (infer U extends number) ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +type X13 = T extends infer U extends number ? 1 : 0; // ok, parsed as `infer..extends` (conditional types not allowed in 'extends type') +type X14 = T extends keyof infer U extends number ? 1 : 0; // ok, parsed as `infer..extends` (precedence wouldn't have parsed the `?` as part of a type operator) +type X15 = T extends { [P in infer U extends keyof T ? 1 : 0]: 1; } ? 1 : 0; // ok, parsed as conditional +type X16 = T extends { [P in infer U extends keyof T]: 1; } ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +type X17 = T extends { [P in keyof T as infer U extends P ? 1 : 0]: 1; } ? 1 : 0; // ok, parsed as conditional +type X18 = T extends { [P in keyof T as infer U extends P]: 1; } ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) + +type X19 = T extends (infer U extends number) ? [T, U] : never; +type X19_T1 = X19<"a">; // never +type X19_T2 = X19<1>; // [1, 1] +type X19_T3 = X19<1 | "a">; // [1, 1] + +type X20 = T extends (infer U extends number) ? T extends (infer V extends U) ? [T, U, V] : never : never; +type X20_T1 = X20<1 | "a">; // [1, 1, 1] + +type X21 = T extends (infer U extends N) ? [T, U] : never; +type X21_T1 = X21<1, 1>; // [1, 1] +type X21_T2 = X21<1 | "a", 1>; // [1, 1] +type X21_T3 = X21<1 | 2, 1>; // [1, 1] +type X21_T4 = X21<1 | 2, 2 | 3>; // [2, 2] +type X21_T5 = X21<1 | 2, 3>; // never + +// from mongoose +type IfEquals = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +declare const x1: () => (T extends infer U extends number ? 1 : 0); +function f1() { + return x1; +} + +type ExpectNumber = T; +declare const x2: () => (T extends ExpectNumber ? 1 : 0); +function f2() { + return x2; +} + +//// [inferTypesWithExtends1.js] +"use strict"; +function f1() { + return x1; +} +function f2() { + return x2; +} + + +//// [inferTypesWithExtends1.d.ts] +declare type X1 = T extends [infer U extends string] ? ["string", U] : T extends [infer U extends number] ? ["number", U] : never; +declare type X1_T1 = X1<["a"]>; +declare type X1_T2 = X1<[1]>; +declare type X1_T3 = X1<[object]>; +declare type X2 void> = T extends (a: infer U extends string) => void ? ["string", U] : T extends (a: infer U extends number) => void ? ["number", U] : never; +declare type X2_T1 = X2<(a: "a") => void>; +declare type X2_T2 = X2<(a: 1) => void>; +declare type X2_T3 = X2<(a: object) => void>; +declare type X3 any> = T extends (...args: any[]) => (infer U extends string) ? ["string", U] : T extends (...args: any[]) => (infer U extends number) ? ["number", U] : never; +declare type X3_T1 = X3<() => "a">; +declare type X3_T2 = X3<() => 1>; +declare type X3_T3 = X3<() => object>; +declare type X4 any> = T extends new (...args: any[]) => (infer U extends { + a: string; +}) ? ["string", U] : T extends new (...args: any[]) => (infer U extends { + a: number; +}) ? ["number", U] : never; +declare type X4_T1 = X4 { + a: "a"; +}>; +declare type X4_T2 = X4 { + a: 1; +}>; +declare type X4_T3 = X4 { + a: object; +}>; +declare type X5 = T extends Promise ? ["string", U] : T extends Promise ? ["number", U] : never; +declare type X5_T1 = X5>; +declare type X5_T2 = X5>; +declare type X5_T3 = X5>; +declare type X6 = T extends { + a: infer U extends string; +} ? ["string", U] : T extends { + a: infer U extends number; +} ? ["number", U] : never; +declare type X6_T1 = X6<{ + a: "a"; +}>; +declare type X6_T2 = X6<{ + a: 1; +}>; +declare type X6_T3 = X6<{ + a: object; +}>; +declare type X7 = T extends { + a: infer U extends string; + b: infer U extends string; +} ? ["string", U] : T extends { + a: infer U extends number; + b: infer U extends number; +} ? ["number", U] : never; +declare type X7_T1 = X7<{ + a: "a"; + b: "b"; +}>; +declare type X7_T2 = X7<{ + a: 1; + b: 2; +}>; +declare type X7_T3 = X7<{ + a: object; + b: object; +}>; +declare type X7_T4 = X7<{ + a: "a"; + b: 1; +}>; +declare type X8 = T extends { + a: infer U extends string; + b: infer U; +} ? ["string", U] : T extends { + a: infer U extends number; + b: infer U; +} ? ["number", U] : never; +declare type X8_T1 = X8<{ + a: "a"; + b: "b"; +}>; +declare type X8_T2 = X8<{ + a: 1; + b: 2; +}>; +declare type X8_T3 = X8<{ + a: object; + b: object; +}>; +declare type X8_T4 = X8<{ + a: "a"; + b: 1; +}>; +declare type X9 = T extends { + a: infer U; + b: infer U extends string; +} ? ["string", U] : T extends { + a: infer U; + b: infer U extends number; +} ? ["number", U] : never; +declare type X9_T1 = X9<{ + a: "a"; + b: "b"; +}>; +declare type X9_T2 = X9<{ + a: 1; + b: 2; +}>; +declare type X9_T3 = X9<{ + a: object; + b: object; +}>; +declare type X9_T4 = X9<{ + a: "a"; + b: 1; +}>; +declare type X10 = T extends (infer U extends number ? 1 : 0) ? 1 : 0; +declare type X10_Y1 = X10; +declare type X10_T1_T1 = X10_Y1; +declare type X11 = T extends ((infer U) extends number ? 1 : 0) ? 1 : 0; +declare type X12 = T extends (infer U extends number) ? 1 : 0; +declare type X13 = T extends infer U extends number ? 1 : 0; +declare type X14 = T extends keyof infer U extends number ? 1 : 0; +declare type X15 = T extends { + [P in infer U extends keyof T ? 1 : 0]: 1; +} ? 1 : 0; +declare type X16 = T extends { + [P in infer U extends keyof T]: 1; +} ? 1 : 0; +declare type X17 = T extends { + [P in keyof T as infer U extends P ? 1 : 0]: 1; +} ? 1 : 0; +declare type X18 = T extends { + [P in keyof T as infer U extends P]: 1; +} ? 1 : 0; +declare type X19 = T extends (infer U extends number) ? [T, U] : never; +declare type X19_T1 = X19<"a">; +declare type X19_T2 = X19<1>; +declare type X19_T3 = X19<1 | "a">; +declare type X20 = T extends (infer U extends number) ? T extends (infer V extends U) ? [T, U, V] : never : never; +declare type X20_T1 = X20<1 | "a">; +declare type X21 = T extends (infer U extends N) ? [T, U] : never; +declare type X21_T1 = X21<1, 1>; +declare type X21_T2 = X21<1 | "a", 1>; +declare type X21_T3 = X21<1 | 2, 1>; +declare type X21_T4 = X21<1 | 2, 2 | 3>; +declare type X21_T5 = X21<1 | 2, 3>; +declare type IfEquals = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; +declare const x1: () => (T extends infer U extends number ? 1 : 0); +declare function f1(): () => T extends infer U extends number ? 1 : 0; +declare type ExpectNumber = T; +declare const x2: () => (T extends ExpectNumber ? 1 : 0); +declare function f2(): () => T extends infer U extends number ? 1 : 0; diff --git a/tests/baselines/reference/inferTypesWithExtends1.symbols b/tests/baselines/reference/inferTypesWithExtends1.symbols new file mode 100644 index 00000000000..01cdc578af5 --- /dev/null +++ b/tests/baselines/reference/inferTypesWithExtends1.symbols @@ -0,0 +1,531 @@ +=== tests/cases/conformance/types/conditional/inferTypesWithExtends1.ts === +// infer to tuple element +type X1 = +>X1 : Symbol(X1, Decl(inferTypesWithExtends1.ts, 0, 0)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 1, 8)) + + T extends [infer U extends string] ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 1, 8)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 2, 20)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 2, 20)) + + T extends [infer U extends number] ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 1, 8)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 3, 20)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 3, 20)) + + never; + +type X1_T1 = X1<["a"]>; // ["string", "a"] +>X1_T1 : Symbol(X1_T1, Decl(inferTypesWithExtends1.ts, 4, 10)) +>X1 : Symbol(X1, Decl(inferTypesWithExtends1.ts, 0, 0)) + +type X1_T2 = X1<[1]>; // ["number", 1] +>X1_T2 : Symbol(X1_T2, Decl(inferTypesWithExtends1.ts, 6, 23)) +>X1 : Symbol(X1, Decl(inferTypesWithExtends1.ts, 0, 0)) + +type X1_T3 = X1<[object]>; // never +>X1_T3 : Symbol(X1_T3, Decl(inferTypesWithExtends1.ts, 7, 21)) +>X1 : Symbol(X1, Decl(inferTypesWithExtends1.ts, 0, 0)) + +// infer to argument +type X2 void> = +>X2 : Symbol(X2, Decl(inferTypesWithExtends1.ts, 8, 26)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 11, 8)) +>args : Symbol(args, Decl(inferTypesWithExtends1.ts, 11, 19)) + + T extends (a: infer U extends string) => void ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 11, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 12, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 12, 23)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 12, 23)) + + T extends (a: infer U extends number) => void ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 11, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 13, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 13, 23)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 13, 23)) + + never; + +type X2_T1 = X2<(a: "a") => void>; // ["string", "a"] +>X2_T1 : Symbol(X2_T1, Decl(inferTypesWithExtends1.ts, 14, 10)) +>X2 : Symbol(X2, Decl(inferTypesWithExtends1.ts, 8, 26)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 16, 17)) + +type X2_T2 = X2<(a: 1) => void>; // ["number", 1] +>X2_T2 : Symbol(X2_T2, Decl(inferTypesWithExtends1.ts, 16, 34)) +>X2 : Symbol(X2, Decl(inferTypesWithExtends1.ts, 8, 26)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 17, 17)) + +type X2_T3 = X2<(a: object) => void>; // never +>X2_T3 : Symbol(X2_T3, Decl(inferTypesWithExtends1.ts, 17, 32)) +>X2 : Symbol(X2, Decl(inferTypesWithExtends1.ts, 8, 26)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 18, 17)) + +// infer to return type +type X3 any> = +>X3 : Symbol(X3, Decl(inferTypesWithExtends1.ts, 18, 37)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 21, 8)) +>args : Symbol(args, Decl(inferTypesWithExtends1.ts, 21, 19)) + + T extends (...args: any[]) => (infer U extends string) ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 21, 8)) +>args : Symbol(args, Decl(inferTypesWithExtends1.ts, 22, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 22, 40)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 22, 40)) + + T extends (...args: any[]) => (infer U extends number) ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 21, 8)) +>args : Symbol(args, Decl(inferTypesWithExtends1.ts, 23, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 23, 40)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 23, 40)) + + never; + +type X3_T1 = X3<() => "a">; // ["string", "a"] +>X3_T1 : Symbol(X3_T1, Decl(inferTypesWithExtends1.ts, 24, 10)) +>X3 : Symbol(X3, Decl(inferTypesWithExtends1.ts, 18, 37)) + +type X3_T2 = X3<() => 1>; // ["number", 1] +>X3_T2 : Symbol(X3_T2, Decl(inferTypesWithExtends1.ts, 26, 27)) +>X3 : Symbol(X3, Decl(inferTypesWithExtends1.ts, 18, 37)) + +type X3_T3 = X3<() => object>; // never +>X3_T3 : Symbol(X3_T3, Decl(inferTypesWithExtends1.ts, 27, 25)) +>X3 : Symbol(X3, Decl(inferTypesWithExtends1.ts, 18, 37)) + +// infer to instance type +type X4 any> = +>X4 : Symbol(X4, Decl(inferTypesWithExtends1.ts, 28, 30)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 31, 8)) +>args : Symbol(args, Decl(inferTypesWithExtends1.ts, 31, 23)) + + T extends new (...args: any[]) => (infer U extends { a: string }) ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 31, 8)) +>args : Symbol(args, Decl(inferTypesWithExtends1.ts, 32, 19)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 32, 44)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 32, 56)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 32, 44)) + + T extends new (...args: any[]) => (infer U extends { a: number }) ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 31, 8)) +>args : Symbol(args, Decl(inferTypesWithExtends1.ts, 33, 19)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 33, 44)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 33, 56)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 33, 44)) + + never; + +type X4_T1 = X4 { a: "a" }>; // ["string", { a: "a" }] +>X4_T1 : Symbol(X4_T1, Decl(inferTypesWithExtends1.ts, 34, 10)) +>X4 : Symbol(X4, Decl(inferTypesWithExtends1.ts, 28, 30)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 36, 27)) + +type X4_T2 = X4 { a: 1 }>; // ["number", { a: 1 }] +>X4_T2 : Symbol(X4_T2, Decl(inferTypesWithExtends1.ts, 36, 38)) +>X4 : Symbol(X4, Decl(inferTypesWithExtends1.ts, 28, 30)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 37, 27)) + +type X4_T3 = X4 { a: object }>; // never +>X4_T3 : Symbol(X4_T3, Decl(inferTypesWithExtends1.ts, 37, 36)) +>X4 : Symbol(X4, Decl(inferTypesWithExtends1.ts, 28, 30)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 38, 27)) + +// infer to type argument +type X5 = +>X5 : Symbol(X5, Decl(inferTypesWithExtends1.ts, 38, 41)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 41, 8)) + + T extends Promise ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 41, 8)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 42, 27)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 42, 27)) + + T extends Promise ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 41, 8)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 43, 27)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 43, 27)) + + never; + +type X5_T1 = X5>; // ["string", "a" | "b"] +>X5_T1 : Symbol(X5_T1, Decl(inferTypesWithExtends1.ts, 44, 10)) +>X5 : Symbol(X5, Decl(inferTypesWithExtends1.ts, 38, 41)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --)) + +type X5_T2 = X5>; // ["number", 1 | 2] +>X5_T2 : Symbol(X5_T2, Decl(inferTypesWithExtends1.ts, 46, 36)) +>X5 : Symbol(X5, Decl(inferTypesWithExtends1.ts, 38, 41)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --)) + +type X5_T3 = X5>; // never +>X5_T3 : Symbol(X5_T3, Decl(inferTypesWithExtends1.ts, 47, 32)) +>X5 : Symbol(X5, Decl(inferTypesWithExtends1.ts, 38, 41)) +>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --)) + +// infer to property type +type X6 = +>X6 : Symbol(X6, Decl(inferTypesWithExtends1.ts, 48, 34)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 51, 8)) + + T extends { a: infer U extends string } ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 51, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 52, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 52, 24)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 52, 24)) + + T extends { a: infer U extends number } ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 51, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 53, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 53, 24)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 53, 24)) + + never; + +type X6_T1 = X6<{ a: "a" }>; // ["string", "a"] +>X6_T1 : Symbol(X6_T1, Decl(inferTypesWithExtends1.ts, 54, 10)) +>X6 : Symbol(X6, Decl(inferTypesWithExtends1.ts, 48, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 56, 17)) + +type X6_T2 = X6<{ a: 1 }>; // ["number", 1] +>X6_T2 : Symbol(X6_T2, Decl(inferTypesWithExtends1.ts, 56, 28)) +>X6 : Symbol(X6, Decl(inferTypesWithExtends1.ts, 48, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 57, 17)) + +type X6_T3 = X6<{ a: object }>; // never +>X6_T3 : Symbol(X6_T3, Decl(inferTypesWithExtends1.ts, 57, 26)) +>X6 : Symbol(X6, Decl(inferTypesWithExtends1.ts, 48, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 58, 17)) + +// infer twice with same constraint +type X7 = +>X7 : Symbol(X7, Decl(inferTypesWithExtends1.ts, 58, 31)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 61, 8)) + + T extends { a: infer U extends string, b: infer U extends string } ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 61, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 62, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 62, 24), Decl(inferTypesWithExtends1.ts, 62, 51)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 62, 42)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 62, 24), Decl(inferTypesWithExtends1.ts, 62, 51)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 62, 24), Decl(inferTypesWithExtends1.ts, 62, 51)) + + T extends { a: infer U extends number, b: infer U extends number } ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 61, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 63, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 63, 24), Decl(inferTypesWithExtends1.ts, 63, 51)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 63, 42)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 63, 24), Decl(inferTypesWithExtends1.ts, 63, 51)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 63, 24), Decl(inferTypesWithExtends1.ts, 63, 51)) + + never; + +type X7_T1 = X7<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +>X7_T1 : Symbol(X7_T1, Decl(inferTypesWithExtends1.ts, 64, 10)) +>X7 : Symbol(X7, Decl(inferTypesWithExtends1.ts, 58, 31)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 66, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 66, 25)) + +type X7_T2 = X7<{ a: 1, b: 2 }>; // ["number", 1 | 2] +>X7_T2 : Symbol(X7_T2, Decl(inferTypesWithExtends1.ts, 66, 36)) +>X7 : Symbol(X7, Decl(inferTypesWithExtends1.ts, 58, 31)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 67, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 67, 23)) + +type X7_T3 = X7<{ a: object, b: object }>; // never +>X7_T3 : Symbol(X7_T3, Decl(inferTypesWithExtends1.ts, 67, 32)) +>X7 : Symbol(X7, Decl(inferTypesWithExtends1.ts, 58, 31)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 68, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 68, 28)) + +type X7_T4 = X7<{ a: "a", b: 1 }>; // never +>X7_T4 : Symbol(X7_T4, Decl(inferTypesWithExtends1.ts, 68, 42)) +>X7 : Symbol(X7, Decl(inferTypesWithExtends1.ts, 58, 31)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 69, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 69, 25)) + +// infer twice with missing second constraint (same behavior as class/interface) +type X8 = +>X8 : Symbol(X8, Decl(inferTypesWithExtends1.ts, 69, 34)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 72, 8)) + + T extends { a: infer U extends string, b: infer U } ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 72, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 73, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 73, 24), Decl(inferTypesWithExtends1.ts, 73, 51)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 73, 42)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 73, 24), Decl(inferTypesWithExtends1.ts, 73, 51)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 73, 24), Decl(inferTypesWithExtends1.ts, 73, 51)) + + T extends { a: infer U extends number, b: infer U } ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 72, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 74, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 74, 24), Decl(inferTypesWithExtends1.ts, 74, 51)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 74, 42)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 74, 24), Decl(inferTypesWithExtends1.ts, 74, 51)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 74, 24), Decl(inferTypesWithExtends1.ts, 74, 51)) + + never; + +type X8_T1 = X8<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +>X8_T1 : Symbol(X8_T1, Decl(inferTypesWithExtends1.ts, 75, 10)) +>X8 : Symbol(X8, Decl(inferTypesWithExtends1.ts, 69, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 77, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 77, 25)) + +type X8_T2 = X8<{ a: 1, b: 2 }>; // ["number", 1 | 2] +>X8_T2 : Symbol(X8_T2, Decl(inferTypesWithExtends1.ts, 77, 36)) +>X8 : Symbol(X8, Decl(inferTypesWithExtends1.ts, 69, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 78, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 78, 23)) + +type X8_T3 = X8<{ a: object, b: object }>; // never +>X8_T3 : Symbol(X8_T3, Decl(inferTypesWithExtends1.ts, 78, 32)) +>X8 : Symbol(X8, Decl(inferTypesWithExtends1.ts, 69, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 79, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 79, 28)) + +type X8_T4 = X8<{ a: "a", b: 1 }>; // never +>X8_T4 : Symbol(X8_T4, Decl(inferTypesWithExtends1.ts, 79, 42)) +>X8 : Symbol(X8, Decl(inferTypesWithExtends1.ts, 69, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 80, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 80, 25)) + +// infer twice with missing first constraint (same behavior as class/interface) +type X9 = +>X9 : Symbol(X9, Decl(inferTypesWithExtends1.ts, 80, 34)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 83, 8)) + + T extends { a: infer U, b: infer U extends string } ? ["string", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 83, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 84, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 84, 24), Decl(inferTypesWithExtends1.ts, 84, 36)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 84, 27)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 84, 24), Decl(inferTypesWithExtends1.ts, 84, 36)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 84, 24), Decl(inferTypesWithExtends1.ts, 84, 36)) + + T extends { a: infer U, b: infer U extends number } ? ["number", U] : +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 83, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 85, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 85, 24), Decl(inferTypesWithExtends1.ts, 85, 36)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 85, 27)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 85, 24), Decl(inferTypesWithExtends1.ts, 85, 36)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 85, 24), Decl(inferTypesWithExtends1.ts, 85, 36)) + + never; + +type X9_T1 = X9<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +>X9_T1 : Symbol(X9_T1, Decl(inferTypesWithExtends1.ts, 86, 10)) +>X9 : Symbol(X9, Decl(inferTypesWithExtends1.ts, 80, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 88, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 88, 25)) + +type X9_T2 = X9<{ a: 1, b: 2 }>; // ["number", 1 | 2] +>X9_T2 : Symbol(X9_T2, Decl(inferTypesWithExtends1.ts, 88, 36)) +>X9 : Symbol(X9, Decl(inferTypesWithExtends1.ts, 80, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 89, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 89, 23)) + +type X9_T3 = X9<{ a: object, b: object }>; // never +>X9_T3 : Symbol(X9_T3, Decl(inferTypesWithExtends1.ts, 89, 32)) +>X9 : Symbol(X9, Decl(inferTypesWithExtends1.ts, 80, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 90, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 90, 28)) + +type X9_T4 = X9<{ a: "a", b: 1 }>; // never +>X9_T4 : Symbol(X9_T4, Decl(inferTypesWithExtends1.ts, 90, 42)) +>X9 : Symbol(X9, Decl(inferTypesWithExtends1.ts, 80, 34)) +>a : Symbol(a, Decl(inferTypesWithExtends1.ts, 91, 17)) +>b : Symbol(b, Decl(inferTypesWithExtends1.ts, 91, 25)) + +// Speculative lookahead for `infer T extends U ?` +type X10 = T extends (infer U extends number ? 1 : 0) ? 1 : 0; // ok, parsed as conditional +>X10 : Symbol(X10, Decl(inferTypesWithExtends1.ts, 91, 34)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 94, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 94, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 94, 30)) + +type X10_Y1 = X10; +>X10_Y1 : Symbol(X10_Y1, Decl(inferTypesWithExtends1.ts, 94, 65)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 95, 12)) +>X10 : Symbol(X10, Decl(inferTypesWithExtends1.ts, 91, 34)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 95, 12)) + +type X10_T1_T1 = X10_Y1; +>X10_T1_T1 : Symbol(X10_T1_T1, Decl(inferTypesWithExtends1.ts, 95, 47)) +>X10_Y1 : Symbol(X10_Y1, Decl(inferTypesWithExtends1.ts, 94, 65)) + +type X11 = T extends ((infer U) extends number ? 1 : 0) ? 1 : 0; // ok, parsed as conditional +>X11 : Symbol(X11, Decl(inferTypesWithExtends1.ts, 96, 32)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 98, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 98, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 98, 31)) + +type X12 = T extends (infer U extends number) ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +>X12 : Symbol(X12, Decl(inferTypesWithExtends1.ts, 98, 67)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 99, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 99, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 99, 30)) + +type X13 = T extends infer U extends number ? 1 : 0; // ok, parsed as `infer..extends` (conditional types not allowed in 'extends type') +>X13 : Symbol(X13, Decl(inferTypesWithExtends1.ts, 99, 57)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 100, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 100, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 100, 29)) + +type X14 = T extends keyof infer U extends number ? 1 : 0; // ok, parsed as `infer..extends` (precedence wouldn't have parsed the `?` as part of a type operator) +>X14 : Symbol(X14, Decl(inferTypesWithExtends1.ts, 100, 55)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 101, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 101, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 101, 35)) + +type X15 = T extends { [P in infer U extends keyof T ? 1 : 0]: 1; } ? 1 : 0; // ok, parsed as conditional +>X15 : Symbol(X15, Decl(inferTypesWithExtends1.ts, 101, 61)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 102, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 102, 9)) +>P : Symbol(P, Decl(inferTypesWithExtends1.ts, 102, 27)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 102, 37)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 102, 9)) + +type X16 = T extends { [P in infer U extends keyof T]: 1; } ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +>X16 : Symbol(X16, Decl(inferTypesWithExtends1.ts, 102, 79)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 103, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 103, 9)) +>P : Symbol(P, Decl(inferTypesWithExtends1.ts, 103, 27)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 103, 37)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 103, 9)) + +type X17 = T extends { [P in keyof T as infer U extends P ? 1 : 0]: 1; } ? 1 : 0; // ok, parsed as conditional +>X17 : Symbol(X17, Decl(inferTypesWithExtends1.ts, 103, 71)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 104, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 104, 9)) +>P : Symbol(P, Decl(inferTypesWithExtends1.ts, 104, 27)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 104, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 104, 48)) +>P : Symbol(P, Decl(inferTypesWithExtends1.ts, 104, 27)) + +type X18 = T extends { [P in keyof T as infer U extends P]: 1; } ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +>X18 : Symbol(X18, Decl(inferTypesWithExtends1.ts, 104, 84)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 105, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 105, 9)) +>P : Symbol(P, Decl(inferTypesWithExtends1.ts, 105, 27)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 105, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 105, 48)) +>P : Symbol(P, Decl(inferTypesWithExtends1.ts, 105, 27)) + +type X19 = T extends (infer U extends number) ? [T, U] : never; +>X19 : Symbol(X19, Decl(inferTypesWithExtends1.ts, 105, 76)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 107, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 107, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 107, 54)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 107, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 107, 54)) + +type X19_T1 = X19<"a">; // never +>X19_T1 : Symbol(X19_T1, Decl(inferTypesWithExtends1.ts, 107, 90)) +>X19 : Symbol(X19, Decl(inferTypesWithExtends1.ts, 105, 76)) + +type X19_T2 = X19<1>; // [1, 1] +>X19_T2 : Symbol(X19_T2, Decl(inferTypesWithExtends1.ts, 108, 23)) +>X19 : Symbol(X19, Decl(inferTypesWithExtends1.ts, 105, 76)) + +type X19_T3 = X19<1 | "a">; // [1, 1] +>X19_T3 : Symbol(X19_T3, Decl(inferTypesWithExtends1.ts, 109, 21)) +>X19 : Symbol(X19, Decl(inferTypesWithExtends1.ts, 105, 76)) + +type X20 = T extends (infer U extends number) ? T extends (infer V extends U) ? [T, U, V] : never : never; +>X20 : Symbol(X20, Decl(inferTypesWithExtends1.ts, 110, 27)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 112, 9)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 112, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 112, 30)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 112, 9)) +>V : Symbol(V, Decl(inferTypesWithExtends1.ts, 112, 67)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 112, 30)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 112, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 112, 30)) +>V : Symbol(V, Decl(inferTypesWithExtends1.ts, 112, 67)) + +type X20_T1 = X20<1 | "a">; // [1, 1, 1] +>X20_T1 : Symbol(X20_T1, Decl(inferTypesWithExtends1.ts, 112, 109)) +>X20 : Symbol(X20, Decl(inferTypesWithExtends1.ts, 110, 27)) + +type X21 = T extends (infer U extends N) ? [T, U] : never; +>X21 : Symbol(X21, Decl(inferTypesWithExtends1.ts, 113, 27)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 115, 9)) +>N : Symbol(N, Decl(inferTypesWithExtends1.ts, 115, 11)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 115, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 115, 48)) +>N : Symbol(N, Decl(inferTypesWithExtends1.ts, 115, 11)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 115, 9)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 115, 48)) + +type X21_T1 = X21<1, 1>; // [1, 1] +>X21_T1 : Symbol(X21_T1, Decl(inferTypesWithExtends1.ts, 115, 79)) +>X21 : Symbol(X21, Decl(inferTypesWithExtends1.ts, 113, 27)) + +type X21_T2 = X21<1 | "a", 1>; // [1, 1] +>X21_T2 : Symbol(X21_T2, Decl(inferTypesWithExtends1.ts, 116, 24)) +>X21 : Symbol(X21, Decl(inferTypesWithExtends1.ts, 113, 27)) + +type X21_T3 = X21<1 | 2, 1>; // [1, 1] +>X21_T3 : Symbol(X21_T3, Decl(inferTypesWithExtends1.ts, 117, 30)) +>X21 : Symbol(X21, Decl(inferTypesWithExtends1.ts, 113, 27)) + +type X21_T4 = X21<1 | 2, 2 | 3>; // [2, 2] +>X21_T4 : Symbol(X21_T4, Decl(inferTypesWithExtends1.ts, 118, 28)) +>X21 : Symbol(X21, Decl(inferTypesWithExtends1.ts, 113, 27)) + +type X21_T5 = X21<1 | 2, 3>; // never +>X21_T5 : Symbol(X21_T5, Decl(inferTypesWithExtends1.ts, 119, 32)) +>X21 : Symbol(X21, Decl(inferTypesWithExtends1.ts, 113, 27)) + +// from mongoose +type IfEquals = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; +>IfEquals : Symbol(IfEquals, Decl(inferTypesWithExtends1.ts, 120, 28)) +>X : Symbol(X, Decl(inferTypesWithExtends1.ts, 123, 14)) +>Y : Symbol(Y, Decl(inferTypesWithExtends1.ts, 123, 16)) +>A : Symbol(A, Decl(inferTypesWithExtends1.ts, 123, 19)) +>B : Symbol(B, Decl(inferTypesWithExtends1.ts, 123, 22)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 123, 30)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 123, 30)) +>X : Symbol(X, Decl(inferTypesWithExtends1.ts, 123, 14)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 123, 68)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 123, 68)) +>Y : Symbol(Y, Decl(inferTypesWithExtends1.ts, 123, 16)) +>A : Symbol(A, Decl(inferTypesWithExtends1.ts, 123, 19)) +>B : Symbol(B, Decl(inferTypesWithExtends1.ts, 123, 22)) + +declare const x1: () => (T extends infer U extends number ? 1 : 0); +>x1 : Symbol(x1, Decl(inferTypesWithExtends1.ts, 125, 13)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 125, 19)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 125, 19)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 125, 43)) + +function f1() { +>f1 : Symbol(f1, Decl(inferTypesWithExtends1.ts, 125, 70)) + + return x1; +>x1 : Symbol(x1, Decl(inferTypesWithExtends1.ts, 125, 13)) +} + +type ExpectNumber = T; +>ExpectNumber : Symbol(ExpectNumber, Decl(inferTypesWithExtends1.ts, 128, 1)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 130, 18)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 130, 18)) + +declare const x2: () => (T extends ExpectNumber ? 1 : 0); +>x2 : Symbol(x2, Decl(inferTypesWithExtends1.ts, 131, 13)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 131, 19)) +>T : Symbol(T, Decl(inferTypesWithExtends1.ts, 131, 19)) +>ExpectNumber : Symbol(ExpectNumber, Decl(inferTypesWithExtends1.ts, 128, 1)) +>U : Symbol(U, Decl(inferTypesWithExtends1.ts, 131, 56)) + +function f2() { +>f2 : Symbol(f2, Decl(inferTypesWithExtends1.ts, 131, 69)) + + return x2; +>x2 : Symbol(x2, Decl(inferTypesWithExtends1.ts, 131, 13)) +} diff --git a/tests/baselines/reference/inferTypesWithExtends1.types b/tests/baselines/reference/inferTypesWithExtends1.types new file mode 100644 index 00000000000..b26386d0f49 --- /dev/null +++ b/tests/baselines/reference/inferTypesWithExtends1.types @@ -0,0 +1,331 @@ +=== tests/cases/conformance/types/conditional/inferTypesWithExtends1.ts === +// infer to tuple element +type X1 = +>X1 : X1 + + T extends [infer U extends string] ? ["string", U] : + T extends [infer U extends number] ? ["number", U] : + never; + +type X1_T1 = X1<["a"]>; // ["string", "a"] +>X1_T1 : ["string", "a"] + +type X1_T2 = X1<[1]>; // ["number", 1] +>X1_T2 : ["number", 1] + +type X1_T3 = X1<[object]>; // never +>X1_T3 : never + +// infer to argument +type X2 void> = +>X2 : X2 +>args : any[] + + T extends (a: infer U extends string) => void ? ["string", U] : +>a : U + + T extends (a: infer U extends number) => void ? ["number", U] : +>a : U + + never; + +type X2_T1 = X2<(a: "a") => void>; // ["string", "a"] +>X2_T1 : ["string", "a"] +>a : "a" + +type X2_T2 = X2<(a: 1) => void>; // ["number", 1] +>X2_T2 : ["number", 1] +>a : 1 + +type X2_T3 = X2<(a: object) => void>; // never +>X2_T3 : never +>a : object + +// infer to return type +type X3 any> = +>X3 : X3 +>args : any[] + + T extends (...args: any[]) => (infer U extends string) ? ["string", U] : +>args : any[] + + T extends (...args: any[]) => (infer U extends number) ? ["number", U] : +>args : any[] + + never; + +type X3_T1 = X3<() => "a">; // ["string", "a"] +>X3_T1 : ["string", "a"] + +type X3_T2 = X3<() => 1>; // ["number", 1] +>X3_T2 : ["number", 1] + +type X3_T3 = X3<() => object>; // never +>X3_T3 : never + +// infer to instance type +type X4 any> = +>X4 : X4 +>args : any[] + + T extends new (...args: any[]) => (infer U extends { a: string }) ? ["string", U] : +>args : any[] +>a : string + + T extends new (...args: any[]) => (infer U extends { a: number }) ? ["number", U] : +>args : any[] +>a : number + + never; + +type X4_T1 = X4 { a: "a" }>; // ["string", { a: "a" }] +>X4_T1 : ["string", { a: "a"; }] +>a : "a" + +type X4_T2 = X4 { a: 1 }>; // ["number", { a: 1 }] +>X4_T2 : ["number", { a: 1; }] +>a : 1 + +type X4_T3 = X4 { a: object }>; // never +>X4_T3 : never +>a : object + +// infer to type argument +type X5 = +>X5 : X5 + + T extends Promise ? ["string", U] : + T extends Promise ? ["number", U] : + never; + +type X5_T1 = X5>; // ["string", "a" | "b"] +>X5_T1 : ["string", "a" | "b"] + +type X5_T2 = X5>; // ["number", 1 | 2] +>X5_T2 : ["number", 1 | 2] + +type X5_T3 = X5>; // never +>X5_T3 : never + +// infer to property type +type X6 = +>X6 : X6 + + T extends { a: infer U extends string } ? ["string", U] : +>a : U + + T extends { a: infer U extends number } ? ["number", U] : +>a : U + + never; + +type X6_T1 = X6<{ a: "a" }>; // ["string", "a"] +>X6_T1 : ["string", "a"] +>a : "a" + +type X6_T2 = X6<{ a: 1 }>; // ["number", 1] +>X6_T2 : ["number", 1] +>a : 1 + +type X6_T3 = X6<{ a: object }>; // never +>X6_T3 : never +>a : object + +// infer twice with same constraint +type X7 = +>X7 : X7 + + T extends { a: infer U extends string, b: infer U extends string } ? ["string", U] : +>a : U +>b : U + + T extends { a: infer U extends number, b: infer U extends number } ? ["number", U] : +>a : U +>b : U + + never; + +type X7_T1 = X7<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +>X7_T1 : ["string", "a" | "b"] +>a : "a" +>b : "b" + +type X7_T2 = X7<{ a: 1, b: 2 }>; // ["number", 1 | 2] +>X7_T2 : ["number", 1 | 2] +>a : 1 +>b : 2 + +type X7_T3 = X7<{ a: object, b: object }>; // never +>X7_T3 : never +>a : object +>b : object + +type X7_T4 = X7<{ a: "a", b: 1 }>; // never +>X7_T4 : never +>a : "a" +>b : 1 + +// infer twice with missing second constraint (same behavior as class/interface) +type X8 = +>X8 : X8 + + T extends { a: infer U extends string, b: infer U } ? ["string", U] : +>a : U +>b : U + + T extends { a: infer U extends number, b: infer U } ? ["number", U] : +>a : U +>b : U + + never; + +type X8_T1 = X8<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +>X8_T1 : ["string", "a" | "b"] +>a : "a" +>b : "b" + +type X8_T2 = X8<{ a: 1, b: 2 }>; // ["number", 1 | 2] +>X8_T2 : ["number", 1 | 2] +>a : 1 +>b : 2 + +type X8_T3 = X8<{ a: object, b: object }>; // never +>X8_T3 : never +>a : object +>b : object + +type X8_T4 = X8<{ a: "a", b: 1 }>; // never +>X8_T4 : never +>a : "a" +>b : 1 + +// infer twice with missing first constraint (same behavior as class/interface) +type X9 = +>X9 : X9 + + T extends { a: infer U, b: infer U extends string } ? ["string", U] : +>a : U +>b : U + + T extends { a: infer U, b: infer U extends number } ? ["number", U] : +>a : U +>b : U + + never; + +type X9_T1 = X9<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +>X9_T1 : ["string", "a" | "b"] +>a : "a" +>b : "b" + +type X9_T2 = X9<{ a: 1, b: 2 }>; // ["number", 1 | 2] +>X9_T2 : ["number", 1 | 2] +>a : 1 +>b : 2 + +type X9_T3 = X9<{ a: object, b: object }>; // never +>X9_T3 : never +>a : object +>b : object + +type X9_T4 = X9<{ a: "a", b: 1 }>; // never +>X9_T4 : never +>a : "a" +>b : 1 + +// Speculative lookahead for `infer T extends U ?` +type X10 = T extends (infer U extends number ? 1 : 0) ? 1 : 0; // ok, parsed as conditional +>X10 : X10 + +type X10_Y1 = X10; +>X10_Y1 : X10_Y1 + +type X10_T1_T1 = X10_Y1; +>X10_T1_T1 : 0 + +type X11 = T extends ((infer U) extends number ? 1 : 0) ? 1 : 0; // ok, parsed as conditional +>X11 : X11 + +type X12 = T extends (infer U extends number) ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +>X12 : X12 + +type X13 = T extends infer U extends number ? 1 : 0; // ok, parsed as `infer..extends` (conditional types not allowed in 'extends type') +>X13 : X13 + +type X14 = T extends keyof infer U extends number ? 1 : 0; // ok, parsed as `infer..extends` (precedence wouldn't have parsed the `?` as part of a type operator) +>X14 : X14 + +type X15 = T extends { [P in infer U extends keyof T ? 1 : 0]: 1; } ? 1 : 0; // ok, parsed as conditional +>X15 : X15 + +type X16 = T extends { [P in infer U extends keyof T]: 1; } ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +>X16 : X16 + +type X17 = T extends { [P in keyof T as infer U extends P ? 1 : 0]: 1; } ? 1 : 0; // ok, parsed as conditional +>X17 : X17 + +type X18 = T extends { [P in keyof T as infer U extends P]: 1; } ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +>X18 : X18 + +type X19 = T extends (infer U extends number) ? [T, U] : never; +>X19 : X19 + +type X19_T1 = X19<"a">; // never +>X19_T1 : never + +type X19_T2 = X19<1>; // [1, 1] +>X19_T2 : [1, 1] + +type X19_T3 = X19<1 | "a">; // [1, 1] +>X19_T3 : [1, 1] + +type X20 = T extends (infer U extends number) ? T extends (infer V extends U) ? [T, U, V] : never : never; +>X20 : X20 + +type X20_T1 = X20<1 | "a">; // [1, 1, 1] +>X20_T1 : [1, 1, 1] + +type X21 = T extends (infer U extends N) ? [T, U] : never; +>X21 : X21 + +type X21_T1 = X21<1, 1>; // [1, 1] +>X21_T1 : [1, 1] + +type X21_T2 = X21<1 | "a", 1>; // [1, 1] +>X21_T2 : [1, 1] + +type X21_T3 = X21<1 | 2, 1>; // [1, 1] +>X21_T3 : [1, 1] + +type X21_T4 = X21<1 | 2, 2 | 3>; // [2, 2] +>X21_T4 : [2, 2] + +type X21_T5 = X21<1 | 2, 3>; // never +>X21_T5 : never + +// from mongoose +type IfEquals = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; +>IfEquals : IfEquals + +declare const x1: () => (T extends infer U extends number ? 1 : 0); +>x1 : () => T extends infer U extends number ? 1 : 0 + +function f1() { +>f1 : () => () => T extends infer U extends number ? 1 : 0 + + return x1; +>x1 : () => T extends infer U extends number ? 1 : 0 +} + +type ExpectNumber = T; +>ExpectNumber : T + +declare const x2: () => (T extends ExpectNumber ? 1 : 0); +>x2 : () => T extends infer U extends number ? 1 : 0 + +function f2() { +>f2 : () => () => T extends infer U extends number ? 1 : 0 + + return x2; +>x2 : () => T extends infer U extends number ? 1 : 0 +} diff --git a/tests/baselines/reference/inferTypesWithExtends2.errors.txt b/tests/baselines/reference/inferTypesWithExtends2.errors.txt new file mode 100644 index 00000000000..395e7e60fed --- /dev/null +++ b/tests/baselines/reference/inferTypesWithExtends2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts(3,26): error TS2838: All declarations of 'U' must have identical constraints. +tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts(3,53): error TS2838: All declarations of 'U' must have identical constraints. +tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts(8,48): error TS2304: Cannot find name 'U'. + + +==== tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts (3 errors) ==== + // infer twice with different constraints (same behavior as class/interface) + type X1 = + T extends { a: infer U extends string, b: infer U extends number } ? U : + ~ +!!! error TS2838: All declarations of 'U' must have identical constraints. + ~ +!!! error TS2838: All declarations of 'U' must have identical constraints. + never; + + // infer cannot reference type params in same 'extends' clause + type X2 = + T extends { a: infer U, b: infer V extends U } ? [U, V] : + ~ +!!! error TS2304: Cannot find name 'U'. + never; \ No newline at end of file diff --git a/tests/baselines/reference/inferTypesWithExtends2.js b/tests/baselines/reference/inferTypesWithExtends2.js new file mode 100644 index 00000000000..17bba39edad --- /dev/null +++ b/tests/baselines/reference/inferTypesWithExtends2.js @@ -0,0 +1,13 @@ +//// [inferTypesWithExtends2.ts] +// infer twice with different constraints (same behavior as class/interface) +type X1 = + T extends { a: infer U extends string, b: infer U extends number } ? U : + never; + +// infer cannot reference type params in same 'extends' clause +type X2 = + T extends { a: infer U, b: infer V extends U } ? [U, V] : + never; + +//// [inferTypesWithExtends2.js] +"use strict"; diff --git a/tests/baselines/reference/inferTypesWithExtends2.symbols b/tests/baselines/reference/inferTypesWithExtends2.symbols new file mode 100644 index 00000000000..3c8bf66bf8b --- /dev/null +++ b/tests/baselines/reference/inferTypesWithExtends2.symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts === +// infer twice with different constraints (same behavior as class/interface) +type X1 = +>X1 : Symbol(X1, Decl(inferTypesWithExtends2.ts, 0, 0)) +>T : Symbol(T, Decl(inferTypesWithExtends2.ts, 1, 8)) + + T extends { a: infer U extends string, b: infer U extends number } ? U : +>T : Symbol(T, Decl(inferTypesWithExtends2.ts, 1, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends2.ts, 2, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends2.ts, 2, 24), Decl(inferTypesWithExtends2.ts, 2, 51)) +>b : Symbol(b, Decl(inferTypesWithExtends2.ts, 2, 42)) +>U : Symbol(U, Decl(inferTypesWithExtends2.ts, 2, 24), Decl(inferTypesWithExtends2.ts, 2, 51)) +>U : Symbol(U, Decl(inferTypesWithExtends2.ts, 2, 24), Decl(inferTypesWithExtends2.ts, 2, 51)) + + never; + +// infer cannot reference type params in same 'extends' clause +type X2 = +>X2 : Symbol(X2, Decl(inferTypesWithExtends2.ts, 3, 10)) +>T : Symbol(T, Decl(inferTypesWithExtends2.ts, 6, 8)) + + T extends { a: infer U, b: infer V extends U } ? [U, V] : +>T : Symbol(T, Decl(inferTypesWithExtends2.ts, 6, 8)) +>a : Symbol(a, Decl(inferTypesWithExtends2.ts, 7, 15)) +>U : Symbol(U, Decl(inferTypesWithExtends2.ts, 7, 24)) +>b : Symbol(b, Decl(inferTypesWithExtends2.ts, 7, 27)) +>V : Symbol(V, Decl(inferTypesWithExtends2.ts, 7, 36)) +>U : Symbol(U) +>U : Symbol(U, Decl(inferTypesWithExtends2.ts, 7, 24)) +>V : Symbol(V, Decl(inferTypesWithExtends2.ts, 7, 36)) + + never; diff --git a/tests/baselines/reference/inferTypesWithExtends2.types b/tests/baselines/reference/inferTypesWithExtends2.types new file mode 100644 index 00000000000..e76936d0702 --- /dev/null +++ b/tests/baselines/reference/inferTypesWithExtends2.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts === +// infer twice with different constraints (same behavior as class/interface) +type X1 = +>X1 : X1 + + T extends { a: infer U extends string, b: infer U extends number } ? U : +>a : U +>b : U + + never; + +// infer cannot reference type params in same 'extends' clause +type X2 = +>X2 : X2 + + T extends { a: infer U, b: infer V extends U } ? [U, V] : +>a : U +>b : V + + never; diff --git a/tests/baselines/reference/infiniteConstraints.types b/tests/baselines/reference/infiniteConstraints.types index 3fa2bb1feed..6a3a1a07595 100644 --- a/tests/baselines/reference/infiniteConstraints.types +++ b/tests/baselines/reference/infiniteConstraints.types @@ -15,7 +15,7 @@ type AProp = T >a : string declare function myBug< ->myBug : (arg: T) => T +>myBug : (arg: T) => T T extends { [K in keyof T]: T[K] extends AProp ? U : never } >(arg: T): T @@ -24,7 +24,7 @@ declare function myBug< const out = myBug({obj1: {a: "test"}}) >out : { obj1: { a: string; }; } >myBug({obj1: {a: "test"}}) : { obj1: { a: string; }; } ->myBug : (arg: T) => T +>myBug : (arg: T) => T >{obj1: {a: "test"}} : { obj1: { a: string; }; } >obj1 : { a: string; } >{a: "test"} : { a: string; } diff --git a/tests/baselines/reference/keyofAndIndexedAccess2.types b/tests/baselines/reference/keyofAndIndexedAccess2.types index 048e11cad67..9fa1ac46783 100644 --- a/tests/baselines/reference/keyofAndIndexedAccess2.types +++ b/tests/baselines/reference/keyofAndIndexedAccess2.types @@ -495,7 +495,7 @@ function fn4() { >'abc' : "abc" let y: ReadonlyArray[K] = 'abc'; ->y : readonly string[][K] +>y : (readonly string[])[K] >'abc' : "abc" } diff --git a/tests/baselines/reference/literalsInComputedProperties1.types b/tests/baselines/reference/literalsInComputedProperties1.types index 8a3e2dbd81a..d417b9f4099 100644 --- a/tests/baselines/reference/literalsInComputedProperties1.types +++ b/tests/baselines/reference/literalsInComputedProperties1.types @@ -161,20 +161,20 @@ enum X { >X : X 1 = 1, ->1 : typeof X["1"] +>1 : (typeof X)["1"] >1 : 1 [2] = 2, ->[2] : typeof X["2"] +>[2] : (typeof X)["2"] >2 : 2 >2 : 2 "3" = 3, ->"3" : typeof X["3"] +>"3" : (typeof X)["3"] >3 : 3 ["4"] = 4, ->["4"] : typeof X["4"] +>["4"] : (typeof X)["4"] >"4" : "4" >4 : 4 diff --git a/tests/baselines/reference/negateOperatorWithEnumType.types b/tests/baselines/reference/negateOperatorWithEnumType.types index 32eb5ebbe28..2398303496c 100644 --- a/tests/baselines/reference/negateOperatorWithEnumType.types +++ b/tests/baselines/reference/negateOperatorWithEnumType.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // enum type var var ResultIsNumber1 = -ENUM; @@ -32,7 +32,7 @@ var ResultIsNumber3 = -(ENUM1.B + ENUM1[""]); >ENUM1.B : ENUM1.B >ENUM1 : typeof ENUM1 >B : ENUM1.B ->ENUM1[""] : typeof ENUM1[""] +>ENUM1[""] : (typeof ENUM1)[""] >ENUM1 : typeof ENUM1 >"" : "" diff --git a/tests/baselines/reference/parserEnum5.types b/tests/baselines/reference/parserEnum5.types index f44ae1b57ca..68450ddbd13 100644 --- a/tests/baselines/reference/parserEnum5.types +++ b/tests/baselines/reference/parserEnum5.types @@ -6,13 +6,13 @@ enum E2 { a, } enum E3 { a: 1, } >E3 : E3 >a : E3.a ->1 : typeof E3["1"] +>1 : (typeof E3)["1"] enum E1 { a, b: 1, c, d: 2 = 3 } >E1 : E1 >a : E1.a >b : E1.b ->1 : typeof E1["1"] +>1 : (typeof E1)["1"] >c : E1.c >d : E1.d >2 : E1.c diff --git a/tests/baselines/reference/parserEnum7.types b/tests/baselines/reference/parserEnum7.types index efc650edd67..be81351603c 100644 --- a/tests/baselines/reference/parserEnum7.types +++ b/tests/baselines/reference/parserEnum7.types @@ -3,7 +3,7 @@ enum E { >E : E 1, 2, 3 ->1 : typeof E["1"] ->2 : typeof E["2"] ->3 : typeof E["3"] +>1 : (typeof E)["1"] +>2 : (typeof E)["2"] +>3 : (typeof E)["3"] } diff --git a/tests/baselines/reference/plusOperatorWithEnumType.types b/tests/baselines/reference/plusOperatorWithEnumType.types index b762505d9f1..b19fd30a209 100644 --- a/tests/baselines/reference/plusOperatorWithEnumType.types +++ b/tests/baselines/reference/plusOperatorWithEnumType.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // enum type var var ResultIsNumber1 = +ENUM; diff --git a/tests/baselines/reference/typeofOperatorWithEnumType.types b/tests/baselines/reference/typeofOperatorWithEnumType.types index 7f50a98e80c..5b560291946 100644 --- a/tests/baselines/reference/typeofOperatorWithEnumType.types +++ b/tests/baselines/reference/typeofOperatorWithEnumType.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // enum type var var ResultIsString1 = typeof ENUM; diff --git a/tests/baselines/reference/voidOperatorWithEnumType.types b/tests/baselines/reference/voidOperatorWithEnumType.types index c5356d7f3bc..ff34ac7ee69 100644 --- a/tests/baselines/reference/voidOperatorWithEnumType.types +++ b/tests/baselines/reference/voidOperatorWithEnumType.types @@ -8,7 +8,7 @@ enum ENUM1 { A, B, "" }; >ENUM1 : ENUM1 >A : ENUM1.A >B : ENUM1.B ->"" : typeof ENUM1[""] +>"" : (typeof ENUM1)[""] // enum type var var ResultIsAny1 = void ENUM; diff --git a/tests/cases/conformance/types/conditional/inferTypes1.ts b/tests/cases/conformance/types/conditional/inferTypes1.ts index afcb58aff5d..42e5897dc66 100644 --- a/tests/cases/conformance/types/conditional/inferTypes1.ts +++ b/tests/cases/conformance/types/conditional/inferTypes1.ts @@ -83,9 +83,9 @@ type T53 = X3<{ a: (x: number) => void, b: (x: string) => void }>; // never type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number type T60 = infer U; // Error -type T61 = infer A extends infer B ? infer C : infer D; // Error +type T61 = (infer A) extends infer B ? infer C : infer D; // Error type T62 = U extends (infer U)[] ? U : U; // Error -type T63 = T extends (infer A extends infer B ? infer C : infer D) ? string : number; +type T63 = T extends ((infer A) extends infer B ? infer C : infer D) ? string : number; type T70 = { x: T }; type T71 = T extends T70 ? T70 : never; diff --git a/tests/cases/conformance/types/conditional/inferTypesWithExtends1.ts b/tests/cases/conformance/types/conditional/inferTypesWithExtends1.ts new file mode 100644 index 00000000000..64034a62cb6 --- /dev/null +++ b/tests/cases/conformance/types/conditional/inferTypesWithExtends1.ts @@ -0,0 +1,138 @@ +// @strict: true +// @declaration: true + +// infer to tuple element +type X1 = + T extends [infer U extends string] ? ["string", U] : + T extends [infer U extends number] ? ["number", U] : + never; + +type X1_T1 = X1<["a"]>; // ["string", "a"] +type X1_T2 = X1<[1]>; // ["number", 1] +type X1_T3 = X1<[object]>; // never + +// infer to argument +type X2 void> = + T extends (a: infer U extends string) => void ? ["string", U] : + T extends (a: infer U extends number) => void ? ["number", U] : + never; + +type X2_T1 = X2<(a: "a") => void>; // ["string", "a"] +type X2_T2 = X2<(a: 1) => void>; // ["number", 1] +type X2_T3 = X2<(a: object) => void>; // never + +// infer to return type +type X3 any> = + T extends (...args: any[]) => (infer U extends string) ? ["string", U] : + T extends (...args: any[]) => (infer U extends number) ? ["number", U] : + never; + +type X3_T1 = X3<() => "a">; // ["string", "a"] +type X3_T2 = X3<() => 1>; // ["number", 1] +type X3_T3 = X3<() => object>; // never + +// infer to instance type +type X4 any> = + T extends new (...args: any[]) => (infer U extends { a: string }) ? ["string", U] : + T extends new (...args: any[]) => (infer U extends { a: number }) ? ["number", U] : + never; + +type X4_T1 = X4 { a: "a" }>; // ["string", { a: "a" }] +type X4_T2 = X4 { a: 1 }>; // ["number", { a: 1 }] +type X4_T3 = X4 { a: object }>; // never + +// infer to type argument +type X5 = + T extends Promise ? ["string", U] : + T extends Promise ? ["number", U] : + never; + +type X5_T1 = X5>; // ["string", "a" | "b"] +type X5_T2 = X5>; // ["number", 1 | 2] +type X5_T3 = X5>; // never + +// infer to property type +type X6 = + T extends { a: infer U extends string } ? ["string", U] : + T extends { a: infer U extends number } ? ["number", U] : + never; + +type X6_T1 = X6<{ a: "a" }>; // ["string", "a"] +type X6_T2 = X6<{ a: 1 }>; // ["number", 1] +type X6_T3 = X6<{ a: object }>; // never + +// infer twice with same constraint +type X7 = + T extends { a: infer U extends string, b: infer U extends string } ? ["string", U] : + T extends { a: infer U extends number, b: infer U extends number } ? ["number", U] : + never; + +type X7_T1 = X7<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +type X7_T2 = X7<{ a: 1, b: 2 }>; // ["number", 1 | 2] +type X7_T3 = X7<{ a: object, b: object }>; // never +type X7_T4 = X7<{ a: "a", b: 1 }>; // never + +// infer twice with missing second constraint (same behavior as class/interface) +type X8 = + T extends { a: infer U extends string, b: infer U } ? ["string", U] : + T extends { a: infer U extends number, b: infer U } ? ["number", U] : + never; + +type X8_T1 = X8<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +type X8_T2 = X8<{ a: 1, b: 2 }>; // ["number", 1 | 2] +type X8_T3 = X8<{ a: object, b: object }>; // never +type X8_T4 = X8<{ a: "a", b: 1 }>; // never + +// infer twice with missing first constraint (same behavior as class/interface) +type X9 = + T extends { a: infer U, b: infer U extends string } ? ["string", U] : + T extends { a: infer U, b: infer U extends number } ? ["number", U] : + never; + +type X9_T1 = X9<{ a: "a", b: "b" }>; // ["string", "a" | "b"] +type X9_T2 = X9<{ a: 1, b: 2 }>; // ["number", 1 | 2] +type X9_T3 = X9<{ a: object, b: object }>; // never +type X9_T4 = X9<{ a: "a", b: 1 }>; // never + +// Speculative lookahead for `infer T extends U ?` +type X10 = T extends (infer U extends number ? 1 : 0) ? 1 : 0; // ok, parsed as conditional +type X10_Y1 = X10; +type X10_T1_T1 = X10_Y1; + +type X11 = T extends ((infer U) extends number ? 1 : 0) ? 1 : 0; // ok, parsed as conditional +type X12 = T extends (infer U extends number) ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +type X13 = T extends infer U extends number ? 1 : 0; // ok, parsed as `infer..extends` (conditional types not allowed in 'extends type') +type X14 = T extends keyof infer U extends number ? 1 : 0; // ok, parsed as `infer..extends` (precedence wouldn't have parsed the `?` as part of a type operator) +type X15 = T extends { [P in infer U extends keyof T ? 1 : 0]: 1; } ? 1 : 0; // ok, parsed as conditional +type X16 = T extends { [P in infer U extends keyof T]: 1; } ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) +type X17 = T extends { [P in keyof T as infer U extends P ? 1 : 0]: 1; } ? 1 : 0; // ok, parsed as conditional +type X18 = T extends { [P in keyof T as infer U extends P]: 1; } ? 1 : 0; // ok, parsed as `infer..extends` (no trailing `?`) + +type X19 = T extends (infer U extends number) ? [T, U] : never; +type X19_T1 = X19<"a">; // never +type X19_T2 = X19<1>; // [1, 1] +type X19_T3 = X19<1 | "a">; // [1, 1] + +type X20 = T extends (infer U extends number) ? T extends (infer V extends U) ? [T, U, V] : never : never; +type X20_T1 = X20<1 | "a">; // [1, 1, 1] + +type X21 = T extends (infer U extends N) ? [T, U] : never; +type X21_T1 = X21<1, 1>; // [1, 1] +type X21_T2 = X21<1 | "a", 1>; // [1, 1] +type X21_T3 = X21<1 | 2, 1>; // [1, 1] +type X21_T4 = X21<1 | 2, 2 | 3>; // [2, 2] +type X21_T5 = X21<1 | 2, 3>; // never + +// from mongoose +type IfEquals = (() => T extends X ? 1 : 2) extends () => T extends Y ? 1 : 2 ? A : B; + +declare const x1: () => (T extends infer U extends number ? 1 : 0); +function f1() { + return x1; +} + +type ExpectNumber = T; +declare const x2: () => (T extends ExpectNumber ? 1 : 0); +function f2() { + return x2; +} \ No newline at end of file diff --git a/tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts b/tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts new file mode 100644 index 00000000000..98e99a55562 --- /dev/null +++ b/tests/cases/conformance/types/conditional/inferTypesWithExtends2.ts @@ -0,0 +1,11 @@ +// @strict: true + +// infer twice with different constraints (same behavior as class/interface) +type X1 = + T extends { a: infer U extends string, b: infer U extends number } ? U : + never; + +// infer cannot reference type params in same 'extends' clause +type X2 = + T extends { a: infer U, b: infer V extends U } ? [U, V] : + never; \ No newline at end of file diff --git a/tests/cases/fourslash/refactorExtractType48.ts b/tests/cases/fourslash/refactorExtractType48.ts index d10af6bb637..afe41c71652 100644 --- a/tests/cases/fourslash/refactorExtractType48.ts +++ b/tests/cases/fourslash/refactorExtractType48.ts @@ -1,13 +1,13 @@ /// -//// type Crazy = /*a*/T extends [infer P, (infer R extends string ? string : never)] ? P & R : string/*b*/; +//// type Crazy = /*a*/T extends [infer P, ((infer R) extends string ? string : never)] ? P & R : string/*b*/; goTo.select("a", "b"); edit.applyRefactor({ refactorName: "Extract type", actionName: "Extract to type alias", actionDescription: "Extract to type alias", - newContent: `type /*RENAME*/NewType = T extends [infer P, (infer R extends string ? string : never)] ? P & R : string; + newContent: `type /*RENAME*/NewType = T extends [infer P, ((infer R) extends string ? string : never)] ? P & R : string; type Crazy = NewType;`, }); From a3c22187c92d9acacdbb92deb1f5e3dcd2a10363 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 5 Apr 2022 13:08:59 -0700 Subject: [PATCH 26/41] Improve inference for context sensitive functions in object and array literal arguments (#48538) * Use intra-expression inference sites in type argument inference * Accept new baselines * Add tests --- src/compiler/checker.ts | 118 +++- src/compiler/types.ts | 7 + .../contextualTypingOfOptionalMembers.types | 24 +- .../intraExpressionInferences.errors.txt | 192 ++++++ .../reference/intraExpressionInferences.js | 342 ++++++++++ .../intraExpressionInferences.symbols | 560 +++++++++++++++++ .../reference/intraExpressionInferences.types | 590 ++++++++++++++++++ .../intraExpressionInferences.ts | 178 ++++++ 8 files changed, 1968 insertions(+), 43 deletions(-) create mode 100644 tests/baselines/reference/intraExpressionInferences.errors.txt create mode 100644 tests/baselines/reference/intraExpressionInferences.js create mode 100644 tests/baselines/reference/intraExpressionInferences.symbols create mode 100644 tests/baselines/reference/intraExpressionInferences.types create mode 100644 tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d08091584cf..4fb6b55412e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -21749,6 +21749,9 @@ namespace ts { const inference = inferences[i]; if (t === inference.typeParameter) { if (fix && !inference.isFixed) { + // Before we commit to a particular inference (and thus lock out any further inferences), + // we infer from any intra-expression inference sites we have collected. + inferFromIntraExpressionSites(context); clearCachedInferences(inferences); inference.isFixed = true; } @@ -21766,6 +21769,37 @@ namespace ts { } } + function addIntraExpressionInferenceSite(context: InferenceContext, node: Expression | MethodDeclaration, type: Type) { + (context.intraExpressionInferenceSites ??= []).push({ node, type }); + } + + // We collect intra-expression inference sites within object and array literals to handle cases where + // inferred types flow between context sensitive element expressions. For example: + // + // declare function foo(arg: [(n: number) => T, (x: T) => void]): void; + // foo([_a => 0, n => n.toFixed()]); + // + // Above, both arrow functions in the tuple argument are context sensitive, thus both are omitted from the + // pass that collects inferences from the non-context sensitive parts of the arguments. In the subsequent + // pass where nothing is omitted, we need to commit to an inference for T in order to contextually type the + // parameter in the second arrow function, but we want to first infer from the return type of the first + // arrow function. This happens automatically when the arrow functions are discrete arguments (because we + // infer from each argument before processing the next), but when the arrow functions are elements of an + // object or array literal, we need to perform intra-expression inferences early. + function inferFromIntraExpressionSites(context: InferenceContext) { + if (context.intraExpressionInferenceSites) { + for (const { node, type } of context.intraExpressionInferenceSites) { + const contextualType = node.kind === SyntaxKind.MethodDeclaration ? + getContextualTypeForObjectLiteralMethod(node as MethodDeclaration, ContextFlags.NoConstraints) : + getContextualType(node, ContextFlags.NoConstraints); + if (contextualType) { + inferTypes(context.inferences, type, contextualType); + } + } + context.intraExpressionInferenceSites = undefined; + } + } + function createInferenceInfo(typeParameter: TypeParameter): InferenceInfo { return { typeParameter, @@ -27429,6 +27463,11 @@ namespace ts { const type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple); elementTypes.push(addOptionality(type, /*isProperty*/ true, hasOmittedExpression)); elementFlags.push(hasOmittedExpression ? ElementFlags.Optional : ElementFlags.Required); + if (contextualType && someType(contextualType, isTupleLikeType) && checkMode && checkMode & CheckMode.Inferential && !(checkMode & CheckMode.SkipContextSensitive) && isContextSensitive(e)) { + const inferenceContext = getInferenceContext(node); + Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context + addIntraExpressionInferenceSite(inferenceContext, e, type); + } } } if (inDestructuringPattern) { @@ -27646,6 +27685,14 @@ namespace ts { prop.target = member; member = prop; allPropertiesTable?.set(prop.escapedName, prop); + + if (contextualType && checkMode && checkMode & CheckMode.Inferential && !(checkMode & CheckMode.SkipContextSensitive) && + (memberDecl.kind === SyntaxKind.PropertyAssignment || memberDecl.kind === SyntaxKind.MethodDeclaration) && isContextSensitive(memberDecl)) { + const inferenceContext = getInferenceContext(node); + Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context + const inferenceNode = memberDecl.kind === SyntaxKind.PropertyAssignment ? memberDecl.initializer : memberDecl; + addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); + } } else if (memberDecl.kind === SyntaxKind.SpreadAssignment) { if (languageVersion < ScriptTarget.ES2015) { @@ -29748,34 +29795,36 @@ namespace ts { if (node.kind !== SyntaxKind.Decorator) { const contextualType = getContextualType(node, every(signature.typeParameters, p => !!getDefaultFromTypeParameter(p)) ? ContextFlags.SkipBindingPatterns : ContextFlags.None); if (contextualType) { - // We clone the inference context to avoid disturbing a resolution in progress for an - // outer call expression. Effectively we just want a snapshot of whatever has been - // inferred for any outer call expression so far. - const outerContext = getInferenceContext(node); - const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, InferenceFlags.NoDefault)); - const instantiatedType = instantiateType(contextualType, outerMapper); - // If the contextual type is a generic function type with a single call signature, we - // instantiate the type with its own type parameters and type arguments. This ensures that - // the type parameters are not erased to type any during type inference such that they can - // be inferred as actual types from the contextual type. For example: - // declare function arrayMap(f: (x: T) => U): (a: T[]) => U[]; - // const boxElements: (a: A[]) => { value: A }[] = arrayMap(value => ({ value })); - // Above, the type of the 'value' parameter is inferred to be 'A'. - const contextualSignature = getSingleCallSignature(instantiatedType); - const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? - getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : - instantiatedType; const inferenceTargetType = getReturnTypeOfSignature(signature); - // Inferences made from return types have lower priority than all other inferences. - inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, InferencePriority.ReturnType); - // Create a type mapper for instantiating generic contextual types using the inferences made - // from the return type. We need a separate inference pass here because (a) instantiation of - // the source type uses the outer context's return mapper (which excludes inferences made from - // outer arguments), and (b) we don't want any further inferences going into this context. - const returnContext = createInferenceContext(signature.typeParameters!, signature, context.flags); - const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper); - inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType); - context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined; + if (couldContainTypeVariables(inferenceTargetType)) { + // We clone the inference context to avoid disturbing a resolution in progress for an + // outer call expression. Effectively we just want a snapshot of whatever has been + // inferred for any outer call expression so far. + const outerContext = getInferenceContext(node); + const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, InferenceFlags.NoDefault)); + const instantiatedType = instantiateType(contextualType, outerMapper); + // If the contextual type is a generic function type with a single call signature, we + // instantiate the type with its own type parameters and type arguments. This ensures that + // the type parameters are not erased to type any during type inference such that they can + // be inferred as actual types from the contextual type. For example: + // declare function arrayMap(f: (x: T) => U): (a: T[]) => U[]; + // const boxElements: (a: A[]) => { value: A }[] = arrayMap(value => ({ value })); + // Above, the type of the 'value' parameter is inferred to be 'A'. + const contextualSignature = getSingleCallSignature(instantiatedType); + const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? + getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : + instantiatedType; + // Inferences made from return types have lower priority than all other inferences. + inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, InferencePriority.ReturnType); + // Create a type mapper for instantiating generic contextual types using the inferences made + // from the return type. We need a separate inference pass here because (a) instantiation of + // the source type uses the outer context's return mapper (which excludes inferences made from + // outer arguments), and (b) we don't want any further inferences going into this context. + const returnContext = createInferenceContext(signature.typeParameters!, signature, context.flags); + const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper); + inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType); + context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : undefined; + } } } @@ -29789,7 +29838,7 @@ namespace ts { } const thisType = getThisTypeOfSignature(signature); - if (thisType) { + if (thisType && couldContainTypeVariables(thisType)) { const thisArgumentNode = getThisArgumentOfCall(node); inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType); } @@ -29798,12 +29847,14 @@ namespace ts { const arg = args[i]; if (arg.kind !== SyntaxKind.OmittedExpression && !(checkMode & CheckMode.IsForStringLiteralArgumentCompletions && hasSkipDirectInferenceFlag(arg))) { const paramType = getTypeAtPosition(signature, i); - const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); - inferTypes(context.inferences, argType, paramType); + if (couldContainTypeVariables(paramType)) { + const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); + inferTypes(context.inferences, argType, paramType); + } } } - if (restType) { + if (restType && couldContainTypeVariables(restType)) { const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode); inferTypes(context.inferences, spreadType, restType); } @@ -34162,6 +34213,11 @@ namespace ts { context.contextualType = contextualType; context.inferenceContext = inferenceContext; const type = checkExpression(node, checkMode | CheckMode.Contextual | (inferenceContext ? CheckMode.Inferential : 0)); + // In CheckMode.Inferential we collect intra-expression inference sites to process before fixing any type + // parameters. This information is no longer needed after the call to checkExpression. + if (inferenceContext && inferenceContext.intraExpressionInferenceSites) { + inferenceContext.intraExpressionInferenceSites = undefined; + } // We strip literal freshness when an appropriate contextual type is present such that contextually typed // literals always preserve their literal types (otherwise they might widen during type inference). An alternative // here would be to not mark contextually typed literals as fresh in the first place. diff --git a/src/compiler/types.ts b/src/compiler/types.ts index cbaf27144f1..2302c95322f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5915,6 +5915,13 @@ namespace ts { nonFixingMapper: TypeMapper; // Mapper that doesn't fix inferences returnMapper?: TypeMapper; // Type mapper for inferences from return types (if any) inferredTypeParameters?: readonly TypeParameter[]; // Inferred type parameters for function result + intraExpressionInferenceSites?: IntraExpressionInferenceSite[]; + } + + /* @internal */ + export interface IntraExpressionInferenceSite { + node: Expression | MethodDeclaration; + type: Type; } /* @internal */ diff --git a/tests/baselines/reference/contextualTypingOfOptionalMembers.types b/tests/baselines/reference/contextualTypingOfOptionalMembers.types index 8f2d051149a..192d5b52493 100644 --- a/tests/baselines/reference/contextualTypingOfOptionalMembers.types +++ b/tests/baselines/reference/contextualTypingOfOptionalMembers.types @@ -25,7 +25,7 @@ declare function app>(obj: Optionsapp({ state: 100, actions: { foo: s => s // Should be typed number => number }, view: (s, a) => undefined as any,}) : void >app : >(obj: Options) => void ->{ state: 100, actions: { foo: s => s // Should be typed number => number }, view: (s, a) => undefined as any,} : { state: number; actions: { foo: (s: number) => number; }; view: (s: number, a: ActionsObject) => any; } +>{ state: 100, actions: { foo: s => s // Should be typed number => number }, view: (s, a) => undefined as any,} : { state: number; actions: { foo: (s: number) => number; }; view: (s: number, a: { foo: (s: number) => number; }) => any; } state: 100, >state : number @@ -43,10 +43,10 @@ app({ }, view: (s, a) => undefined as any, ->view : (s: number, a: ActionsObject) => any ->(s, a) => undefined as any : (s: number, a: ActionsObject) => any +>view : (s: number, a: { foo: (s: number) => number; }) => any +>(s, a) => undefined as any : (s: number, a: { foo: (s: number) => number; }) => any >s : number ->a : ActionsObject +>a : { foo: (s: number) => number; } >undefined as any : any >undefined : undefined @@ -95,7 +95,7 @@ declare function app2>(obj: Options2 app2({ >app2({ state: 100, actions: { foo: s => s // Should be typed number => number }, view: (s, a) => undefined as any,}) : void >app2 : >(obj: Options2) => void ->{ state: 100, actions: { foo: s => s // Should be typed number => number }, view: (s, a) => undefined as any,} : { state: number; actions: { foo: (s: number) => number; }; view: (s: number, a: ActionsObject) => any; } +>{ state: 100, actions: { foo: s => s // Should be typed number => number }, view: (s, a) => undefined as any,} : { state: number; actions: { foo: (s: number) => number; }; view: (s: number, a: { foo: (s: number) => number; }) => any; } state: 100, >state : number @@ -113,10 +113,10 @@ app2({ }, view: (s, a) => undefined as any, ->view : (s: number, a: ActionsObject) => any ->(s, a) => undefined as any : (s: number, a: ActionsObject) => any +>view : (s: number, a: { foo: (s: number) => number; }) => any +>(s, a) => undefined as any : (s: number, a: { foo: (s: number) => number; }) => any >s : number ->a : ActionsObject +>a : { foo: (s: number) => number; } >undefined as any : any >undefined : undefined @@ -134,7 +134,7 @@ declare function app3>(obj: Optionsapp3({ state: 100, actions: [ s => s // Should be typed number => number ], view: (s, a) => undefined as any,}) : void >app3 : >(obj: Options) => void ->{ state: 100, actions: [ s => s // Should be typed number => number ], view: (s, a) => undefined as any,} : { state: number; actions: ((s: number) => number)[]; view: (s: number, a: ActionsArray) => any; } +>{ state: 100, actions: [ s => s // Should be typed number => number ], view: (s, a) => undefined as any,} : { state: number; actions: ((s: number) => number)[]; view: (s: number, a: ((s: number) => number)[]) => any; } state: 100, >state : number @@ -151,10 +151,10 @@ app3({ ], view: (s, a) => undefined as any, ->view : (s: number, a: ActionsArray) => any ->(s, a) => undefined as any : (s: number, a: ActionsArray) => any +>view : (s: number, a: ((s: number) => number)[]) => any +>(s, a) => undefined as any : (s: number, a: ((s: number) => number)[]) => any >s : number ->a : ActionsArray +>a : ((s: number) => number)[] >undefined as any : any >undefined : undefined diff --git a/tests/baselines/reference/intraExpressionInferences.errors.txt b/tests/baselines/reference/intraExpressionInferences.errors.txt new file mode 100644 index 00000000000..e4d3548c457 --- /dev/null +++ b/tests/baselines/reference/intraExpressionInferences.errors.txt @@ -0,0 +1,192 @@ +tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts(123,5): error TS2322: Type '(inputs: Unwrap<{ num: Wrapper; str: Wrapper; }>) => { bool: any; str: number; }' is not assignable to type '(inputs: Unwrap<{ num: Wrapper; str: Wrapper; }>) => Unwrap<{ bool: Wrapper; str: Wrapper; }>'. + Call signature return types '{ bool: any; str: number; }' and 'Unwrap<{ bool: Wrapper; str: Wrapper; }>' are incompatible. + The types of 'str' are incompatible between these types. + Type 'number' is not assignable to type 'string'. +tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts(125,26): error TS2339: Property 'nonexistent' does not exist on type 'Unwrap<{ num: Wrapper; str: Wrapper; }>'. + + +==== tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts (2 errors) ==== + // Repros from #47599 + + declare function callIt(obj: { + produce: (n: number) => T, + consume: (x: T) => void + }): void; + + callIt({ + produce: () => 0, + consume: n => n.toFixed() + }); + + callIt({ + produce: _a => 0, + consume: n => n.toFixed(), + }); + + callIt({ + produce() { + return 0; + }, + consume: n => n.toFixed() + }); + + declare function callItT(obj: [(n: number) => T, (x: T) => void]): void; + + callItT([() => 0, n => n.toFixed()]); + callItT([_a => 0, n => n.toFixed()]); + + // Repro from #25092 + + interface MyInterface { + retrieveGeneric: (parameter: string) => T, + operateWithGeneric: (generic: T) => string + } + + const inferTypeFn = (generic: MyInterface) => generic; + + const myGeneric = inferTypeFn({ + retrieveGeneric: parameter => 5, + operateWithGeneric: generic => generic.toFixed() + }); + + // Repro #38623 + + function make(o: { mutations: M, action: (m: M) => void }) { } + + make({ + mutations: { + foo() { } + }, + action: (a) => { a.foo() } + }); + + // Repro from #38845 + + declare function foo(options: { a: A, b: (a: A) => void }): void; + + foo({ + a: () => { return 42 }, + b(a) {}, + }); + + foo({ + a: function () { return 42 }, + b(a) {}, + }); + + foo({ + a() { return 42 }, + b(a) {}, + }); + + // Repro from #38872 + + type Chain = { + a(): R1, + b(a: R1): R2; + c(b: R2): void; + }; + + function test(foo: Chain) {} + + test({ + a: () => 0, + b: (a) => 'a', + c: (b) => { + const x: string = b; + } + }); + + // Repro from #41712 + + class Wrapper { + public value?: T; + } + + type WrappedMap = Record; + type Unwrap = { + [K in keyof D]: D[K] extends Wrapper ? T : never; + }; + + type MappingComponent = { + setup(): { inputs: I; outputs: O }; + map?: (inputs: Unwrap) => Unwrap; + }; + + declare function createMappingComponent(def: MappingComponent): void; + + createMappingComponent({ + setup() { + return { + inputs: { + num: new Wrapper(), + str: new Wrapper() + }, + outputs: { + bool: new Wrapper(), + str: new Wrapper() + } + }; + }, + map(inputs) { + ~~~ +!!! error TS2322: Type '(inputs: Unwrap<{ num: Wrapper; str: Wrapper; }>) => { bool: any; str: number; }' is not assignable to type '(inputs: Unwrap<{ num: Wrapper; str: Wrapper; }>) => Unwrap<{ bool: Wrapper; str: Wrapper; }>'. +!!! error TS2322: Call signature return types '{ bool: any; str: number; }' and 'Unwrap<{ bool: Wrapper; str: Wrapper; }>' are incompatible. +!!! error TS2322: The types of 'str' are incompatible between these types. +!!! error TS2322: Type 'number' is not assignable to type 'string'. +!!! related TS6500 tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts:105:5: The expected type comes from property 'map' which is declared here on type 'MappingComponent<{ num: Wrapper; str: Wrapper; }, { bool: Wrapper; str: Wrapper; }>' + return { + bool: inputs.nonexistent, + ~~~~~~~~~~~ +!!! error TS2339: Property 'nonexistent' does not exist on type 'Unwrap<{ num: Wrapper; str: Wrapper; }>'. + str: inputs.num, // Causes error + } + } + }); + + // Repro from #48279 + + function simplified(props: { generator: () => T, receiver: (t: T) => any }) {} + + function whatIWant(props: { generator: (bob: any) => T, receiver: (t: T) => any }) {} + + function nonObject(generator: (bob: any) => T, receiver: (t: T) => any) {} + + simplified({ generator: () => 123, receiver: (t) => console.log(t + 2) }) + whatIWant({ generator: (bob) => bob ? 1 : 2, receiver: (t) => console.log(t + 2) }) + nonObject((bob) => bob ? 1 : 2, (t) => console.log(t + 2)) + + // Repro from #48466 + + interface Opts { + fetch: (params: TParams, foo: number) => TDone, + map: (data: TDone) => TMapped + } + + function example(options: Opts) { + return (params: TParams) => { + const data = options.fetch(params, 123) + return options.map(data) + } + } + + interface Params { + one: number + two: string + } + + example({ + fetch: (params: Params) => 123, + map: (number) => String(number) + }); + + example({ + fetch: (params: Params, foo: number) => 123, + map: (number) => String(number) + }); + + example({ + fetch: (params: Params, foo) => 123, + map: (number) => String(number) + }); + \ No newline at end of file diff --git a/tests/baselines/reference/intraExpressionInferences.js b/tests/baselines/reference/intraExpressionInferences.js new file mode 100644 index 00000000000..20647b46897 --- /dev/null +++ b/tests/baselines/reference/intraExpressionInferences.js @@ -0,0 +1,342 @@ +//// [intraExpressionInferences.ts] +// Repros from #47599 + +declare function callIt(obj: { + produce: (n: number) => T, + consume: (x: T) => void +}): void; + +callIt({ + produce: () => 0, + consume: n => n.toFixed() +}); + +callIt({ + produce: _a => 0, + consume: n => n.toFixed(), +}); + +callIt({ + produce() { + return 0; + }, + consume: n => n.toFixed() +}); + +declare function callItT(obj: [(n: number) => T, (x: T) => void]): void; + +callItT([() => 0, n => n.toFixed()]); +callItT([_a => 0, n => n.toFixed()]); + +// Repro from #25092 + +interface MyInterface { + retrieveGeneric: (parameter: string) => T, + operateWithGeneric: (generic: T) => string +} + +const inferTypeFn = (generic: MyInterface) => generic; + +const myGeneric = inferTypeFn({ + retrieveGeneric: parameter => 5, + operateWithGeneric: generic => generic.toFixed() +}); + +// Repro #38623 + +function make(o: { mutations: M, action: (m: M) => void }) { } + +make({ + mutations: { + foo() { } + }, + action: (a) => { a.foo() } +}); + +// Repro from #38845 + +declare function foo(options: { a: A, b: (a: A) => void }): void; + +foo({ + a: () => { return 42 }, + b(a) {}, +}); + +foo({ + a: function () { return 42 }, + b(a) {}, +}); + +foo({ + a() { return 42 }, + b(a) {}, +}); + +// Repro from #38872 + +type Chain = { + a(): R1, + b(a: R1): R2; + c(b: R2): void; +}; + +function test(foo: Chain) {} + +test({ + a: () => 0, + b: (a) => 'a', + c: (b) => { + const x: string = b; + } +}); + +// Repro from #41712 + +class Wrapper { + public value?: T; +} + +type WrappedMap = Record; +type Unwrap = { + [K in keyof D]: D[K] extends Wrapper ? T : never; +}; + +type MappingComponent = { + setup(): { inputs: I; outputs: O }; + map?: (inputs: Unwrap) => Unwrap; +}; + +declare function createMappingComponent(def: MappingComponent): void; + +createMappingComponent({ + setup() { + return { + inputs: { + num: new Wrapper(), + str: new Wrapper() + }, + outputs: { + bool: new Wrapper(), + str: new Wrapper() + } + }; + }, + map(inputs) { + return { + bool: inputs.nonexistent, + str: inputs.num, // Causes error + } + } +}); + +// Repro from #48279 + +function simplified(props: { generator: () => T, receiver: (t: T) => any }) {} + +function whatIWant(props: { generator: (bob: any) => T, receiver: (t: T) => any }) {} + +function nonObject(generator: (bob: any) => T, receiver: (t: T) => any) {} + +simplified({ generator: () => 123, receiver: (t) => console.log(t + 2) }) +whatIWant({ generator: (bob) => bob ? 1 : 2, receiver: (t) => console.log(t + 2) }) +nonObject((bob) => bob ? 1 : 2, (t) => console.log(t + 2)) + +// Repro from #48466 + +interface Opts { + fetch: (params: TParams, foo: number) => TDone, + map: (data: TDone) => TMapped +} + +function example(options: Opts) { + return (params: TParams) => { + const data = options.fetch(params, 123) + return options.map(data) + } +} + +interface Params { + one: number + two: string +} + +example({ + fetch: (params: Params) => 123, + map: (number) => String(number) +}); + +example({ + fetch: (params: Params, foo: number) => 123, + map: (number) => String(number) +}); + +example({ + fetch: (params: Params, foo) => 123, + map: (number) => String(number) +}); + + +//// [intraExpressionInferences.js] +"use strict"; +// Repros from #47599 +callIt({ + produce: function () { return 0; }, + consume: function (n) { return n.toFixed(); } +}); +callIt({ + produce: function (_a) { return 0; }, + consume: function (n) { return n.toFixed(); } +}); +callIt({ + produce: function () { + return 0; + }, + consume: function (n) { return n.toFixed(); } +}); +callItT([function () { return 0; }, function (n) { return n.toFixed(); }]); +callItT([function (_a) { return 0; }, function (n) { return n.toFixed(); }]); +var inferTypeFn = function (generic) { return generic; }; +var myGeneric = inferTypeFn({ + retrieveGeneric: function (parameter) { return 5; }, + operateWithGeneric: function (generic) { return generic.toFixed(); } +}); +// Repro #38623 +function make(o) { } +make({ + mutations: { + foo: function () { } + }, + action: function (a) { a.foo(); } +}); +foo({ + a: function () { return 42; }, + b: function (a) { } +}); +foo({ + a: function () { return 42; }, + b: function (a) { } +}); +foo({ + a: function () { return 42; }, + b: function (a) { } +}); +function test(foo) { } +test({ + a: function () { return 0; }, + b: function (a) { return 'a'; }, + c: function (b) { + var x = b; + } +}); +// Repro from #41712 +var Wrapper = /** @class */ (function () { + function Wrapper() { + } + return Wrapper; +}()); +createMappingComponent({ + setup: function () { + return { + inputs: { + num: new Wrapper(), + str: new Wrapper() + }, + outputs: { + bool: new Wrapper(), + str: new Wrapper() + } + }; + }, + map: function (inputs) { + return { + bool: inputs.nonexistent, + str: inputs.num + }; + } +}); +// Repro from #48279 +function simplified(props) { } +function whatIWant(props) { } +function nonObject(generator, receiver) { } +simplified({ generator: function () { return 123; }, receiver: function (t) { return console.log(t + 2); } }); +whatIWant({ generator: function (bob) { return bob ? 1 : 2; }, receiver: function (t) { return console.log(t + 2); } }); +nonObject(function (bob) { return bob ? 1 : 2; }, function (t) { return console.log(t + 2); }); +function example(options) { + return function (params) { + var data = options.fetch(params, 123); + return options.map(data); + }; +} +example({ + fetch: function (params) { return 123; }, + map: function (number) { return String(number); } +}); +example({ + fetch: function (params, foo) { return 123; }, + map: function (number) { return String(number); } +}); +example({ + fetch: function (params, foo) { return 123; }, + map: function (number) { return String(number); } +}); + + +//// [intraExpressionInferences.d.ts] +declare function callIt(obj: { + produce: (n: number) => T; + consume: (x: T) => void; +}): void; +declare function callItT(obj: [(n: number) => T, (x: T) => void]): void; +interface MyInterface { + retrieveGeneric: (parameter: string) => T; + operateWithGeneric: (generic: T) => string; +} +declare const inferTypeFn: (generic: MyInterface) => MyInterface; +declare const myGeneric: MyInterface; +declare function make(o: { + mutations: M; + action: (m: M) => void; +}): void; +declare function foo(options: { + a: A; + b: (a: A) => void; +}): void; +declare type Chain = { + a(): R1; + b(a: R1): R2; + c(b: R2): void; +}; +declare function test(foo: Chain): void; +declare class Wrapper { + value?: T; +} +declare type WrappedMap = Record; +declare type Unwrap = { + [K in keyof D]: D[K] extends Wrapper ? T : never; +}; +declare type MappingComponent = { + setup(): { + inputs: I; + outputs: O; + }; + map?: (inputs: Unwrap) => Unwrap; +}; +declare function createMappingComponent(def: MappingComponent): void; +declare function simplified(props: { + generator: () => T; + receiver: (t: T) => any; +}): void; +declare function whatIWant(props: { + generator: (bob: any) => T; + receiver: (t: T) => any; +}): void; +declare function nonObject(generator: (bob: any) => T, receiver: (t: T) => any): void; +interface Opts { + fetch: (params: TParams, foo: number) => TDone; + map: (data: TDone) => TMapped; +} +declare function example(options: Opts): (params: TParams) => TMapped; +interface Params { + one: number; + two: string; +} diff --git a/tests/baselines/reference/intraExpressionInferences.symbols b/tests/baselines/reference/intraExpressionInferences.symbols new file mode 100644 index 00000000000..05887ee317b --- /dev/null +++ b/tests/baselines/reference/intraExpressionInferences.symbols @@ -0,0 +1,560 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts === +// Repros from #47599 + +declare function callIt(obj: { +>callIt : Symbol(callIt, Decl(intraExpressionInferences.ts, 0, 0)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 2, 24)) +>obj : Symbol(obj, Decl(intraExpressionInferences.ts, 2, 27)) + + produce: (n: number) => T, +>produce : Symbol(produce, Decl(intraExpressionInferences.ts, 2, 33)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 3, 14)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 2, 24)) + + consume: (x: T) => void +>consume : Symbol(consume, Decl(intraExpressionInferences.ts, 3, 30)) +>x : Symbol(x, Decl(intraExpressionInferences.ts, 4, 14)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 2, 24)) + +}): void; + +callIt({ +>callIt : Symbol(callIt, Decl(intraExpressionInferences.ts, 0, 0)) + + produce: () => 0, +>produce : Symbol(produce, Decl(intraExpressionInferences.ts, 7, 8)) + + consume: n => n.toFixed() +>consume : Symbol(consume, Decl(intraExpressionInferences.ts, 8, 21)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 9, 12)) +>n.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 9, 12)) +>toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) + +}); + +callIt({ +>callIt : Symbol(callIt, Decl(intraExpressionInferences.ts, 0, 0)) + + produce: _a => 0, +>produce : Symbol(produce, Decl(intraExpressionInferences.ts, 12, 8)) +>_a : Symbol(_a, Decl(intraExpressionInferences.ts, 13, 12)) + + consume: n => n.toFixed(), +>consume : Symbol(consume, Decl(intraExpressionInferences.ts, 13, 21)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 14, 12)) +>n.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 14, 12)) +>toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) + +}); + +callIt({ +>callIt : Symbol(callIt, Decl(intraExpressionInferences.ts, 0, 0)) + + produce() { +>produce : Symbol(produce, Decl(intraExpressionInferences.ts, 17, 8)) + + return 0; + }, + consume: n => n.toFixed() +>consume : Symbol(consume, Decl(intraExpressionInferences.ts, 20, 6)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 21, 12)) +>n.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 21, 12)) +>toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) + +}); + +declare function callItT(obj: [(n: number) => T, (x: T) => void]): void; +>callItT : Symbol(callItT, Decl(intraExpressionInferences.ts, 22, 3)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 24, 25)) +>obj : Symbol(obj, Decl(intraExpressionInferences.ts, 24, 28)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 24, 35)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 24, 25)) +>x : Symbol(x, Decl(intraExpressionInferences.ts, 24, 53)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 24, 25)) + +callItT([() => 0, n => n.toFixed()]); +>callItT : Symbol(callItT, Decl(intraExpressionInferences.ts, 22, 3)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 26, 17)) +>n.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 26, 17)) +>toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) + +callItT([_a => 0, n => n.toFixed()]); +>callItT : Symbol(callItT, Decl(intraExpressionInferences.ts, 22, 3)) +>_a : Symbol(_a, Decl(intraExpressionInferences.ts, 27, 9)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 27, 17)) +>n.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) +>n : Symbol(n, Decl(intraExpressionInferences.ts, 27, 17)) +>toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) + +// Repro from #25092 + +interface MyInterface { +>MyInterface : Symbol(MyInterface, Decl(intraExpressionInferences.ts, 27, 37)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 31, 22)) + + retrieveGeneric: (parameter: string) => T, +>retrieveGeneric : Symbol(MyInterface.retrieveGeneric, Decl(intraExpressionInferences.ts, 31, 26)) +>parameter : Symbol(parameter, Decl(intraExpressionInferences.ts, 32, 22)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 31, 22)) + + operateWithGeneric: (generic: T) => string +>operateWithGeneric : Symbol(MyInterface.operateWithGeneric, Decl(intraExpressionInferences.ts, 32, 46)) +>generic : Symbol(generic, Decl(intraExpressionInferences.ts, 33, 25)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 31, 22)) +} + +const inferTypeFn = (generic: MyInterface) => generic; +>inferTypeFn : Symbol(inferTypeFn, Decl(intraExpressionInferences.ts, 36, 5)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 36, 21)) +>generic : Symbol(generic, Decl(intraExpressionInferences.ts, 36, 24)) +>MyInterface : Symbol(MyInterface, Decl(intraExpressionInferences.ts, 27, 37)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 36, 21)) +>generic : Symbol(generic, Decl(intraExpressionInferences.ts, 36, 24)) + +const myGeneric = inferTypeFn({ +>myGeneric : Symbol(myGeneric, Decl(intraExpressionInferences.ts, 38, 5)) +>inferTypeFn : Symbol(inferTypeFn, Decl(intraExpressionInferences.ts, 36, 5)) + + retrieveGeneric: parameter => 5, +>retrieveGeneric : Symbol(retrieveGeneric, Decl(intraExpressionInferences.ts, 38, 31)) +>parameter : Symbol(parameter, Decl(intraExpressionInferences.ts, 39, 20)) + + operateWithGeneric: generic => generic.toFixed() +>operateWithGeneric : Symbol(operateWithGeneric, Decl(intraExpressionInferences.ts, 39, 36)) +>generic : Symbol(generic, Decl(intraExpressionInferences.ts, 40, 23)) +>generic.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) +>generic : Symbol(generic, Decl(intraExpressionInferences.ts, 40, 23)) +>toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --)) + +}); + +// Repro #38623 + +function make(o: { mutations: M, action: (m: M) => void }) { } +>make : Symbol(make, Decl(intraExpressionInferences.ts, 41, 3)) +>M : Symbol(M, Decl(intraExpressionInferences.ts, 45, 14)) +>o : Symbol(o, Decl(intraExpressionInferences.ts, 45, 17)) +>mutations : Symbol(mutations, Decl(intraExpressionInferences.ts, 45, 21)) +>M : Symbol(M, Decl(intraExpressionInferences.ts, 45, 14)) +>action : Symbol(action, Decl(intraExpressionInferences.ts, 45, 35)) +>m : Symbol(m, Decl(intraExpressionInferences.ts, 45, 46)) +>M : Symbol(M, Decl(intraExpressionInferences.ts, 45, 14)) + +make({ +>make : Symbol(make, Decl(intraExpressionInferences.ts, 41, 3)) + + mutations: { +>mutations : Symbol(mutations, Decl(intraExpressionInferences.ts, 47, 6)) + + foo() { } +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 48, 15)) + + }, + action: (a) => { a.foo() } +>action : Symbol(action, Decl(intraExpressionInferences.ts, 50, 5)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 51, 12)) +>a.foo : Symbol(foo, Decl(intraExpressionInferences.ts, 48, 15)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 51, 12)) +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 48, 15)) + +}); + +// Repro from #38845 + +declare function foo(options: { a: A, b: (a: A) => void }): void; +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 52, 3)) +>A : Symbol(A, Decl(intraExpressionInferences.ts, 56, 21)) +>options : Symbol(options, Decl(intraExpressionInferences.ts, 56, 24)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 56, 34)) +>A : Symbol(A, Decl(intraExpressionInferences.ts, 56, 21)) +>b : Symbol(b, Decl(intraExpressionInferences.ts, 56, 40)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 56, 45)) +>A : Symbol(A, Decl(intraExpressionInferences.ts, 56, 21)) + +foo({ +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 52, 3)) + + a: () => { return 42 }, +>a : Symbol(a, Decl(intraExpressionInferences.ts, 58, 5)) + + b(a) {}, +>b : Symbol(b, Decl(intraExpressionInferences.ts, 59, 27)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 60, 6)) + +}); + +foo({ +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 52, 3)) + + a: function () { return 42 }, +>a : Symbol(a, Decl(intraExpressionInferences.ts, 63, 5)) + + b(a) {}, +>b : Symbol(b, Decl(intraExpressionInferences.ts, 64, 33)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 65, 6)) + +}); + +foo({ +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 52, 3)) + + a() { return 42 }, +>a : Symbol(a, Decl(intraExpressionInferences.ts, 68, 5)) + + b(a) {}, +>b : Symbol(b, Decl(intraExpressionInferences.ts, 69, 22)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 70, 6)) + +}); + +// Repro from #38872 + +type Chain = { +>Chain : Symbol(Chain, Decl(intraExpressionInferences.ts, 71, 3)) +>R1 : Symbol(R1, Decl(intraExpressionInferences.ts, 75, 11)) +>R2 : Symbol(R2, Decl(intraExpressionInferences.ts, 75, 14)) + + a(): R1, +>a : Symbol(a, Decl(intraExpressionInferences.ts, 75, 22)) +>R1 : Symbol(R1, Decl(intraExpressionInferences.ts, 75, 11)) + + b(a: R1): R2; +>b : Symbol(b, Decl(intraExpressionInferences.ts, 76, 12)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 77, 6)) +>R1 : Symbol(R1, Decl(intraExpressionInferences.ts, 75, 11)) +>R2 : Symbol(R2, Decl(intraExpressionInferences.ts, 75, 14)) + + c(b: R2): void; +>c : Symbol(c, Decl(intraExpressionInferences.ts, 77, 17)) +>b : Symbol(b, Decl(intraExpressionInferences.ts, 78, 6)) +>R2 : Symbol(R2, Decl(intraExpressionInferences.ts, 75, 14)) + +}; + +function test(foo: Chain) {} +>test : Symbol(test, Decl(intraExpressionInferences.ts, 79, 2)) +>R1 : Symbol(R1, Decl(intraExpressionInferences.ts, 81, 14)) +>R2 : Symbol(R2, Decl(intraExpressionInferences.ts, 81, 17)) +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 81, 22)) +>Chain : Symbol(Chain, Decl(intraExpressionInferences.ts, 71, 3)) +>R1 : Symbol(R1, Decl(intraExpressionInferences.ts, 81, 14)) +>R2 : Symbol(R2, Decl(intraExpressionInferences.ts, 81, 17)) + +test({ +>test : Symbol(test, Decl(intraExpressionInferences.ts, 79, 2)) + + a: () => 0, +>a : Symbol(a, Decl(intraExpressionInferences.ts, 83, 6)) + + b: (a) => 'a', +>b : Symbol(b, Decl(intraExpressionInferences.ts, 84, 15)) +>a : Symbol(a, Decl(intraExpressionInferences.ts, 85, 8)) + + c: (b) => { +>c : Symbol(c, Decl(intraExpressionInferences.ts, 85, 18)) +>b : Symbol(b, Decl(intraExpressionInferences.ts, 86, 8)) + + const x: string = b; +>x : Symbol(x, Decl(intraExpressionInferences.ts, 87, 13)) +>b : Symbol(b, Decl(intraExpressionInferences.ts, 86, 8)) + } +}); + +// Repro from #41712 + +class Wrapper { +>Wrapper : Symbol(Wrapper, Decl(intraExpressionInferences.ts, 89, 3)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 93, 14)) + + public value?: T; +>value : Symbol(Wrapper.value, Decl(intraExpressionInferences.ts, 93, 24)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 93, 14)) +} + +type WrappedMap = Record; +>WrappedMap : Symbol(WrappedMap, Decl(intraExpressionInferences.ts, 95, 1)) +>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --)) +>Wrapper : Symbol(Wrapper, Decl(intraExpressionInferences.ts, 89, 3)) + +type Unwrap = { +>Unwrap : Symbol(Unwrap, Decl(intraExpressionInferences.ts, 97, 42)) +>D : Symbol(D, Decl(intraExpressionInferences.ts, 98, 12)) +>WrappedMap : Symbol(WrappedMap, Decl(intraExpressionInferences.ts, 95, 1)) + + [K in keyof D]: D[K] extends Wrapper ? T : never; +>K : Symbol(K, Decl(intraExpressionInferences.ts, 99, 5)) +>D : Symbol(D, Decl(intraExpressionInferences.ts, 98, 12)) +>D : Symbol(D, Decl(intraExpressionInferences.ts, 98, 12)) +>K : Symbol(K, Decl(intraExpressionInferences.ts, 99, 5)) +>Wrapper : Symbol(Wrapper, Decl(intraExpressionInferences.ts, 89, 3)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 99, 46)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 99, 46)) + +}; + +type MappingComponent = { +>MappingComponent : Symbol(MappingComponent, Decl(intraExpressionInferences.ts, 100, 2)) +>I : Symbol(I, Decl(intraExpressionInferences.ts, 102, 22)) +>WrappedMap : Symbol(WrappedMap, Decl(intraExpressionInferences.ts, 95, 1)) +>O : Symbol(O, Decl(intraExpressionInferences.ts, 102, 43)) +>WrappedMap : Symbol(WrappedMap, Decl(intraExpressionInferences.ts, 95, 1)) + + setup(): { inputs: I; outputs: O }; +>setup : Symbol(setup, Decl(intraExpressionInferences.ts, 102, 69)) +>inputs : Symbol(inputs, Decl(intraExpressionInferences.ts, 103, 14)) +>I : Symbol(I, Decl(intraExpressionInferences.ts, 102, 22)) +>outputs : Symbol(outputs, Decl(intraExpressionInferences.ts, 103, 25)) +>O : Symbol(O, Decl(intraExpressionInferences.ts, 102, 43)) + + map?: (inputs: Unwrap) => Unwrap; +>map : Symbol(map, Decl(intraExpressionInferences.ts, 103, 39)) +>inputs : Symbol(inputs, Decl(intraExpressionInferences.ts, 104, 11)) +>Unwrap : Symbol(Unwrap, Decl(intraExpressionInferences.ts, 97, 42)) +>I : Symbol(I, Decl(intraExpressionInferences.ts, 102, 22)) +>Unwrap : Symbol(Unwrap, Decl(intraExpressionInferences.ts, 97, 42)) +>O : Symbol(O, Decl(intraExpressionInferences.ts, 102, 43)) + +}; + +declare function createMappingComponent(def: MappingComponent): void; +>createMappingComponent : Symbol(createMappingComponent, Decl(intraExpressionInferences.ts, 105, 2)) +>I : Symbol(I, Decl(intraExpressionInferences.ts, 107, 40)) +>WrappedMap : Symbol(WrappedMap, Decl(intraExpressionInferences.ts, 95, 1)) +>O : Symbol(O, Decl(intraExpressionInferences.ts, 107, 61)) +>WrappedMap : Symbol(WrappedMap, Decl(intraExpressionInferences.ts, 95, 1)) +>def : Symbol(def, Decl(intraExpressionInferences.ts, 107, 84)) +>MappingComponent : Symbol(MappingComponent, Decl(intraExpressionInferences.ts, 100, 2)) +>I : Symbol(I, Decl(intraExpressionInferences.ts, 107, 40)) +>O : Symbol(O, Decl(intraExpressionInferences.ts, 107, 61)) + +createMappingComponent({ +>createMappingComponent : Symbol(createMappingComponent, Decl(intraExpressionInferences.ts, 105, 2)) + + setup() { +>setup : Symbol(setup, Decl(intraExpressionInferences.ts, 109, 24)) + + return { + inputs: { +>inputs : Symbol(inputs, Decl(intraExpressionInferences.ts, 111, 16)) + + num: new Wrapper(), +>num : Symbol(num, Decl(intraExpressionInferences.ts, 112, 21)) +>Wrapper : Symbol(Wrapper, Decl(intraExpressionInferences.ts, 89, 3)) + + str: new Wrapper() +>str : Symbol(str, Decl(intraExpressionInferences.ts, 113, 43)) +>Wrapper : Symbol(Wrapper, Decl(intraExpressionInferences.ts, 89, 3)) + + }, + outputs: { +>outputs : Symbol(outputs, Decl(intraExpressionInferences.ts, 115, 14)) + + bool: new Wrapper(), +>bool : Symbol(bool, Decl(intraExpressionInferences.ts, 116, 22)) +>Wrapper : Symbol(Wrapper, Decl(intraExpressionInferences.ts, 89, 3)) + + str: new Wrapper() +>str : Symbol(str, Decl(intraExpressionInferences.ts, 117, 45)) +>Wrapper : Symbol(Wrapper, Decl(intraExpressionInferences.ts, 89, 3)) + } + }; + }, + map(inputs) { +>map : Symbol(map, Decl(intraExpressionInferences.ts, 121, 6)) +>inputs : Symbol(inputs, Decl(intraExpressionInferences.ts, 122, 8)) + + return { + bool: inputs.nonexistent, +>bool : Symbol(bool, Decl(intraExpressionInferences.ts, 123, 16)) +>inputs : Symbol(inputs, Decl(intraExpressionInferences.ts, 122, 8)) + + str: inputs.num, // Causes error +>str : Symbol(str, Decl(intraExpressionInferences.ts, 124, 37)) +>inputs.num : Symbol(num, Decl(intraExpressionInferences.ts, 112, 21)) +>inputs : Symbol(inputs, Decl(intraExpressionInferences.ts, 122, 8)) +>num : Symbol(num, Decl(intraExpressionInferences.ts, 112, 21)) + } + } +}); + +// Repro from #48279 + +function simplified(props: { generator: () => T, receiver: (t: T) => any }) {} +>simplified : Symbol(simplified, Decl(intraExpressionInferences.ts, 128, 3)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 132, 20)) +>props : Symbol(props, Decl(intraExpressionInferences.ts, 132, 23)) +>generator : Symbol(generator, Decl(intraExpressionInferences.ts, 132, 31)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 132, 20)) +>receiver : Symbol(receiver, Decl(intraExpressionInferences.ts, 132, 51)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 132, 63)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 132, 20)) + +function whatIWant(props: { generator: (bob: any) => T, receiver: (t: T) => any }) {} +>whatIWant : Symbol(whatIWant, Decl(intraExpressionInferences.ts, 132, 81)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 134, 19)) +>props : Symbol(props, Decl(intraExpressionInferences.ts, 134, 22)) +>generator : Symbol(generator, Decl(intraExpressionInferences.ts, 134, 30)) +>bob : Symbol(bob, Decl(intraExpressionInferences.ts, 134, 43)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 134, 19)) +>receiver : Symbol(receiver, Decl(intraExpressionInferences.ts, 134, 58)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 134, 70)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 134, 19)) + +function nonObject(generator: (bob: any) => T, receiver: (t: T) => any) {} +>nonObject : Symbol(nonObject, Decl(intraExpressionInferences.ts, 134, 88)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 136, 19)) +>generator : Symbol(generator, Decl(intraExpressionInferences.ts, 136, 22)) +>bob : Symbol(bob, Decl(intraExpressionInferences.ts, 136, 34)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 136, 19)) +>receiver : Symbol(receiver, Decl(intraExpressionInferences.ts, 136, 49)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 136, 61)) +>T : Symbol(T, Decl(intraExpressionInferences.ts, 136, 19)) + +simplified({ generator: () => 123, receiver: (t) => console.log(t + 2) }) +>simplified : Symbol(simplified, Decl(intraExpressionInferences.ts, 128, 3)) +>generator : Symbol(generator, Decl(intraExpressionInferences.ts, 138, 12)) +>receiver : Symbol(receiver, Decl(intraExpressionInferences.ts, 138, 34)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 138, 46)) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 138, 46)) + +whatIWant({ generator: (bob) => bob ? 1 : 2, receiver: (t) => console.log(t + 2) }) +>whatIWant : Symbol(whatIWant, Decl(intraExpressionInferences.ts, 132, 81)) +>generator : Symbol(generator, Decl(intraExpressionInferences.ts, 139, 11)) +>bob : Symbol(bob, Decl(intraExpressionInferences.ts, 139, 24)) +>bob : Symbol(bob, Decl(intraExpressionInferences.ts, 139, 24)) +>receiver : Symbol(receiver, Decl(intraExpressionInferences.ts, 139, 44)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 139, 56)) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 139, 56)) + +nonObject((bob) => bob ? 1 : 2, (t) => console.log(t + 2)) +>nonObject : Symbol(nonObject, Decl(intraExpressionInferences.ts, 134, 88)) +>bob : Symbol(bob, Decl(intraExpressionInferences.ts, 140, 11)) +>bob : Symbol(bob, Decl(intraExpressionInferences.ts, 140, 11)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 140, 33)) +>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) +>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) +>t : Symbol(t, Decl(intraExpressionInferences.ts, 140, 33)) + +// Repro from #48466 + +interface Opts { +>Opts : Symbol(Opts, Decl(intraExpressionInferences.ts, 140, 58)) +>TParams : Symbol(TParams, Decl(intraExpressionInferences.ts, 144, 15)) +>TDone : Symbol(TDone, Decl(intraExpressionInferences.ts, 144, 23)) +>TMapped : Symbol(TMapped, Decl(intraExpressionInferences.ts, 144, 30)) + + fetch: (params: TParams, foo: number) => TDone, +>fetch : Symbol(Opts.fetch, Decl(intraExpressionInferences.ts, 144, 41)) +>params : Symbol(params, Decl(intraExpressionInferences.ts, 145, 12)) +>TParams : Symbol(TParams, Decl(intraExpressionInferences.ts, 144, 15)) +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 145, 28)) +>TDone : Symbol(TDone, Decl(intraExpressionInferences.ts, 144, 23)) + + map: (data: TDone) => TMapped +>map : Symbol(Opts.map, Decl(intraExpressionInferences.ts, 145, 51)) +>data : Symbol(data, Decl(intraExpressionInferences.ts, 146, 10)) +>TDone : Symbol(TDone, Decl(intraExpressionInferences.ts, 144, 23)) +>TMapped : Symbol(TMapped, Decl(intraExpressionInferences.ts, 144, 30)) +} + +function example(options: Opts) { +>example : Symbol(example, Decl(intraExpressionInferences.ts, 147, 1)) +>TParams : Symbol(TParams, Decl(intraExpressionInferences.ts, 149, 17)) +>TDone : Symbol(TDone, Decl(intraExpressionInferences.ts, 149, 25)) +>TMapped : Symbol(TMapped, Decl(intraExpressionInferences.ts, 149, 32)) +>options : Symbol(options, Decl(intraExpressionInferences.ts, 149, 42)) +>Opts : Symbol(Opts, Decl(intraExpressionInferences.ts, 140, 58)) +>TParams : Symbol(TParams, Decl(intraExpressionInferences.ts, 149, 17)) +>TDone : Symbol(TDone, Decl(intraExpressionInferences.ts, 149, 25)) +>TMapped : Symbol(TMapped, Decl(intraExpressionInferences.ts, 149, 32)) + + return (params: TParams) => { +>params : Symbol(params, Decl(intraExpressionInferences.ts, 150, 12)) +>TParams : Symbol(TParams, Decl(intraExpressionInferences.ts, 149, 17)) + + const data = options.fetch(params, 123) +>data : Symbol(data, Decl(intraExpressionInferences.ts, 151, 13)) +>options.fetch : Symbol(Opts.fetch, Decl(intraExpressionInferences.ts, 144, 41)) +>options : Symbol(options, Decl(intraExpressionInferences.ts, 149, 42)) +>fetch : Symbol(Opts.fetch, Decl(intraExpressionInferences.ts, 144, 41)) +>params : Symbol(params, Decl(intraExpressionInferences.ts, 150, 12)) + + return options.map(data) +>options.map : Symbol(Opts.map, Decl(intraExpressionInferences.ts, 145, 51)) +>options : Symbol(options, Decl(intraExpressionInferences.ts, 149, 42)) +>map : Symbol(Opts.map, Decl(intraExpressionInferences.ts, 145, 51)) +>data : Symbol(data, Decl(intraExpressionInferences.ts, 151, 13)) + } +} + +interface Params { +>Params : Symbol(Params, Decl(intraExpressionInferences.ts, 154, 1)) + + one: number +>one : Symbol(Params.one, Decl(intraExpressionInferences.ts, 156, 18)) + + two: string +>two : Symbol(Params.two, Decl(intraExpressionInferences.ts, 157, 15)) +} + +example({ +>example : Symbol(example, Decl(intraExpressionInferences.ts, 147, 1)) + + fetch: (params: Params) => 123, +>fetch : Symbol(fetch, Decl(intraExpressionInferences.ts, 161, 9)) +>params : Symbol(params, Decl(intraExpressionInferences.ts, 162, 12)) +>Params : Symbol(Params, Decl(intraExpressionInferences.ts, 154, 1)) + + map: (number) => String(number) +>map : Symbol(map, Decl(intraExpressionInferences.ts, 162, 35)) +>number : Symbol(number, Decl(intraExpressionInferences.ts, 163, 10)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>number : Symbol(number, Decl(intraExpressionInferences.ts, 163, 10)) + +}); + +example({ +>example : Symbol(example, Decl(intraExpressionInferences.ts, 147, 1)) + + fetch: (params: Params, foo: number) => 123, +>fetch : Symbol(fetch, Decl(intraExpressionInferences.ts, 166, 9)) +>params : Symbol(params, Decl(intraExpressionInferences.ts, 167, 12)) +>Params : Symbol(Params, Decl(intraExpressionInferences.ts, 154, 1)) +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 167, 27)) + + map: (number) => String(number) +>map : Symbol(map, Decl(intraExpressionInferences.ts, 167, 48)) +>number : Symbol(number, Decl(intraExpressionInferences.ts, 168, 10)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>number : Symbol(number, Decl(intraExpressionInferences.ts, 168, 10)) + +}); + +example({ +>example : Symbol(example, Decl(intraExpressionInferences.ts, 147, 1)) + + fetch: (params: Params, foo) => 123, +>fetch : Symbol(fetch, Decl(intraExpressionInferences.ts, 171, 9)) +>params : Symbol(params, Decl(intraExpressionInferences.ts, 172, 12)) +>Params : Symbol(Params, Decl(intraExpressionInferences.ts, 154, 1)) +>foo : Symbol(foo, Decl(intraExpressionInferences.ts, 172, 27)) + + map: (number) => String(number) +>map : Symbol(map, Decl(intraExpressionInferences.ts, 172, 40)) +>number : Symbol(number, Decl(intraExpressionInferences.ts, 173, 10)) +>String : Symbol(String, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --)) +>number : Symbol(number, Decl(intraExpressionInferences.ts, 173, 10)) + +}); + diff --git a/tests/baselines/reference/intraExpressionInferences.types b/tests/baselines/reference/intraExpressionInferences.types new file mode 100644 index 00000000000..50a99ac34fe --- /dev/null +++ b/tests/baselines/reference/intraExpressionInferences.types @@ -0,0 +1,590 @@ +=== tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts === +// Repros from #47599 + +declare function callIt(obj: { +>callIt : (obj: { produce: (n: number) => T; consume: (x: T) => void; }) => void +>obj : { produce: (n: number) => T; consume: (x: T) => void; } + + produce: (n: number) => T, +>produce : (n: number) => T +>n : number + + consume: (x: T) => void +>consume : (x: T) => void +>x : T + +}): void; + +callIt({ +>callIt({ produce: () => 0, consume: n => n.toFixed()}) : void +>callIt : (obj: { produce: (n: number) => T; consume: (x: T) => void; }) => void +>{ produce: () => 0, consume: n => n.toFixed()} : { produce: () => number; consume: (n: number) => string; } + + produce: () => 0, +>produce : () => number +>() => 0 : () => number +>0 : 0 + + consume: n => n.toFixed() +>consume : (n: number) => string +>n => n.toFixed() : (n: number) => string +>n : number +>n.toFixed() : string +>n.toFixed : (fractionDigits?: number | undefined) => string +>n : number +>toFixed : (fractionDigits?: number | undefined) => string + +}); + +callIt({ +>callIt({ produce: _a => 0, consume: n => n.toFixed(),}) : void +>callIt : (obj: { produce: (n: number) => T; consume: (x: T) => void; }) => void +>{ produce: _a => 0, consume: n => n.toFixed(),} : { produce: (_a: number) => number; consume: (n: number) => string; } + + produce: _a => 0, +>produce : (_a: number) => number +>_a => 0 : (_a: number) => number +>_a : number +>0 : 0 + + consume: n => n.toFixed(), +>consume : (n: number) => string +>n => n.toFixed() : (n: number) => string +>n : number +>n.toFixed() : string +>n.toFixed : (fractionDigits?: number | undefined) => string +>n : number +>toFixed : (fractionDigits?: number | undefined) => string + +}); + +callIt({ +>callIt({ produce() { return 0; }, consume: n => n.toFixed()}) : void +>callIt : (obj: { produce: (n: number) => T; consume: (x: T) => void; }) => void +>{ produce() { return 0; }, consume: n => n.toFixed()} : { produce(): number; consume: (n: number) => string; } + + produce() { +>produce : () => number + + return 0; +>0 : 0 + + }, + consume: n => n.toFixed() +>consume : (n: number) => string +>n => n.toFixed() : (n: number) => string +>n : number +>n.toFixed() : string +>n.toFixed : (fractionDigits?: number | undefined) => string +>n : number +>toFixed : (fractionDigits?: number | undefined) => string + +}); + +declare function callItT(obj: [(n: number) => T, (x: T) => void]): void; +>callItT : (obj: [(n: number) => T, (x: T) => void]) => void +>obj : [(n: number) => T, (x: T) => void] +>n : number +>x : T + +callItT([() => 0, n => n.toFixed()]); +>callItT([() => 0, n => n.toFixed()]) : void +>callItT : (obj: [(n: number) => T, (x: T) => void]) => void +>[() => 0, n => n.toFixed()] : [() => number, (n: number) => string] +>() => 0 : () => number +>0 : 0 +>n => n.toFixed() : (n: number) => string +>n : number +>n.toFixed() : string +>n.toFixed : (fractionDigits?: number | undefined) => string +>n : number +>toFixed : (fractionDigits?: number | undefined) => string + +callItT([_a => 0, n => n.toFixed()]); +>callItT([_a => 0, n => n.toFixed()]) : void +>callItT : (obj: [(n: number) => T, (x: T) => void]) => void +>[_a => 0, n => n.toFixed()] : [(_a: number) => number, (n: number) => string] +>_a => 0 : (_a: number) => number +>_a : number +>0 : 0 +>n => n.toFixed() : (n: number) => string +>n : number +>n.toFixed() : string +>n.toFixed : (fractionDigits?: number | undefined) => string +>n : number +>toFixed : (fractionDigits?: number | undefined) => string + +// Repro from #25092 + +interface MyInterface { + retrieveGeneric: (parameter: string) => T, +>retrieveGeneric : (parameter: string) => T +>parameter : string + + operateWithGeneric: (generic: T) => string +>operateWithGeneric : (generic: T) => string +>generic : T +} + +const inferTypeFn = (generic: MyInterface) => generic; +>inferTypeFn : (generic: MyInterface) => MyInterface +>(generic: MyInterface) => generic : (generic: MyInterface) => MyInterface +>generic : MyInterface +>generic : MyInterface + +const myGeneric = inferTypeFn({ +>myGeneric : MyInterface +>inferTypeFn({ retrieveGeneric: parameter => 5, operateWithGeneric: generic => generic.toFixed()}) : MyInterface +>inferTypeFn : (generic: MyInterface) => MyInterface +>{ retrieveGeneric: parameter => 5, operateWithGeneric: generic => generic.toFixed()} : { retrieveGeneric: (parameter: string) => number; operateWithGeneric: (generic: number) => string; } + + retrieveGeneric: parameter => 5, +>retrieveGeneric : (parameter: string) => number +>parameter => 5 : (parameter: string) => number +>parameter : string +>5 : 5 + + operateWithGeneric: generic => generic.toFixed() +>operateWithGeneric : (generic: number) => string +>generic => generic.toFixed() : (generic: number) => string +>generic : number +>generic.toFixed() : string +>generic.toFixed : (fractionDigits?: number | undefined) => string +>generic : number +>toFixed : (fractionDigits?: number | undefined) => string + +}); + +// Repro #38623 + +function make(o: { mutations: M, action: (m: M) => void }) { } +>make : (o: { mutations: M; action: (m: M) => void; }) => void +>o : { mutations: M; action: (m: M) => void; } +>mutations : M +>action : (m: M) => void +>m : M + +make({ +>make({ mutations: { foo() { } }, action: (a) => { a.foo() }}) : void +>make : (o: { mutations: M; action: (m: M) => void; }) => void +>{ mutations: { foo() { } }, action: (a) => { a.foo() }} : { mutations: { foo(): void; }; action: (a: { foo(): void; }) => void; } + + mutations: { +>mutations : { foo(): void; } +>{ foo() { } } : { foo(): void; } + + foo() { } +>foo : () => void + + }, + action: (a) => { a.foo() } +>action : (a: { foo(): void; }) => void +>(a) => { a.foo() } : (a: { foo(): void; }) => void +>a : { foo(): void; } +>a.foo() : void +>a.foo : () => void +>a : { foo(): void; } +>foo : () => void + +}); + +// Repro from #38845 + +declare function foo(options: { a: A, b: (a: A) => void }): void; +>foo : (options: { a: A; b: (a: A) => void; }) => void +>options : { a: A; b: (a: A) => void; } +>a : A +>b : (a: A) => void +>a : A + +foo({ +>foo({ a: () => { return 42 }, b(a) {},}) : void +>foo : (options: { a: A; b: (a: A) => void; }) => void +>{ a: () => { return 42 }, b(a) {},} : { a: () => 42; b(a: () => 42): void; } + + a: () => { return 42 }, +>a : () => 42 +>() => { return 42 } : () => 42 +>42 : 42 + + b(a) {}, +>b : (a: () => 42) => void +>a : () => 42 + +}); + +foo({ +>foo({ a: function () { return 42 }, b(a) {},}) : void +>foo : (options: { a: A; b: (a: A) => void; }) => void +>{ a: function () { return 42 }, b(a) {},} : { a: () => 42; b(a: () => 42): void; } + + a: function () { return 42 }, +>a : () => 42 +>function () { return 42 } : () => 42 +>42 : 42 + + b(a) {}, +>b : (a: () => 42) => void +>a : () => 42 + +}); + +foo({ +>foo({ a() { return 42 }, b(a) {},}) : void +>foo : (options: { a: A; b: (a: A) => void; }) => void +>{ a() { return 42 }, b(a) {},} : { a(): 42; b(a: () => 42): void; } + + a() { return 42 }, +>a : () => 42 +>42 : 42 + + b(a) {}, +>b : (a: () => 42) => void +>a : () => 42 + +}); + +// Repro from #38872 + +type Chain = { +>Chain : Chain + + a(): R1, +>a : () => R1 + + b(a: R1): R2; +>b : (a: R1) => R2 +>a : R1 + + c(b: R2): void; +>c : (b: R2) => void +>b : R2 + +}; + +function test(foo: Chain) {} +>test : (foo: Chain) => void +>foo : Chain + +test({ +>test({ a: () => 0, b: (a) => 'a', c: (b) => { const x: string = b; }}) : void +>test : (foo: Chain) => void +>{ a: () => 0, b: (a) => 'a', c: (b) => { const x: string = b; }} : { a: () => number; b: (a: number) => string; c: (b: string) => void; } + + a: () => 0, +>a : () => number +>() => 0 : () => number +>0 : 0 + + b: (a) => 'a', +>b : (a: number) => string +>(a) => 'a' : (a: number) => string +>a : number +>'a' : "a" + + c: (b) => { +>c : (b: string) => void +>(b) => { const x: string = b; } : (b: string) => void +>b : string + + const x: string = b; +>x : string +>b : string + } +}); + +// Repro from #41712 + +class Wrapper { +>Wrapper : Wrapper + + public value?: T; +>value : T | undefined +} + +type WrappedMap = Record; +>WrappedMap : WrappedMap + +type Unwrap = { +>Unwrap : Unwrap + + [K in keyof D]: D[K] extends Wrapper ? T : never; +}; + +type MappingComponent = { +>MappingComponent : MappingComponent + + setup(): { inputs: I; outputs: O }; +>setup : () => { inputs: I; outputs: O;} +>inputs : I +>outputs : O + + map?: (inputs: Unwrap) => Unwrap; +>map : ((inputs: Unwrap) => Unwrap) | undefined +>inputs : Unwrap + +}; + +declare function createMappingComponent(def: MappingComponent): void; +>createMappingComponent : (def: MappingComponent) => void +>def : MappingComponent + +createMappingComponent({ +>createMappingComponent({ setup() { return { inputs: { num: new Wrapper(), str: new Wrapper() }, outputs: { bool: new Wrapper(), str: new Wrapper() } }; }, map(inputs) { return { bool: inputs.nonexistent, str: inputs.num, // Causes error } }}) : void +>createMappingComponent : (def: MappingComponent) => void +>{ setup() { return { inputs: { num: new Wrapper(), str: new Wrapper() }, outputs: { bool: new Wrapper(), str: new Wrapper() } }; }, map(inputs) { return { bool: inputs.nonexistent, str: inputs.num, // Causes error } }} : { setup(): { inputs: { num: Wrapper; str: Wrapper; }; outputs: { bool: Wrapper; str: Wrapper; }; }; map(inputs: Unwrap<{ num: Wrapper; str: Wrapper; }>): { bool: any; str: number; }; } + + setup() { +>setup : () => { inputs: { num: Wrapper; str: Wrapper; }; outputs: { bool: Wrapper; str: Wrapper; }; } + + return { +>{ inputs: { num: new Wrapper(), str: new Wrapper() }, outputs: { bool: new Wrapper(), str: new Wrapper() } } : { inputs: { num: Wrapper; str: Wrapper; }; outputs: { bool: Wrapper; str: Wrapper; }; } + + inputs: { +>inputs : { num: Wrapper; str: Wrapper; } +>{ num: new Wrapper(), str: new Wrapper() } : { num: Wrapper; str: Wrapper; } + + num: new Wrapper(), +>num : Wrapper +>new Wrapper() : Wrapper +>Wrapper : typeof Wrapper + + str: new Wrapper() +>str : Wrapper +>new Wrapper() : Wrapper +>Wrapper : typeof Wrapper + + }, + outputs: { +>outputs : { bool: Wrapper; str: Wrapper; } +>{ bool: new Wrapper(), str: new Wrapper() } : { bool: Wrapper; str: Wrapper; } + + bool: new Wrapper(), +>bool : Wrapper +>new Wrapper() : Wrapper +>Wrapper : typeof Wrapper + + str: new Wrapper() +>str : Wrapper +>new Wrapper() : Wrapper +>Wrapper : typeof Wrapper + } + }; + }, + map(inputs) { +>map : (inputs: Unwrap<{ num: Wrapper; str: Wrapper; }>) => { bool: any; str: number; } +>inputs : Unwrap<{ num: Wrapper; str: Wrapper; }> + + return { +>{ bool: inputs.nonexistent, str: inputs.num, // Causes error } : { bool: any; str: number; } + + bool: inputs.nonexistent, +>bool : any +>inputs.nonexistent : any +>inputs : Unwrap<{ num: Wrapper; str: Wrapper; }> +>nonexistent : any + + str: inputs.num, // Causes error +>str : number +>inputs.num : number +>inputs : Unwrap<{ num: Wrapper; str: Wrapper; }> +>num : number + } + } +}); + +// Repro from #48279 + +function simplified(props: { generator: () => T, receiver: (t: T) => any }) {} +>simplified : (props: { generator: () => T; receiver: (t: T) => any; }) => void +>props : { generator: () => T; receiver: (t: T) => any; } +>generator : () => T +>receiver : (t: T) => any +>t : T + +function whatIWant(props: { generator: (bob: any) => T, receiver: (t: T) => any }) {} +>whatIWant : (props: { generator: (bob: any) => T; receiver: (t: T) => any; }) => void +>props : { generator: (bob: any) => T; receiver: (t: T) => any; } +>generator : (bob: any) => T +>bob : any +>receiver : (t: T) => any +>t : T + +function nonObject(generator: (bob: any) => T, receiver: (t: T) => any) {} +>nonObject : (generator: (bob: any) => T, receiver: (t: T) => any) => void +>generator : (bob: any) => T +>bob : any +>receiver : (t: T) => any +>t : T + +simplified({ generator: () => 123, receiver: (t) => console.log(t + 2) }) +>simplified({ generator: () => 123, receiver: (t) => console.log(t + 2) }) : void +>simplified : (props: { generator: () => T; receiver: (t: T) => any; }) => void +>{ generator: () => 123, receiver: (t) => console.log(t + 2) } : { generator: () => number; receiver: (t: number) => void; } +>generator : () => number +>() => 123 : () => number +>123 : 123 +>receiver : (t: number) => void +>(t) => console.log(t + 2) : (t: number) => void +>t : number +>console.log(t + 2) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>t + 2 : number +>t : number +>2 : 2 + +whatIWant({ generator: (bob) => bob ? 1 : 2, receiver: (t) => console.log(t + 2) }) +>whatIWant({ generator: (bob) => bob ? 1 : 2, receiver: (t) => console.log(t + 2) }) : void +>whatIWant : (props: { generator: (bob: any) => T; receiver: (t: T) => any; }) => void +>{ generator: (bob) => bob ? 1 : 2, receiver: (t) => console.log(t + 2) } : { generator: (bob: any) => 2 | 1; receiver: (t: 2 | 1) => void; } +>generator : (bob: any) => 2 | 1 +>(bob) => bob ? 1 : 2 : (bob: any) => 2 | 1 +>bob : any +>bob ? 1 : 2 : 2 | 1 +>bob : any +>1 : 1 +>2 : 2 +>receiver : (t: 2 | 1) => void +>(t) => console.log(t + 2) : (t: 2 | 1) => void +>t : 2 | 1 +>console.log(t + 2) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>t + 2 : number +>t : 2 | 1 +>2 : 2 + +nonObject((bob) => bob ? 1 : 2, (t) => console.log(t + 2)) +>nonObject((bob) => bob ? 1 : 2, (t) => console.log(t + 2)) : void +>nonObject : (generator: (bob: any) => T, receiver: (t: T) => any) => void +>(bob) => bob ? 1 : 2 : (bob: any) => 2 | 1 +>bob : any +>bob ? 1 : 2 : 2 | 1 +>bob : any +>1 : 1 +>2 : 2 +>(t) => console.log(t + 2) : (t: 2 | 1) => void +>t : 2 | 1 +>console.log(t + 2) : void +>console.log : (...data: any[]) => void +>console : Console +>log : (...data: any[]) => void +>t + 2 : number +>t : 2 | 1 +>2 : 2 + +// Repro from #48466 + +interface Opts { + fetch: (params: TParams, foo: number) => TDone, +>fetch : (params: TParams, foo: number) => TDone +>params : TParams +>foo : number + + map: (data: TDone) => TMapped +>map : (data: TDone) => TMapped +>data : TDone +} + +function example(options: Opts) { +>example : (options: Opts) => (params: TParams) => TMapped +>options : Opts + + return (params: TParams) => { +>(params: TParams) => { const data = options.fetch(params, 123) return options.map(data) } : (params: TParams) => TMapped +>params : TParams + + const data = options.fetch(params, 123) +>data : TDone +>options.fetch(params, 123) : TDone +>options.fetch : (params: TParams, foo: number) => TDone +>options : Opts +>fetch : (params: TParams, foo: number) => TDone +>params : TParams +>123 : 123 + + return options.map(data) +>options.map(data) : TMapped +>options.map : (data: TDone) => TMapped +>options : Opts +>map : (data: TDone) => TMapped +>data : TDone + } +} + +interface Params { + one: number +>one : number + + two: string +>two : string +} + +example({ +>example({ fetch: (params: Params) => 123, map: (number) => String(number)}) : (params: Params) => string +>example : (options: Opts) => (params: TParams) => TMapped +>{ fetch: (params: Params) => 123, map: (number) => String(number)} : { fetch: (params: Params) => number; map: (number: number) => string; } + + fetch: (params: Params) => 123, +>fetch : (params: Params) => number +>(params: Params) => 123 : (params: Params) => number +>params : Params +>123 : 123 + + map: (number) => String(number) +>map : (number: number) => string +>(number) => String(number) : (number: number) => string +>number : number +>String(number) : string +>String : StringConstructor +>number : number + +}); + +example({ +>example({ fetch: (params: Params, foo: number) => 123, map: (number) => String(number)}) : (params: Params) => string +>example : (options: Opts) => (params: TParams) => TMapped +>{ fetch: (params: Params, foo: number) => 123, map: (number) => String(number)} : { fetch: (params: Params, foo: number) => number; map: (number: number) => string; } + + fetch: (params: Params, foo: number) => 123, +>fetch : (params: Params, foo: number) => number +>(params: Params, foo: number) => 123 : (params: Params, foo: number) => number +>params : Params +>foo : number +>123 : 123 + + map: (number) => String(number) +>map : (number: number) => string +>(number) => String(number) : (number: number) => string +>number : number +>String(number) : string +>String : StringConstructor +>number : number + +}); + +example({ +>example({ fetch: (params: Params, foo) => 123, map: (number) => String(number)}) : (params: Params) => string +>example : (options: Opts) => (params: TParams) => TMapped +>{ fetch: (params: Params, foo) => 123, map: (number) => String(number)} : { fetch: (params: Params, foo: number) => number; map: (number: number) => string; } + + fetch: (params: Params, foo) => 123, +>fetch : (params: Params, foo: number) => number +>(params: Params, foo) => 123 : (params: Params, foo: number) => number +>params : Params +>foo : number +>123 : 123 + + map: (number) => String(number) +>map : (number: number) => string +>(number) => String(number) : (number: number) => string +>number : number +>String(number) : string +>String : StringConstructor +>number : number + +}); + diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts b/tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts new file mode 100644 index 00000000000..5928348c090 --- /dev/null +++ b/tests/cases/conformance/types/typeRelationships/typeInference/intraExpressionInferences.ts @@ -0,0 +1,178 @@ +// @strict: true +// @declaration: true + +// Repros from #47599 + +declare function callIt(obj: { + produce: (n: number) => T, + consume: (x: T) => void +}): void; + +callIt({ + produce: () => 0, + consume: n => n.toFixed() +}); + +callIt({ + produce: _a => 0, + consume: n => n.toFixed(), +}); + +callIt({ + produce() { + return 0; + }, + consume: n => n.toFixed() +}); + +declare function callItT(obj: [(n: number) => T, (x: T) => void]): void; + +callItT([() => 0, n => n.toFixed()]); +callItT([_a => 0, n => n.toFixed()]); + +// Repro from #25092 + +interface MyInterface { + retrieveGeneric: (parameter: string) => T, + operateWithGeneric: (generic: T) => string +} + +const inferTypeFn = (generic: MyInterface) => generic; + +const myGeneric = inferTypeFn({ + retrieveGeneric: parameter => 5, + operateWithGeneric: generic => generic.toFixed() +}); + +// Repro #38623 + +function make(o: { mutations: M, action: (m: M) => void }) { } + +make({ + mutations: { + foo() { } + }, + action: (a) => { a.foo() } +}); + +// Repro from #38845 + +declare function foo(options: { a: A, b: (a: A) => void }): void; + +foo({ + a: () => { return 42 }, + b(a) {}, +}); + +foo({ + a: function () { return 42 }, + b(a) {}, +}); + +foo({ + a() { return 42 }, + b(a) {}, +}); + +// Repro from #38872 + +type Chain = { + a(): R1, + b(a: R1): R2; + c(b: R2): void; +}; + +function test(foo: Chain) {} + +test({ + a: () => 0, + b: (a) => 'a', + c: (b) => { + const x: string = b; + } +}); + +// Repro from #41712 + +class Wrapper { + public value?: T; +} + +type WrappedMap = Record; +type Unwrap = { + [K in keyof D]: D[K] extends Wrapper ? T : never; +}; + +type MappingComponent = { + setup(): { inputs: I; outputs: O }; + map?: (inputs: Unwrap) => Unwrap; +}; + +declare function createMappingComponent(def: MappingComponent): void; + +createMappingComponent({ + setup() { + return { + inputs: { + num: new Wrapper(), + str: new Wrapper() + }, + outputs: { + bool: new Wrapper(), + str: new Wrapper() + } + }; + }, + map(inputs) { + return { + bool: inputs.nonexistent, + str: inputs.num, // Causes error + } + } +}); + +// Repro from #48279 + +function simplified(props: { generator: () => T, receiver: (t: T) => any }) {} + +function whatIWant(props: { generator: (bob: any) => T, receiver: (t: T) => any }) {} + +function nonObject(generator: (bob: any) => T, receiver: (t: T) => any) {} + +simplified({ generator: () => 123, receiver: (t) => console.log(t + 2) }) +whatIWant({ generator: (bob) => bob ? 1 : 2, receiver: (t) => console.log(t + 2) }) +nonObject((bob) => bob ? 1 : 2, (t) => console.log(t + 2)) + +// Repro from #48466 + +interface Opts { + fetch: (params: TParams, foo: number) => TDone, + map: (data: TDone) => TMapped +} + +function example(options: Opts) { + return (params: TParams) => { + const data = options.fetch(params, 123) + return options.map(data) + } +} + +interface Params { + one: number + two: string +} + +example({ + fetch: (params: Params) => 123, + map: (number) => String(number) +}); + +example({ + fetch: (params: Params, foo: number) => 123, + map: (number) => String(number) +}); + +example({ + fetch: (params: Params, foo) => 123, + map: (number) => String(number) +}); From c99afde6ad30753098b81571fda2e8f919ae928a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 5 Apr 2022 13:35:21 -0700 Subject: [PATCH 27/41] Run API tests with 'strict' and 'exactOptionalProperties'. (#48574) --- src/testRunner/unittests/publicApi.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/testRunner/unittests/publicApi.ts b/src/testRunner/unittests/publicApi.ts index 883b979f9c7..2a5581bc93e 100644 --- a/src/testRunner/unittests/publicApi.ts +++ b/src/testRunner/unittests/publicApi.ts @@ -17,8 +17,13 @@ describe("unittests:: Public APIs", () => { const fs = vfs.createFromFileSystem(Harness.IO, /*ignoreCase*/ false); fs.linkSync(`${vfs.builtFolder}/${fileName}`, `${vfs.srcFolder}/${fileName}`); const sys = new fakes.System(fs); - const host = new fakes.CompilerHost(sys); - const result = compiler.compileFiles(host, [`${vfs.srcFolder}/${fileName}`], {}); + const options: ts.CompilerOptions = { + ...ts.getDefaultCompilerOptions(), + strict: true, + exactOptionalPropertyTypes: true, + }; + const host = new fakes.CompilerHost(sys, options); + const result = compiler.compileFiles(host, [`${vfs.srcFolder}/${fileName}`], options); assert(!result.diagnostics || !result.diagnostics.length, Harness.Compiler.minimalDiagnosticsToString(result.diagnostics, /*pretty*/ true)); }); } From 312737b4301c74d863430306ffc09fef673143fe Mon Sep 17 00:00:00 2001 From: Leonard Ginters Date: Tue, 5 Apr 2022 22:38:38 +0200 Subject: [PATCH 28/41] feat(46907): Add `Intl.ListFormat` type declarations (#47254) * feat(46907): Add ListFormat type declarations * feat(46907): Fix JSDoc return type * feat(46907): Use correct formatToParts list parameter type description, link to Array MDN page * refactor(46907): Change ListFormatLocaleMatcher MDN link to match the rest * feat(46907): Add explicit undefined to ListFormatOptions --- src/lib/es2021.intl.d.ts | 102 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/lib/es2021.intl.d.ts b/src/lib/es2021.intl.d.ts index 0476912be32..e303d8dd34f 100644 --- a/src/lib/es2021.intl.d.ts +++ b/src/lib/es2021.intl.d.ts @@ -21,4 +21,106 @@ declare namespace Intl { dayPeriod?: "narrow" | "short" | "long"; fractionalSecondDigits?: 0 | 1 | 2 | 3; } + + /** + * The locale matching algorithm to use. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters). + */ + type ListFormatLocaleMatcher = "lookup" | "best fit"; + + /** + * The format of output message. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters). + */ + type ListFormatType = "conjunction" | "disjunction" | "unit"; + + /** + * The length of the formatted message. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters). + */ + type ListFormatStyle = "long" | "short" | "narrow"; + + /** + * An object with some or all properties of the `Intl.ListFormat` constructor `options` parameter. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters). + */ + interface ListFormatOptions { + /** The locale matching algorithm to use. For information about this option, see [Intl page](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_negotiation). */ + localeMatcher?: ListFormatLocaleMatcher | undefined; + /** The format of output message. */ + type?: ListFormatType | undefined; + /** The length of the internationalized message. */ + style?: ListFormatStyle | undefined; + } + + interface ListFormat { + /** + * Returns a string with a language-specific representation of the list. + * + * @param list - An iterable object, such as an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). + * + * @throws `TypeError` if `list` includes something other than the possible values. + * + * @returns {string} A language-specific formatted string representing the elements of the list. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/format). + */ + format(list: Iterable): string; + + /** + * Returns an Array of objects representing the different components that can be used to format a list of values in a locale-aware fashion. + * + * @param list - An iterable object, such as an [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array), to be formatted according to a locale. + * + * @throws `TypeError` if `list` includes something other than the possible values. + * + * @returns {{ type: "element" | "literal", value: string; }[]} An Array of components which contains the formatted parts from the list. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/formatToParts). + */ + formatToParts(list: Iterable): { type: "element" | "literal", value: string; }[]; + } + + const ListFormat: { + prototype: ListFormat; + + /** + * Creates [Intl.ListFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat) objects that + * enable language-sensitive list formatting. + * + * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings. + * For the general form and interpretation of the `locales` argument, + * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation). + * + * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat#parameters) + * with some or all options of `ListFormatOptions`. + * + * @returns [Intl.ListFormatOptions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat) object. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat). + */ + new(locales?: BCP47LanguageTag | BCP47LanguageTag[], options?: ListFormatOptions): ListFormat; + + /** + * Returns an array containing those of the provided locales that are + * supported in list formatting without having to fall back to the runtime's default locale. + * + * @param locales - A string with a [BCP 47 language tag](http://tools.ietf.org/html/rfc5646), or an array of such strings. + * For the general form and interpretation of the `locales` argument, + * see the [`Intl` page](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation). + * + * @param options - An [object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf#parameters). + * with some or all possible options. + * + * @returns An array of strings representing a subset of the given locale tags that are supported in list + * formatting without having to fall back to the runtime's default locale. + * + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf). + */ + supportedLocalesOf(locales: BCP47LanguageTag | BCP47LanguageTag[], options?: Pick): BCP47LanguageTag[]; + }; } From 88f31d72c269f7ed937eeb8bf65907c9e9f0702d Mon Sep 17 00:00:00 2001 From: jihndai <73680880+jihndai@users.noreply.github.com> Date: Tue, 5 Apr 2022 16:46:54 -0400 Subject: [PATCH 29/41] Add more options to `DateTimeFormatOptions.timeZoneName` (#48467) * update timeZoneName * add tests and baselines --- src/lib/es5.d.ts | 2 +- tests/baselines/reference/es2022IntlAPIs.js | 20 ++++++++++ .../reference/es2022IntlAPIs.symbols | 26 +++++++++++++ .../baselines/reference/es2022IntlAPIs.types | 37 +++++++++++++++++++ .../conformance/es2022/es2022IntlAPIs.ts | 10 +++++ 5 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/es2022IntlAPIs.js create mode 100644 tests/baselines/reference/es2022IntlAPIs.symbols create mode 100644 tests/baselines/reference/es2022IntlAPIs.types create mode 100644 tests/cases/conformance/es2022/es2022IntlAPIs.ts diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 94a033a0c14..d4d0bf3ffa0 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -4404,7 +4404,7 @@ declare namespace Intl { hour?: "numeric" | "2-digit" | undefined; minute?: "numeric" | "2-digit" | undefined; second?: "numeric" | "2-digit" | undefined; - timeZoneName?: "long" | "short" | undefined; + timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined; formatMatcher?: "best fit" | "basic" | undefined; hour12?: boolean | undefined; timeZone?: string | undefined; diff --git a/tests/baselines/reference/es2022IntlAPIs.js b/tests/baselines/reference/es2022IntlAPIs.js new file mode 100644 index 00000000000..8611c0bf515 --- /dev/null +++ b/tests/baselines/reference/es2022IntlAPIs.js @@ -0,0 +1,20 @@ +//// [es2022IntlAPIs.ts] +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#using_timezonename +const timezoneNames = ['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] as const; +for (const zoneName of timezoneNames) { + var formatter = new Intl.DateTimeFormat('en-US', { + timeZone: 'America/Los_Angeles', + timeZoneName: zoneName, + }); +} + + +//// [es2022IntlAPIs.js] +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#using_timezonename +const timezoneNames = ['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric']; +for (const zoneName of timezoneNames) { + var formatter = new Intl.DateTimeFormat('en-US', { + timeZone: 'America/Los_Angeles', + timeZoneName: zoneName, + }); +} diff --git a/tests/baselines/reference/es2022IntlAPIs.symbols b/tests/baselines/reference/es2022IntlAPIs.symbols new file mode 100644 index 00000000000..939c6b383a5 --- /dev/null +++ b/tests/baselines/reference/es2022IntlAPIs.symbols @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es2022/es2022IntlAPIs.ts === +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#using_timezonename +const timezoneNames = ['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] as const; +>timezoneNames : Symbol(timezoneNames, Decl(es2022IntlAPIs.ts, 1, 5)) +>const : Symbol(const) + +for (const zoneName of timezoneNames) { +>zoneName : Symbol(zoneName, Decl(es2022IntlAPIs.ts, 2, 10)) +>timezoneNames : Symbol(timezoneNames, Decl(es2022IntlAPIs.ts, 1, 5)) + + var formatter = new Intl.DateTimeFormat('en-US', { +>formatter : Symbol(formatter, Decl(es2022IntlAPIs.ts, 3, 5)) +>Intl.DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --)) +>Intl : Symbol(Intl, Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2018.intl.d.ts, --, --), Decl(lib.es2020.bigint.d.ts, --, --), Decl(lib.es2020.intl.d.ts, --, --) ... and 1 more) +>DateTimeFormat : Symbol(Intl.DateTimeFormat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2017.intl.d.ts, --, --), Decl(lib.es2021.intl.d.ts, --, --)) + + timeZone: 'America/Los_Angeles', +>timeZone : Symbol(timeZone, Decl(es2022IntlAPIs.ts, 3, 52)) + + timeZoneName: zoneName, +>timeZoneName : Symbol(timeZoneName, Decl(es2022IntlAPIs.ts, 4, 36)) +>zoneName : Symbol(zoneName, Decl(es2022IntlAPIs.ts, 2, 10)) + + }); +} + diff --git a/tests/baselines/reference/es2022IntlAPIs.types b/tests/baselines/reference/es2022IntlAPIs.types new file mode 100644 index 00000000000..d6a0ac5049e --- /dev/null +++ b/tests/baselines/reference/es2022IntlAPIs.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es2022/es2022IntlAPIs.ts === +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#using_timezonename +const timezoneNames = ['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] as const; +>timezoneNames : readonly ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"] +>['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] as const : readonly ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"] +>['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] : readonly ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"] +>'short' : "short" +>'long' : "long" +>'shortOffset' : "shortOffset" +>'longOffset' : "longOffset" +>'shortGeneric' : "shortGeneric" +>'longGeneric' : "longGeneric" + +for (const zoneName of timezoneNames) { +>zoneName : "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" +>timezoneNames : readonly ["short", "long", "shortOffset", "longOffset", "shortGeneric", "longGeneric"] + + var formatter = new Intl.DateTimeFormat('en-US', { +>formatter : Intl.DateTimeFormat +>new Intl.DateTimeFormat('en-US', { timeZone: 'America/Los_Angeles', timeZoneName: zoneName, }) : Intl.DateTimeFormat +>Intl.DateTimeFormat : { (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; new (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; readonly prototype: Intl.DateTimeFormat; } +>Intl : typeof Intl +>DateTimeFormat : { (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; new (locales?: string | string[], options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat; supportedLocalesOf(locales: string | string[], options?: Intl.DateTimeFormatOptions): string[]; readonly prototype: Intl.DateTimeFormat; } +>'en-US' : "en-US" +>{ timeZone: 'America/Los_Angeles', timeZoneName: zoneName, } : { timeZone: string; timeZoneName: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric"; } + + timeZone: 'America/Los_Angeles', +>timeZone : string +>'America/Los_Angeles' : "America/Los_Angeles" + + timeZoneName: zoneName, +>timeZoneName : "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" +>zoneName : "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" + + }); +} + diff --git a/tests/cases/conformance/es2022/es2022IntlAPIs.ts b/tests/cases/conformance/es2022/es2022IntlAPIs.ts new file mode 100644 index 00000000000..f297e842b1a --- /dev/null +++ b/tests/cases/conformance/es2022/es2022IntlAPIs.ts @@ -0,0 +1,10 @@ +// @target: es2022 + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#using_timezonename +const timezoneNames = ['short', 'long', 'shortOffset', 'longOffset', 'shortGeneric', 'longGeneric'] as const; +for (const zoneName of timezoneNames) { + var formatter = new Intl.DateTimeFormat('en-US', { + timeZone: 'America/Los_Angeles', + timeZoneName: zoneName, + }); +} From 42032df06d9540ddb9738ac10357af884aeb6a4d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Tue, 5 Apr 2022 16:47:25 -0700 Subject: [PATCH 30/41] Update DOM for 4.7 beta (#48577) --- src/lib/dom.generated.d.ts | 435 ++++++++++++++++-- src/lib/dom.iterable.generated.d.ts | 19 +- src/lib/webworker.generated.d.ts | 133 +++++- src/lib/webworker.iterable.generated.d.ts | 6 +- .../baselines/reference/baseCheck.errors.txt | 2 +- .../reference/extendArray.errors.txt | 4 +- .../globalThisBlockscopedProperties.types | 2 +- ...portMeta(module=commonjs,target=es5).types | 2 +- ...tMeta(module=commonjs,target=esnext).types | 2 +- ...importMeta(module=es2020,target=es5).types | 2 +- ...ortMeta(module=es2020,target=esnext).types | 2 +- ...importMeta(module=esnext,target=es5).types | 2 +- ...ortMeta(module=esnext,target=esnext).types | 2 +- ...importMeta(module=system,target=es5).types | 2 +- ...ortMeta(module=system,target=esnext).types | 2 +- .../intersectionsOfLargeUnions2.errors.txt | 2 +- ...ryIdentifierWithAbsentParameter.errors.txt | 2 +- ...oryQualifiedNameResolutionError.errors.txt | 2 +- .../mappedTypeRecursiveInference.types | 8 +- 19 files changed, 551 insertions(+), 80 deletions(-) diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index 2ef38a96af1..f5705e695c2 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -701,6 +701,19 @@ interface LockOptions { steal?: boolean; } +interface MIDIConnectionEventInit extends EventInit { + port?: MIDIPort; +} + +interface MIDIMessageEventInit extends EventInit { + data?: Uint8Array; +} + +interface MIDIOptions { + software?: boolean; + sysex?: boolean; +} + interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo { configuration?: MediaDecodingConfiguration; } @@ -931,6 +944,11 @@ interface MutationObserverInit { subtree?: boolean; } +interface NavigationPreloadState { + enabled?: boolean; + headerValue?: string; +} + interface NotificationAction { action: string; icon?: string; @@ -1243,6 +1261,35 @@ interface RTCDtlsFingerprint { value?: string; } +interface RTCEncodedAudioFrameMetadata { + contributingSources?: number[]; + synchronizationSource?: number; +} + +interface RTCEncodedVideoFrameMetadata { + contributingSources?: number[]; + dependencies?: number[]; + frameId?: number; + height?: number; + spatialIndex?: number; + synchronizationSource?: number; + temporalIndex?: number; + width?: number; +} + +interface RTCErrorEventInit extends EventInit { + error: RTCError; +} + +interface RTCErrorInit { + errorDetail: RTCErrorDetailType; + httpRequestStatusCode?: number; + receivedAlert?: number; + sctpCauseCode?: number; + sdpLineNumber?: number; + sentAlert?: number; +} + interface RTCIceCandidateInit { candidate?: string; sdpMLineIndex?: number | null; @@ -1748,6 +1795,13 @@ interface UnderlyingSource { type?: undefined; } +interface VideoColorSpaceInit { + fullRange?: boolean; + matrix?: VideoMatrixCoefficients; + primaries?: VideoColorPrimaries; + transfer?: VideoTransferCharacteristics; +} + interface VideoConfiguration { bitrate: number; colorGamut?: ColorGamut; @@ -1760,6 +1814,19 @@ interface VideoConfiguration { width: number; } +interface VideoFrameMetadata { + captureTime?: DOMHighResTimeStamp; + expectedDisplayTime: DOMHighResTimeStamp; + height: number; + mediaTime: number; + presentationTime: DOMHighResTimeStamp; + presentedFrames: number; + processingDuration?: number; + receiveTime?: DOMHighResTimeStamp; + rtpTimestamp?: number; + width: number; +} + interface WaveShaperOptions extends AudioNodeOptions { curve?: number[] | Float32Array; oversample?: OverSampleType; @@ -1894,6 +1961,8 @@ interface AbortSignal extends EventTarget { /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ readonly aborted: boolean; onabort: ((this: AbortSignal, ev: Event) => any) | null; + readonly reason: any; + throwIfAborted(): void; addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -2389,7 +2458,7 @@ interface Blob { readonly type: string; arrayBuffer(): Promise; slice(start?: number, end?: number, contentType?: string): Blob; - stream(): ReadableStream; + stream(): ReadableStream; text(): Promise; } @@ -2764,6 +2833,7 @@ interface CSSStyleDeclaration { columns: string; contain: string; content: string; + contentVisibility: string; counterIncrement: string; counterReset: string; counterSet: string; @@ -2799,7 +2869,6 @@ interface CSSStyleDeclaration { fontStyle: string; fontSynthesis: string; fontVariant: string; - /** @deprecated */ fontVariantAlternates: string; fontVariantCaps: string; fontVariantEastAsian: string; @@ -2873,6 +2942,14 @@ interface CSSStyleDeclaration { markerMid: string; markerStart: string; mask: string; + maskClip: string; + maskComposite: string; + maskImage: string; + maskMode: string; + maskOrigin: string; + maskPosition: string; + maskRepeat: string; + maskSize: string; maskType: string; maxBlockSize: string; maxHeight: string; @@ -2886,7 +2963,6 @@ interface CSSStyleDeclaration { objectFit: string; objectPosition: string; offset: string; - offsetAnchor: string; offsetDistance: string; offsetPath: string; offsetRotate: string; @@ -2931,6 +3007,7 @@ interface CSSStyleDeclaration { placeSelf: string; pointerEvents: string; position: string; + printColorAdjust: string; quotes: string; resize: string; right: string; @@ -3231,13 +3308,13 @@ declare var CSSTransition: { * Available only in secure contexts. */ interface Cache { - add(request: RequestInfo): Promise; + add(request: RequestInfo | URL): Promise; addAll(requests: RequestInfo[]): Promise; - delete(request: RequestInfo, options?: CacheQueryOptions): Promise; - keys(request?: RequestInfo, options?: CacheQueryOptions): Promise>; - match(request: RequestInfo, options?: CacheQueryOptions): Promise; - matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise>; - put(request: RequestInfo, response: Response): Promise; + delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + keys(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise>; + match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + matchAll(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise>; + put(request: RequestInfo | URL, response: Response): Promise; } declare var Cache: { @@ -3253,7 +3330,7 @@ interface CacheStorage { delete(cacheName: string): Promise; has(cacheName: string): Promise; keys(): Promise; - match(request: RequestInfo, options?: MultiCacheQueryOptions): Promise; + match(request: RequestInfo | URL, options?: MultiCacheQueryOptions): Promise; open(cacheName: string): Promise; } @@ -3518,6 +3595,7 @@ declare var ClipboardEvent: { new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; }; +/** Available only in secure contexts. */ interface ClipboardItem { readonly types: ReadonlyArray; getType(type: string): Promise; @@ -3525,7 +3603,7 @@ interface ClipboardItem { declare var ClipboardItem: { prototype: ClipboardItem; - new(items: Record>, options?: ClipboardItemOptions): ClipboardItem; + new(items: Record>, options?: ClipboardItemOptions): ClipboardItem; }; /** A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. */ @@ -4195,6 +4273,7 @@ declare var DeviceOrientationEvent: { }; interface DocumentEventMap extends DocumentAndElementEventHandlersEventMap, GlobalEventHandlersEventMap { + "DOMContentLoaded": Event; "fullscreenchange": Event; "fullscreenerror": Event; "pointerlockchange": Event; @@ -4412,6 +4491,8 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface: "DragEvent"): DragEvent; createEvent(eventInterface: "ErrorEvent"): ErrorEvent; + createEvent(eventInterface: "Event"): Event; + createEvent(eventInterface: "Events"): Event; createEvent(eventInterface: "FocusEvent"): FocusEvent; createEvent(eventInterface: "FontFaceSetLoadEvent"): FontFaceSetLoadEvent; createEvent(eventInterface: "FormDataEvent"): FormDataEvent; @@ -4420,6 +4501,8 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; createEvent(eventInterface: "InputEvent"): InputEvent; createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface: "MIDIConnectionEvent"): MIDIConnectionEvent; + createEvent(eventInterface: "MIDIMessageEvent"): MIDIMessageEvent; createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent; createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent; createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent; @@ -4440,6 +4523,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad createEvent(eventInterface: "PromiseRejectionEvent"): PromiseRejectionEvent; createEvent(eventInterface: "RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; createEvent(eventInterface: "RTCDataChannelEvent"): RTCDataChannelEvent; + createEvent(eventInterface: "RTCErrorEvent"): RTCErrorEvent; createEvent(eventInterface: "RTCPeerConnectionIceErrorEvent"): RTCPeerConnectionIceErrorEvent; createEvent(eventInterface: "RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent; createEvent(eventInterface: "RTCTrackEvent"): RTCTrackEvent; @@ -4871,8 +4955,20 @@ interface ElementContentEditable { } interface ElementInternals extends ARIAMixin { + /** Returns the form owner of internals's target element. */ + readonly form: HTMLFormElement | null; + /** Returns a NodeList of all the label elements that internals's target element is associated with. */ + readonly labels: NodeList; /** Returns the ShadowRoot for internals's target element, if the target element is a shadow host, or null otherwise. */ readonly shadowRoot: ShadowRoot | null; + /** Returns true if internals's target element will be validated when the form is submitted; false otherwise. */ + readonly willValidate: boolean; + /** + * Sets both the state and submission value of internals's target element to value. + * + * If value is null, the element won't participate in form submission. + */ + setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void; } declare var ElementInternals: { @@ -4946,6 +5042,15 @@ declare var Event: { readonly NONE: number; }; +interface EventCounts { + forEach(callbackfn: (value: number, key: string, parent: EventCounts) => void, thisArg?: any): void; +} + +declare var EventCounts: { + prototype: EventCounts; + new(): EventCounts; +}; + interface EventListener { (evt: Event): void; } @@ -6139,14 +6244,29 @@ declare var HTMLDetailsElement: { new(): HTMLDetailsElement; }; -/** @deprecated this is not available in most browsers */ interface HTMLDialogElement extends HTMLElement { + open: boolean; + returnValue: string; + /** + * Closes the dialog element. + * + * The argument, if provided, provides a return value. + */ + close(returnValue?: string): void; + /** Displays the dialog element. */ + show(): void; + showModal(): void; addEventListener(type: K, listener: (this: HTMLDialogElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: HTMLDialogElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } +declare var HTMLDialogElement: { + prototype: HTMLDialogElement; + new(): HTMLDialogElement; +}; + /** @deprecated */ interface HTMLDirectoryElement extends HTMLElement { /** @deprecated */ @@ -7594,6 +7714,7 @@ interface HTMLScriptElement extends HTMLElement { declare var HTMLScriptElement: { prototype: HTMLScriptElement; new(): HTMLScriptElement; + supports(type: string): boolean; }; /** A