@typescript/native-preview 7.0.0-dev.20260701.1 → 7.0.0-dev.20260702.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/async/api.d.ts +35 -18
- package/dist/api/async/api.d.ts.map +1 -1
- package/dist/api/async/api.js +135 -107
- package/dist/api/async/api.js.map +1 -1
- package/dist/api/compilerOptions.d.ts +109 -0
- package/dist/api/compilerOptions.d.ts.map +1 -0
- package/dist/api/compilerOptions.js +2 -0
- package/dist/api/compilerOptions.js.map +1 -0
- package/dist/api/proto.d.ts +11 -3
- package/dist/api/proto.d.ts.map +1 -1
- package/dist/api/proto.js.map +1 -1
- package/dist/api/sync/api.d.ts +35 -18
- package/dist/api/sync/api.d.ts.map +1 -1
- package/dist/api/sync/api.js +135 -107
- package/dist/api/sync/api.js.map +1 -1
- package/dist/ast/ast.d.ts +4 -1
- package/dist/ast/ast.d.ts.map +1 -1
- package/dist/ast/ast.generated.d.ts +2 -2
- package/dist/ast/ast.generated.d.ts.map +1 -1
- package/dist/ast/ast.js.map +1 -1
- package/dist/ast/index.d.ts +1 -0
- package/dist/ast/index.d.ts.map +1 -1
- package/dist/ast/index.js +1 -0
- package/dist/ast/index.js.map +1 -1
- package/dist/ast/is.d.ts +2 -1
- package/dist/ast/is.d.ts.map +1 -1
- package/dist/ast/is.generated.d.ts +1 -2
- package/dist/ast/is.generated.d.ts.map +1 -1
- package/dist/ast/is.generated.js +0 -4
- package/dist/ast/is.generated.js.map +1 -1
- package/dist/ast/is.js +8 -1
- package/dist/ast/is.js.map +1 -1
- package/dist/ast/jsdoc.d.ts +11 -0
- package/dist/ast/jsdoc.d.ts.map +1 -0
- package/dist/ast/jsdoc.js +202 -0
- package/dist/ast/jsdoc.js.map +1 -0
- package/dist/enums/jsxEmit.d.ts +2 -0
- package/dist/enums/jsxEmit.d.ts.map +1 -0
- package/dist/enums/jsxEmit.enum.d.ts +9 -0
- package/dist/enums/jsxEmit.enum.d.ts.map +1 -0
- package/dist/enums/jsxEmit.enum.js +11 -0
- package/dist/enums/jsxEmit.enum.js.map +1 -0
- package/dist/enums/jsxEmit.js +11 -0
- package/dist/enums/jsxEmit.js.map +1 -0
- package/dist/enums/moduleDetectionKind.d.ts +2 -0
- package/dist/enums/moduleDetectionKind.d.ts.map +1 -0
- package/dist/enums/moduleDetectionKind.enum.d.ts +7 -0
- package/dist/enums/moduleDetectionKind.enum.d.ts.map +1 -0
- package/dist/enums/moduleDetectionKind.enum.js +9 -0
- package/dist/enums/moduleDetectionKind.enum.js.map +1 -0
- package/dist/enums/moduleDetectionKind.js +9 -0
- package/dist/enums/moduleDetectionKind.js.map +1 -0
- package/dist/enums/moduleResolutionKind.d.ts +2 -0
- package/dist/enums/moduleResolutionKind.d.ts.map +1 -0
- package/dist/enums/moduleResolutionKind.enum.d.ts +9 -0
- package/dist/enums/moduleResolutionKind.enum.d.ts.map +1 -0
- package/dist/enums/moduleResolutionKind.enum.js +11 -0
- package/dist/enums/moduleResolutionKind.enum.js.map +1 -0
- package/dist/enums/moduleResolutionKind.js +11 -0
- package/dist/enums/moduleResolutionKind.js.map +1 -0
- package/dist/enums/newLineKind.d.ts +2 -0
- package/dist/enums/newLineKind.d.ts.map +1 -0
- package/dist/enums/newLineKind.enum.d.ts +6 -0
- package/dist/enums/newLineKind.enum.d.ts.map +1 -0
- package/dist/enums/newLineKind.enum.js +8 -0
- package/dist/enums/newLineKind.enum.js.map +1 -0
- package/dist/enums/newLineKind.js +8 -0
- package/dist/enums/newLineKind.js.map +1 -0
- package/dist/internal/utils.d.ts +23 -0
- package/dist/internal/utils.d.ts.map +1 -0
- package/dist/internal/utils.js +25 -0
- package/dist/internal/utils.js.map +1 -0
- package/package.json +9 -9
package/dist/api/sync/api.js
CHANGED
|
@@ -137,8 +137,8 @@ export class Snapshot {
|
|
|
137
137
|
this.client = client;
|
|
138
138
|
this.toPath = toPath;
|
|
139
139
|
this.onDispose = onDispose;
|
|
140
|
-
this.snapshotRegistry = new SnapshotObjectRegistry(client, this.id);
|
|
141
140
|
this.projectMap = new Map();
|
|
141
|
+
this.snapshotRegistry = new SnapshotObjectRegistry(client, this.id, projectId => this.projectMap.get(projectId));
|
|
142
142
|
for (const projData of data.projects) {
|
|
143
143
|
const project = new Project(projData, this.id, client, sourceFileCache, toPath, this.snapshotRegistry);
|
|
144
144
|
this.projectMap.set(toPath(projData.configFileName), project);
|
|
@@ -190,9 +190,15 @@ class SnapshotObjectRegistry {
|
|
|
190
190
|
symbols = new Map();
|
|
191
191
|
client;
|
|
192
192
|
snapshotId;
|
|
193
|
-
|
|
193
|
+
resolveProject;
|
|
194
|
+
constructor(client, snapshotId, resolveProject) {
|
|
194
195
|
this.client = client;
|
|
195
196
|
this.snapshotId = snapshotId;
|
|
197
|
+
this.resolveProject = resolveProject;
|
|
198
|
+
}
|
|
199
|
+
/** Resolve a project id (a config file path) to its Project within this snapshot. */
|
|
200
|
+
getProject(projectId) {
|
|
201
|
+
return this.resolveProject(projectId);
|
|
196
202
|
}
|
|
197
203
|
getOrCreateSymbol(data) {
|
|
198
204
|
let symbol = this.symbols.get(data.id);
|
|
@@ -252,14 +258,14 @@ class SnapshotObjectRegistry {
|
|
|
252
258
|
class ProjectObjectRegistry {
|
|
253
259
|
client;
|
|
254
260
|
snapshotId;
|
|
255
|
-
|
|
261
|
+
project;
|
|
256
262
|
snapshotRegistry;
|
|
257
263
|
types = new Map();
|
|
258
264
|
signatures = new Map();
|
|
259
|
-
constructor(client, snapshotId,
|
|
265
|
+
constructor(client, snapshotId, project, snapshotRegistry) {
|
|
260
266
|
this.client = client;
|
|
261
267
|
this.snapshotId = snapshotId;
|
|
262
|
-
this.
|
|
268
|
+
this.project = project;
|
|
263
269
|
this.snapshotRegistry = snapshotRegistry;
|
|
264
270
|
}
|
|
265
271
|
getOrCreateSymbol(data) {
|
|
@@ -282,7 +288,7 @@ class ProjectObjectRegistry {
|
|
|
282
288
|
getOrCreateSignature(data) {
|
|
283
289
|
let sig = this.signatures.get(data.id);
|
|
284
290
|
if (!sig) {
|
|
285
|
-
sig = new Signature(data, this);
|
|
291
|
+
sig = new Signature(data, this.project, this);
|
|
286
292
|
this.signatures.set(data.id, sig);
|
|
287
293
|
}
|
|
288
294
|
return sig;
|
|
@@ -304,7 +310,7 @@ class ProjectObjectRegistry {
|
|
|
304
310
|
}
|
|
305
311
|
const data = this.client.apiRequest(method, {
|
|
306
312
|
snapshot: this.snapshotId,
|
|
307
|
-
project: this.
|
|
313
|
+
project: this.project.id,
|
|
308
314
|
objectId: source.id,
|
|
309
315
|
});
|
|
310
316
|
if (!data)
|
|
@@ -312,7 +318,7 @@ class ProjectObjectRegistry {
|
|
|
312
318
|
return this.getOrCreateType(data);
|
|
313
319
|
}
|
|
314
320
|
fetchSymbol(source, method, handle) {
|
|
315
|
-
return this.snapshotRegistry.fetchSymbol(source, method, handle, this.
|
|
321
|
+
return this.snapshotRegistry.fetchSymbol(source, method, handle, this.project.id);
|
|
316
322
|
}
|
|
317
323
|
fetchSignature(source, method, handle) {
|
|
318
324
|
if (!handle)
|
|
@@ -322,7 +328,7 @@ class ProjectObjectRegistry {
|
|
|
322
328
|
return cached;
|
|
323
329
|
const data = this.client.apiRequest(method, {
|
|
324
330
|
snapshot: this.snapshotId,
|
|
325
|
-
project: this.
|
|
331
|
+
project: this.project.id,
|
|
326
332
|
objectId: source.id,
|
|
327
333
|
});
|
|
328
334
|
if (!data)
|
|
@@ -346,7 +352,7 @@ class ProjectObjectRegistry {
|
|
|
346
352
|
}
|
|
347
353
|
const typesData = this.client.apiRequest(method, {
|
|
348
354
|
snapshot: this.snapshotId,
|
|
349
|
-
project: this.
|
|
355
|
+
project: this.project.id,
|
|
350
356
|
objectId: source.id,
|
|
351
357
|
});
|
|
352
358
|
if (typesData == null)
|
|
@@ -355,14 +361,14 @@ class ProjectObjectRegistry {
|
|
|
355
361
|
return typesData.map(data => this.getOrCreateType(data));
|
|
356
362
|
}
|
|
357
363
|
fetchSymbols(source, method, handles) {
|
|
358
|
-
return this.snapshotRegistry.fetchSymbols(source, method, handles, this.
|
|
364
|
+
return this.snapshotRegistry.fetchSymbols(source, method, handles, this.project.id);
|
|
359
365
|
}
|
|
360
366
|
// getBaseTypes is a checker-level endpoint keyed by `type` (not `objectId`),
|
|
361
367
|
// so it cannot go through fetchTypes. This helper reuses that server method.
|
|
362
368
|
fetchBaseTypes(source) {
|
|
363
369
|
const typesData = this.client.apiRequest("getBaseTypes", {
|
|
364
370
|
snapshot: this.snapshotId,
|
|
365
|
-
project: this.
|
|
371
|
+
project: this.project.id,
|
|
366
372
|
type: source.id,
|
|
367
373
|
});
|
|
368
374
|
if (typesData == null)
|
|
@@ -385,9 +391,9 @@ export class Project {
|
|
|
385
391
|
this.compilerOptions = data.compilerOptions;
|
|
386
392
|
this.rootFiles = data.rootFiles;
|
|
387
393
|
this.client = client;
|
|
388
|
-
this.program = new Program(snapshotId, this
|
|
389
|
-
const objectRegistry = new ProjectObjectRegistry(client, snapshotId, this
|
|
390
|
-
this.checker = new Checker(snapshotId, this
|
|
394
|
+
this.program = new Program(snapshotId, this, client, sourceFileCache, toPath);
|
|
395
|
+
const objectRegistry = new ProjectObjectRegistry(client, snapshotId, this, snapshotRegistry);
|
|
396
|
+
this.checker = new Checker(snapshotId, this, client, objectRegistry);
|
|
391
397
|
this.emitter = new Emitter(client);
|
|
392
398
|
}
|
|
393
399
|
dispose() {
|
|
@@ -396,31 +402,34 @@ export class Project {
|
|
|
396
402
|
}
|
|
397
403
|
export class Program {
|
|
398
404
|
snapshotId;
|
|
399
|
-
|
|
405
|
+
project;
|
|
400
406
|
client;
|
|
401
407
|
sourceFileCache;
|
|
402
408
|
toPath;
|
|
403
409
|
decoder = new Wtf8Decoder();
|
|
404
410
|
sourceFileMetadataCache = new Map();
|
|
405
|
-
constructor(snapshotId,
|
|
411
|
+
constructor(snapshotId, project, client, sourceFileCache, toPath) {
|
|
406
412
|
this.snapshotId = snapshotId;
|
|
407
|
-
this.
|
|
413
|
+
this.project = project;
|
|
408
414
|
this.client = client;
|
|
409
415
|
this.sourceFileCache = sourceFileCache;
|
|
410
416
|
this.toPath = toPath;
|
|
411
417
|
}
|
|
418
|
+
getCompilerOptions() {
|
|
419
|
+
return this.project.compilerOptions;
|
|
420
|
+
}
|
|
412
421
|
getSourceFile(file) {
|
|
413
422
|
const fileName = resolveFileName(file);
|
|
414
423
|
const path = this.toPath(fileName);
|
|
415
424
|
// Check if we already have a retained cache entry for this (snapshot, project) pair
|
|
416
|
-
const retained = this.sourceFileCache.getRetained(path, this.snapshotId, this.
|
|
425
|
+
const retained = this.sourceFileCache.getRetained(path, this.snapshotId, this.project.id);
|
|
417
426
|
if (retained) {
|
|
418
427
|
return retained;
|
|
419
428
|
}
|
|
420
429
|
// Fetch from server
|
|
421
430
|
const binaryData = this.client.apiRequestBinary("getSourceFile", {
|
|
422
431
|
snapshot: this.snapshotId,
|
|
423
|
-
project: this.
|
|
432
|
+
project: this.project.id,
|
|
424
433
|
file,
|
|
425
434
|
});
|
|
426
435
|
if (!binaryData) {
|
|
@@ -431,12 +440,12 @@ export class Program {
|
|
|
431
440
|
const parseOptionsKey = readParseOptionsKey(view);
|
|
432
441
|
// Create a new RemoteSourceFile and cache it (set returns existing if hash matches)
|
|
433
442
|
const sourceFile = new RemoteSourceFile(binaryData, this.decoder);
|
|
434
|
-
return this.sourceFileCache.set(path, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.
|
|
443
|
+
return this.sourceFileCache.set(path, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.project.id);
|
|
435
444
|
}
|
|
436
445
|
getSourceFileNames() {
|
|
437
446
|
const data = this.client.apiRequest("getSourceFileNames", {
|
|
438
447
|
snapshot: this.snapshotId,
|
|
439
|
-
project: this.
|
|
448
|
+
project: this.project.id,
|
|
440
449
|
});
|
|
441
450
|
return data ?? [];
|
|
442
451
|
}
|
|
@@ -465,7 +474,7 @@ export class Program {
|
|
|
465
474
|
fetchSourceFileMetadata(path) {
|
|
466
475
|
const data = this.client.apiRequest("getSourceFileMetadata", {
|
|
467
476
|
snapshot: this.snapshotId,
|
|
468
|
-
project: this.
|
|
477
|
+
project: this.project.id,
|
|
469
478
|
file: path,
|
|
470
479
|
});
|
|
471
480
|
return data ?? undefined;
|
|
@@ -495,7 +504,7 @@ export class Program {
|
|
|
495
504
|
getSyntacticDiagnostics(file) {
|
|
496
505
|
const data = this.client.apiRequest("getSyntacticDiagnostics", {
|
|
497
506
|
snapshot: this.snapshotId,
|
|
498
|
-
project: this.
|
|
507
|
+
project: this.project.id,
|
|
499
508
|
...(file !== undefined ? { file } : {}),
|
|
500
509
|
});
|
|
501
510
|
return data ?? [];
|
|
@@ -507,7 +516,7 @@ export class Program {
|
|
|
507
516
|
getBindDiagnostics(file) {
|
|
508
517
|
const data = this.client.apiRequest("getBindDiagnostics", {
|
|
509
518
|
snapshot: this.snapshotId,
|
|
510
|
-
project: this.
|
|
519
|
+
project: this.project.id,
|
|
511
520
|
...(file !== undefined ? { file } : {}),
|
|
512
521
|
});
|
|
513
522
|
return data ?? [];
|
|
@@ -519,7 +528,7 @@ export class Program {
|
|
|
519
528
|
getSemanticDiagnostics(file) {
|
|
520
529
|
const data = this.client.apiRequest("getSemanticDiagnostics", {
|
|
521
530
|
snapshot: this.snapshotId,
|
|
522
|
-
project: this.
|
|
531
|
+
project: this.project.id,
|
|
523
532
|
...(file !== undefined ? { file } : {}),
|
|
524
533
|
});
|
|
525
534
|
return data ?? [];
|
|
@@ -531,7 +540,7 @@ export class Program {
|
|
|
531
540
|
getSuggestionDiagnostics(file) {
|
|
532
541
|
const data = this.client.apiRequest("getSuggestionDiagnostics", {
|
|
533
542
|
snapshot: this.snapshotId,
|
|
534
|
-
project: this.
|
|
543
|
+
project: this.project.id,
|
|
535
544
|
...(file !== undefined ? { file } : {}),
|
|
536
545
|
});
|
|
537
546
|
return data ?? [];
|
|
@@ -543,7 +552,7 @@ export class Program {
|
|
|
543
552
|
getDeclarationDiagnostics(file) {
|
|
544
553
|
const data = this.client.apiRequest("getDeclarationDiagnostics", {
|
|
545
554
|
snapshot: this.snapshotId,
|
|
546
|
-
project: this.
|
|
555
|
+
project: this.project.id,
|
|
547
556
|
...(file !== undefined ? { file } : {}),
|
|
548
557
|
});
|
|
549
558
|
return data ?? [];
|
|
@@ -554,7 +563,7 @@ export class Program {
|
|
|
554
563
|
getProgramDiagnostics() {
|
|
555
564
|
const data = this.client.apiRequest("getProgramDiagnostics", {
|
|
556
565
|
snapshot: this.snapshotId,
|
|
557
|
-
project: this.
|
|
566
|
+
project: this.project.id,
|
|
558
567
|
});
|
|
559
568
|
return data ?? [];
|
|
560
569
|
}
|
|
@@ -564,7 +573,7 @@ export class Program {
|
|
|
564
573
|
getGlobalDiagnostics() {
|
|
565
574
|
const data = this.client.apiRequest("getGlobalDiagnostics", {
|
|
566
575
|
snapshot: this.snapshotId,
|
|
567
|
-
project: this.
|
|
576
|
+
project: this.project.id,
|
|
568
577
|
});
|
|
569
578
|
return data ?? [];
|
|
570
579
|
}
|
|
@@ -574,20 +583,20 @@ export class Program {
|
|
|
574
583
|
getConfigFileParsingDiagnostics() {
|
|
575
584
|
const data = this.client.apiRequest("getConfigFileParsingDiagnostics", {
|
|
576
585
|
snapshot: this.snapshotId,
|
|
577
|
-
project: this.
|
|
586
|
+
project: this.project.id,
|
|
578
587
|
});
|
|
579
588
|
return data ?? [];
|
|
580
589
|
}
|
|
581
590
|
}
|
|
582
591
|
export class Checker {
|
|
583
592
|
snapshotId;
|
|
584
|
-
|
|
593
|
+
project;
|
|
585
594
|
client;
|
|
586
595
|
objectRegistry;
|
|
587
596
|
wellKnownSymbols;
|
|
588
|
-
constructor(snapshotId,
|
|
597
|
+
constructor(snapshotId, project, client, objectRegistry) {
|
|
589
598
|
this.snapshotId = snapshotId;
|
|
590
|
-
this.
|
|
599
|
+
this.project = project;
|
|
591
600
|
this.client = client;
|
|
592
601
|
this.objectRegistry = objectRegistry;
|
|
593
602
|
}
|
|
@@ -598,14 +607,14 @@ export class Checker {
|
|
|
598
607
|
if (Array.isArray(nodeOrNodes)) {
|
|
599
608
|
const data = this.client.apiRequest("getSymbolsAtLocations", {
|
|
600
609
|
snapshot: this.snapshotId,
|
|
601
|
-
project: this.
|
|
610
|
+
project: this.project.id,
|
|
602
611
|
locations: nodeOrNodes.map(node => getNodeId(node)),
|
|
603
612
|
});
|
|
604
613
|
return data.map(d => d ? this.objectRegistry.getOrCreateSymbol(d) : undefined);
|
|
605
614
|
}
|
|
606
615
|
const data = this.client.apiRequest("getSymbolAtLocation", {
|
|
607
616
|
snapshot: this.snapshotId,
|
|
608
|
-
project: this.
|
|
617
|
+
project: this.project.id,
|
|
609
618
|
location: getNodeId(nodeOrNodes),
|
|
610
619
|
});
|
|
611
620
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -614,7 +623,7 @@ export class Checker {
|
|
|
614
623
|
if (typeof positionOrPositions === "number") {
|
|
615
624
|
const data = this.client.apiRequest("getSymbolAtPosition", {
|
|
616
625
|
snapshot: this.snapshotId,
|
|
617
|
-
project: this.
|
|
626
|
+
project: this.project.id,
|
|
618
627
|
file,
|
|
619
628
|
position: positionOrPositions,
|
|
620
629
|
});
|
|
@@ -622,7 +631,7 @@ export class Checker {
|
|
|
622
631
|
}
|
|
623
632
|
const data = this.client.apiRequest("getSymbolsAtPositions", {
|
|
624
633
|
snapshot: this.snapshotId,
|
|
625
|
-
project: this.
|
|
634
|
+
project: this.project.id,
|
|
626
635
|
file,
|
|
627
636
|
positions: positionOrPositions,
|
|
628
637
|
});
|
|
@@ -632,14 +641,14 @@ export class Checker {
|
|
|
632
641
|
if (Array.isArray(symbolOrSymbols)) {
|
|
633
642
|
const data = this.client.apiRequest("getTypesOfSymbols", {
|
|
634
643
|
snapshot: this.snapshotId,
|
|
635
|
-
project: this.
|
|
644
|
+
project: this.project.id,
|
|
636
645
|
symbols: symbolOrSymbols.map(s => s.id),
|
|
637
646
|
});
|
|
638
647
|
return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
|
|
639
648
|
}
|
|
640
649
|
const data = this.client.apiRequest("getTypeOfSymbol", {
|
|
641
650
|
snapshot: this.snapshotId,
|
|
642
|
-
project: this.
|
|
651
|
+
project: this.project.id,
|
|
643
652
|
symbol: symbolOrSymbols.id,
|
|
644
653
|
});
|
|
645
654
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -652,7 +661,7 @@ export class Checker {
|
|
|
652
661
|
getDeclaredTypeOfSymbol(symbol) {
|
|
653
662
|
const data = this.client.apiRequest("getDeclaredTypeOfSymbol", {
|
|
654
663
|
snapshot: this.snapshotId,
|
|
655
|
-
project: this.
|
|
664
|
+
project: this.project.id,
|
|
656
665
|
symbol: symbol.id,
|
|
657
666
|
});
|
|
658
667
|
if (!data)
|
|
@@ -662,40 +671,40 @@ export class Checker {
|
|
|
662
671
|
getReferencesToSymbolInFile(file, symbol) {
|
|
663
672
|
const data = this.client.apiRequest("getReferencesToSymbolInFile", {
|
|
664
673
|
snapshot: this.snapshotId,
|
|
665
|
-
project: this.
|
|
674
|
+
project: this.project.id,
|
|
666
675
|
file,
|
|
667
676
|
symbol: symbol.id,
|
|
668
677
|
});
|
|
669
|
-
return (data ?? []).map(h => new NodeHandle(h));
|
|
678
|
+
return (data ?? []).map(h => new NodeHandle(h, this.project));
|
|
670
679
|
}
|
|
671
680
|
getReferencedSymbolsForNode(node, position) {
|
|
672
681
|
const data = this.client.apiRequest("getReferencedSymbolsForNode", {
|
|
673
682
|
snapshot: this.snapshotId,
|
|
674
|
-
project: this.
|
|
683
|
+
project: this.project.id,
|
|
675
684
|
node: getNodeId(node),
|
|
676
685
|
position,
|
|
677
686
|
});
|
|
678
687
|
return (data ?? []).map(entry => ({
|
|
679
|
-
definition: new NodeHandle(entry.definition),
|
|
688
|
+
definition: new NodeHandle(entry.definition, this.project),
|
|
680
689
|
symbol: entry.symbol ? this.objectRegistry.getOrCreateSymbol(entry.symbol) : undefined,
|
|
681
|
-
references: (entry.references ?? []).map(h => new NodeHandle(h)),
|
|
690
|
+
references: (entry.references ?? []).map(h => new NodeHandle(h, this.project)),
|
|
682
691
|
}));
|
|
683
692
|
}
|
|
684
693
|
getSignatureUsage(signatureDecl) {
|
|
685
694
|
const data = this.client.apiRequest("getSignatureUsages", {
|
|
686
695
|
snapshot: this.snapshotId,
|
|
687
|
-
project: this.
|
|
696
|
+
project: this.project.id,
|
|
688
697
|
signatureDecl: getNodeId(signatureDecl),
|
|
689
698
|
});
|
|
690
699
|
return (data ?? []).map(entry => ({
|
|
691
|
-
name: new NodeHandle(entry.name),
|
|
692
|
-
call: entry.call ? new NodeHandle(entry.call) : undefined,
|
|
700
|
+
name: new NodeHandle(entry.name, this.project),
|
|
701
|
+
call: entry.call ? new NodeHandle(entry.call, this.project) : undefined,
|
|
693
702
|
}));
|
|
694
703
|
}
|
|
695
704
|
getCompletionsAtPosition(document, position, options) {
|
|
696
705
|
const data = this.client.apiRequest("getCompletionsAtPosition", {
|
|
697
706
|
snapshot: this.snapshotId,
|
|
698
|
-
project: this.
|
|
707
|
+
project: this.project.id,
|
|
699
708
|
file: document,
|
|
700
709
|
position,
|
|
701
710
|
triggerCharacter: options?.triggerCharacter,
|
|
@@ -715,14 +724,14 @@ export class Checker {
|
|
|
715
724
|
if (Array.isArray(nodeOrNodes)) {
|
|
716
725
|
const data = this.client.apiRequest("getTypeAtLocations", {
|
|
717
726
|
snapshot: this.snapshotId,
|
|
718
|
-
project: this.
|
|
727
|
+
project: this.project.id,
|
|
719
728
|
locations: nodeOrNodes.map(node => getNodeId(node)),
|
|
720
729
|
});
|
|
721
730
|
return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
|
|
722
731
|
}
|
|
723
732
|
const data = this.client.apiRequest("getTypeAtLocation", {
|
|
724
733
|
snapshot: this.snapshotId,
|
|
725
|
-
project: this.
|
|
734
|
+
project: this.project.id,
|
|
726
735
|
location: getNodeId(nodeOrNodes),
|
|
727
736
|
});
|
|
728
737
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -730,7 +739,7 @@ export class Checker {
|
|
|
730
739
|
getSignaturesOfType(type, kind) {
|
|
731
740
|
const data = this.client.apiRequest("getSignaturesOfType", {
|
|
732
741
|
snapshot: this.snapshotId,
|
|
733
|
-
project: this.
|
|
742
|
+
project: this.project.id,
|
|
734
743
|
type: type.id,
|
|
735
744
|
kind,
|
|
736
745
|
});
|
|
@@ -739,7 +748,7 @@ export class Checker {
|
|
|
739
748
|
getResolvedSignature(node) {
|
|
740
749
|
const data = this.client.apiRequest("getResolvedSignature", {
|
|
741
750
|
snapshot: this.snapshotId,
|
|
742
|
-
project: this.
|
|
751
|
+
project: this.project.id,
|
|
743
752
|
location: getNodeId(node),
|
|
744
753
|
});
|
|
745
754
|
return data ? this.objectRegistry.getOrCreateSignature(data) : undefined;
|
|
@@ -748,7 +757,7 @@ export class Checker {
|
|
|
748
757
|
if (typeof positionOrPositions === "number") {
|
|
749
758
|
const data = this.client.apiRequest("getTypeAtPosition", {
|
|
750
759
|
snapshot: this.snapshotId,
|
|
751
|
-
project: this.
|
|
760
|
+
project: this.project.id,
|
|
752
761
|
file,
|
|
753
762
|
position: positionOrPositions,
|
|
754
763
|
});
|
|
@@ -756,7 +765,7 @@ export class Checker {
|
|
|
756
765
|
}
|
|
757
766
|
const data = this.client.apiRequest("getTypesAtPositions", {
|
|
758
767
|
snapshot: this.snapshotId,
|
|
759
|
-
project: this.
|
|
768
|
+
project: this.project.id,
|
|
760
769
|
file,
|
|
761
770
|
positions: positionOrPositions,
|
|
762
771
|
});
|
|
@@ -767,7 +776,7 @@ export class Checker {
|
|
|
767
776
|
const isNode = location && "kind" in location;
|
|
768
777
|
const data = this.client.apiRequest("resolveName", {
|
|
769
778
|
snapshot: this.snapshotId,
|
|
770
|
-
project: this.
|
|
779
|
+
project: this.project.id,
|
|
771
780
|
name,
|
|
772
781
|
meaning,
|
|
773
782
|
location: isNode ? getNodeId(location) : undefined,
|
|
@@ -786,7 +795,7 @@ export class Checker {
|
|
|
786
795
|
getContextualType(node) {
|
|
787
796
|
const data = this.client.apiRequest("getContextualType", {
|
|
788
797
|
snapshot: this.snapshotId,
|
|
789
|
-
project: this.
|
|
798
|
+
project: this.project.id,
|
|
790
799
|
location: getNodeId(node),
|
|
791
800
|
});
|
|
792
801
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -794,7 +803,7 @@ export class Checker {
|
|
|
794
803
|
getBaseTypeOfLiteralType(type) {
|
|
795
804
|
const data = this.client.apiRequest("getBaseTypeOfLiteralType", {
|
|
796
805
|
snapshot: this.snapshotId,
|
|
797
|
-
project: this.
|
|
806
|
+
project: this.project.id,
|
|
798
807
|
type: type.id,
|
|
799
808
|
});
|
|
800
809
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -802,7 +811,7 @@ export class Checker {
|
|
|
802
811
|
getNonNullableType(type) {
|
|
803
812
|
const data = this.client.apiRequest("getNonNullableType", {
|
|
804
813
|
snapshot: this.snapshotId,
|
|
805
|
-
project: this.
|
|
814
|
+
project: this.project.id,
|
|
806
815
|
type: type.id,
|
|
807
816
|
});
|
|
808
817
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -810,7 +819,7 @@ export class Checker {
|
|
|
810
819
|
getTypeFromTypeNode(node) {
|
|
811
820
|
const data = this.client.apiRequest("getTypeFromTypeNode", {
|
|
812
821
|
snapshot: this.snapshotId,
|
|
813
|
-
project: this.
|
|
822
|
+
project: this.project.id,
|
|
814
823
|
location: getNodeId(node),
|
|
815
824
|
});
|
|
816
825
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -818,7 +827,7 @@ export class Checker {
|
|
|
818
827
|
getWidenedType(type) {
|
|
819
828
|
const data = this.client.apiRequest("getWidenedType", {
|
|
820
829
|
snapshot: this.snapshotId,
|
|
821
|
-
project: this.
|
|
830
|
+
project: this.project.id,
|
|
822
831
|
type: type.id,
|
|
823
832
|
});
|
|
824
833
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -826,7 +835,7 @@ export class Checker {
|
|
|
826
835
|
getParameterType(signature, index) {
|
|
827
836
|
const data = this.client.apiRequest("getParameterType", {
|
|
828
837
|
snapshot: this.snapshotId,
|
|
829
|
-
project: this.
|
|
838
|
+
project: this.project.id,
|
|
830
839
|
signature: signature.id,
|
|
831
840
|
index,
|
|
832
841
|
});
|
|
@@ -835,14 +844,14 @@ export class Checker {
|
|
|
835
844
|
isArrayLikeType(type) {
|
|
836
845
|
return this.client.apiRequest("isArrayLikeType", {
|
|
837
846
|
snapshot: this.snapshotId,
|
|
838
|
-
project: this.
|
|
847
|
+
project: this.project.id,
|
|
839
848
|
type: type.id,
|
|
840
849
|
});
|
|
841
850
|
}
|
|
842
851
|
isTypeAssignableTo(source, target) {
|
|
843
852
|
return this.client.apiRequest("isTypeAssignableTo", {
|
|
844
853
|
snapshot: this.snapshotId,
|
|
845
|
-
project: this.
|
|
854
|
+
project: this.project.id,
|
|
846
855
|
source: source.id,
|
|
847
856
|
target: target.id,
|
|
848
857
|
});
|
|
@@ -850,7 +859,7 @@ export class Checker {
|
|
|
850
859
|
getShorthandAssignmentValueSymbol(node) {
|
|
851
860
|
const data = this.client.apiRequest("getShorthandAssignmentValueSymbol", {
|
|
852
861
|
snapshot: this.snapshotId,
|
|
853
|
-
project: this.
|
|
862
|
+
project: this.project.id,
|
|
854
863
|
location: getNodeId(node),
|
|
855
864
|
});
|
|
856
865
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -863,7 +872,7 @@ export class Checker {
|
|
|
863
872
|
getTypeOfSymbolAtLocation(symbol, location) {
|
|
864
873
|
const data = this.client.apiRequest("getTypeOfSymbolAtLocation", {
|
|
865
874
|
snapshot: this.snapshotId,
|
|
866
|
-
project: this.
|
|
875
|
+
project: this.project.id,
|
|
867
876
|
symbol: symbol.id,
|
|
868
877
|
location: getNodeId(location),
|
|
869
878
|
});
|
|
@@ -874,7 +883,7 @@ export class Checker {
|
|
|
874
883
|
getIntrinsicType(method) {
|
|
875
884
|
const data = this.client.apiRequest(method, {
|
|
876
885
|
snapshot: this.snapshotId,
|
|
877
|
-
project: this.
|
|
886
|
+
project: this.project.id,
|
|
878
887
|
});
|
|
879
888
|
return this.objectRegistry.getOrCreateType(data);
|
|
880
889
|
}
|
|
@@ -914,7 +923,7 @@ export class Checker {
|
|
|
914
923
|
typeToTypeNode(type, enclosingDeclaration, flags) {
|
|
915
924
|
const binaryData = this.client.apiRequestBinary("typeToTypeNode", {
|
|
916
925
|
snapshot: this.snapshotId,
|
|
917
|
-
project: this.
|
|
926
|
+
project: this.project.id,
|
|
918
927
|
type: type.id,
|
|
919
928
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
920
929
|
flags,
|
|
@@ -926,7 +935,7 @@ export class Checker {
|
|
|
926
935
|
signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags) {
|
|
927
936
|
const binaryData = this.client.apiRequestBinary("signatureToSignatureDeclaration", {
|
|
928
937
|
snapshot: this.snapshotId,
|
|
929
|
-
project: this.
|
|
938
|
+
project: this.project.id,
|
|
930
939
|
signature: signature.id,
|
|
931
940
|
kind,
|
|
932
941
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
@@ -939,7 +948,7 @@ export class Checker {
|
|
|
939
948
|
typeToString(type, enclosingDeclaration, flags) {
|
|
940
949
|
return this.client.apiRequest("typeToString", {
|
|
941
950
|
snapshot: this.snapshotId,
|
|
942
|
-
project: this.
|
|
951
|
+
project: this.project.id,
|
|
943
952
|
type: type.id,
|
|
944
953
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
945
954
|
flags,
|
|
@@ -948,28 +957,28 @@ export class Checker {
|
|
|
948
957
|
isContextSensitive(node) {
|
|
949
958
|
return this.client.apiRequest("isContextSensitive", {
|
|
950
959
|
snapshot: this.snapshotId,
|
|
951
|
-
project: this.
|
|
960
|
+
project: this.project.id,
|
|
952
961
|
location: getNodeId(node),
|
|
953
962
|
});
|
|
954
963
|
}
|
|
955
964
|
isArrayType(type) {
|
|
956
965
|
return this.client.apiRequest("isArrayType", {
|
|
957
966
|
snapshot: this.snapshotId,
|
|
958
|
-
project: this.
|
|
967
|
+
project: this.project.id,
|
|
959
968
|
type: type.id,
|
|
960
969
|
});
|
|
961
970
|
}
|
|
962
971
|
isTupleType(type) {
|
|
963
972
|
return this.client.apiRequest("isTupleType", {
|
|
964
973
|
snapshot: this.snapshotId,
|
|
965
|
-
project: this.
|
|
974
|
+
project: this.project.id,
|
|
966
975
|
type: type.id,
|
|
967
976
|
});
|
|
968
977
|
}
|
|
969
978
|
getReturnTypeOfSignature(signature) {
|
|
970
979
|
const data = this.client.apiRequest("getReturnTypeOfSignature", {
|
|
971
980
|
snapshot: this.snapshotId,
|
|
972
|
-
project: this.
|
|
981
|
+
project: this.project.id,
|
|
973
982
|
signature: signature.id,
|
|
974
983
|
});
|
|
975
984
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -977,7 +986,7 @@ export class Checker {
|
|
|
977
986
|
getRestTypeOfSignature(signature) {
|
|
978
987
|
const data = this.client.apiRequest("getRestTypeOfSignature", {
|
|
979
988
|
snapshot: this.snapshotId,
|
|
980
|
-
project: this.
|
|
989
|
+
project: this.project.id,
|
|
981
990
|
signature: signature.id,
|
|
982
991
|
});
|
|
983
992
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -985,7 +994,7 @@ export class Checker {
|
|
|
985
994
|
getTypePredicateOfSignature(signature) {
|
|
986
995
|
const data = this.client.apiRequest("getTypePredicateOfSignature", {
|
|
987
996
|
snapshot: this.snapshotId,
|
|
988
|
-
project: this.
|
|
997
|
+
project: this.project.id,
|
|
989
998
|
signature: signature.id,
|
|
990
999
|
});
|
|
991
1000
|
if (!data)
|
|
@@ -1004,7 +1013,7 @@ export class Checker {
|
|
|
1004
1013
|
getBaseTypes(type) {
|
|
1005
1014
|
const data = this.client.apiRequest("getBaseTypes", {
|
|
1006
1015
|
snapshot: this.snapshotId,
|
|
1007
|
-
project: this.
|
|
1016
|
+
project: this.project.id,
|
|
1008
1017
|
type: type.id,
|
|
1009
1018
|
});
|
|
1010
1019
|
return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
|
|
@@ -1012,7 +1021,7 @@ export class Checker {
|
|
|
1012
1021
|
getApparentType(type) {
|
|
1013
1022
|
const data = this.client.apiRequest("getApparentType", {
|
|
1014
1023
|
snapshot: this.snapshotId,
|
|
1015
|
-
project: this.
|
|
1024
|
+
project: this.project.id,
|
|
1016
1025
|
type: type.id,
|
|
1017
1026
|
});
|
|
1018
1027
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1020,7 +1029,7 @@ export class Checker {
|
|
|
1020
1029
|
getPropertiesOfType(type) {
|
|
1021
1030
|
const data = this.client.apiRequest("getPropertiesOfType", {
|
|
1022
1031
|
snapshot: this.snapshotId,
|
|
1023
|
-
project: this.
|
|
1032
|
+
project: this.project.id,
|
|
1024
1033
|
type: type.id,
|
|
1025
1034
|
});
|
|
1026
1035
|
return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
@@ -1028,7 +1037,7 @@ export class Checker {
|
|
|
1028
1037
|
getIndexInfosOfType(type) {
|
|
1029
1038
|
const data = this.client.apiRequest("getIndexInfosOfType", {
|
|
1030
1039
|
snapshot: this.snapshotId,
|
|
1031
|
-
project: this.
|
|
1040
|
+
project: this.project.id,
|
|
1032
1041
|
type: type.id,
|
|
1033
1042
|
});
|
|
1034
1043
|
if (!data)
|
|
@@ -1037,7 +1046,7 @@ export class Checker {
|
|
|
1037
1046
|
keyType: this.objectRegistry.getOrCreateType(d.keyType),
|
|
1038
1047
|
valueType: this.objectRegistry.getOrCreateType(d.valueType),
|
|
1039
1048
|
isReadonly: d.isReadonly ?? false,
|
|
1040
|
-
declaration: d.declaration ? new NodeHandle(d.declaration) : undefined,
|
|
1049
|
+
declaration: d.declaration ? new NodeHandle(d.declaration, this.project) : undefined,
|
|
1041
1050
|
}));
|
|
1042
1051
|
}
|
|
1043
1052
|
/**
|
|
@@ -1047,7 +1056,7 @@ export class Checker {
|
|
|
1047
1056
|
getConstraintOfTypeParameter(type) {
|
|
1048
1057
|
const data = this.client.apiRequest("getConstraintOfTypeParameter", {
|
|
1049
1058
|
snapshot: this.snapshotId,
|
|
1050
|
-
project: this.
|
|
1059
|
+
project: this.project.id,
|
|
1051
1060
|
type: type.id,
|
|
1052
1061
|
});
|
|
1053
1062
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1055,7 +1064,7 @@ export class Checker {
|
|
|
1055
1064
|
getBaseConstraintOfType(type) {
|
|
1056
1065
|
const data = this.client.apiRequest("getBaseConstraintOfType", {
|
|
1057
1066
|
snapshot: this.snapshotId,
|
|
1058
|
-
project: this.
|
|
1067
|
+
project: this.project.id,
|
|
1059
1068
|
type: type.id,
|
|
1060
1069
|
});
|
|
1061
1070
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1063,7 +1072,7 @@ export class Checker {
|
|
|
1063
1072
|
getPropertyOfType(type, name) {
|
|
1064
1073
|
const data = this.client.apiRequest("getPropertyOfType", {
|
|
1065
1074
|
snapshot: this.snapshotId,
|
|
1066
|
-
project: this.
|
|
1075
|
+
project: this.project.id,
|
|
1067
1076
|
type: type.id,
|
|
1068
1077
|
name,
|
|
1069
1078
|
});
|
|
@@ -1072,7 +1081,7 @@ export class Checker {
|
|
|
1072
1081
|
getConstantValue(node) {
|
|
1073
1082
|
const data = this.client.apiRequest("getConstantValue", {
|
|
1074
1083
|
snapshot: this.snapshotId,
|
|
1075
|
-
project: this.
|
|
1084
|
+
project: this.project.id,
|
|
1076
1085
|
location: getNodeId(node),
|
|
1077
1086
|
});
|
|
1078
1087
|
return data ?? undefined;
|
|
@@ -1080,7 +1089,7 @@ export class Checker {
|
|
|
1080
1089
|
getSignatureFromDeclaration(node) {
|
|
1081
1090
|
const data = this.client.apiRequest("getSignatureFromDeclaration", {
|
|
1082
1091
|
snapshot: this.snapshotId,
|
|
1083
|
-
project: this.
|
|
1092
|
+
project: this.project.id,
|
|
1084
1093
|
location: getNodeId(node),
|
|
1085
1094
|
});
|
|
1086
1095
|
return data ? this.objectRegistry.getOrCreateSignature(data) : undefined;
|
|
@@ -1088,7 +1097,7 @@ export class Checker {
|
|
|
1088
1097
|
getExportSpecifierLocalTargetSymbol(node) {
|
|
1089
1098
|
const data = this.client.apiRequest("getExportSpecifierLocalTargetSymbol", {
|
|
1090
1099
|
snapshot: this.snapshotId,
|
|
1091
|
-
project: this.
|
|
1100
|
+
project: this.project.id,
|
|
1092
1101
|
location: getNodeId(node),
|
|
1093
1102
|
});
|
|
1094
1103
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -1101,7 +1110,7 @@ export class Checker {
|
|
|
1101
1110
|
getAliasedSymbol(symbol) {
|
|
1102
1111
|
const data = this.client.apiRequest("getAliasedSymbol", {
|
|
1103
1112
|
snapshot: this.snapshotId,
|
|
1104
|
-
project: this.
|
|
1113
|
+
project: this.project.id,
|
|
1105
1114
|
symbol: symbol.id,
|
|
1106
1115
|
});
|
|
1107
1116
|
if (!data)
|
|
@@ -1111,7 +1120,7 @@ export class Checker {
|
|
|
1111
1120
|
getImmediateAliasedSymbol(symbol) {
|
|
1112
1121
|
const data = this.client.apiRequest("getImmediateAliasedSymbol", {
|
|
1113
1122
|
snapshot: this.snapshotId,
|
|
1114
|
-
project: this.
|
|
1123
|
+
project: this.project.id,
|
|
1115
1124
|
symbol: symbol.id,
|
|
1116
1125
|
});
|
|
1117
1126
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -1125,7 +1134,7 @@ export class Checker {
|
|
|
1125
1134
|
getWellKnownSymbols() {
|
|
1126
1135
|
return this.wellKnownSymbols ??= this.client.apiRequest("getWellKnownSymbols", {
|
|
1127
1136
|
snapshot: this.snapshotId,
|
|
1128
|
-
project: this.
|
|
1137
|
+
project: this.project.id,
|
|
1129
1138
|
});
|
|
1130
1139
|
}
|
|
1131
1140
|
/**
|
|
@@ -1150,7 +1159,7 @@ export class Checker {
|
|
|
1150
1159
|
getExportsOfModule(symbol) {
|
|
1151
1160
|
const data = this.client.apiRequest("getExportsOfModule", {
|
|
1152
1161
|
snapshot: this.snapshotId,
|
|
1153
|
-
project: this.
|
|
1162
|
+
project: this.project.id,
|
|
1154
1163
|
symbol: symbol.id,
|
|
1155
1164
|
});
|
|
1156
1165
|
return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
@@ -1158,7 +1167,7 @@ export class Checker {
|
|
|
1158
1167
|
getMemberInModuleExports(symbol, name) {
|
|
1159
1168
|
const data = this.client.apiRequest("getMemberInModuleExports", {
|
|
1160
1169
|
snapshot: this.snapshotId,
|
|
1161
|
-
project: this.
|
|
1170
|
+
project: this.project.id,
|
|
1162
1171
|
symbol: symbol.id,
|
|
1163
1172
|
name,
|
|
1164
1173
|
});
|
|
@@ -1167,7 +1176,7 @@ export class Checker {
|
|
|
1167
1176
|
getJsDocTagsOfSymbol(symbol) {
|
|
1168
1177
|
const data = this.client.apiRequest("getJsDocTags", {
|
|
1169
1178
|
snapshot: this.snapshotId,
|
|
1170
|
-
project: this.
|
|
1179
|
+
project: this.project.id,
|
|
1171
1180
|
symbol: symbol.id,
|
|
1172
1181
|
});
|
|
1173
1182
|
return data ?? [];
|
|
@@ -1175,7 +1184,7 @@ export class Checker {
|
|
|
1175
1184
|
getDocumentationCommentOfSymbol(symbol) {
|
|
1176
1185
|
return this.client.apiRequest("getDocumentationComment", {
|
|
1177
1186
|
snapshot: this.snapshotId,
|
|
1178
|
-
project: this.
|
|
1187
|
+
project: this.project.id,
|
|
1179
1188
|
symbol: symbol.id,
|
|
1180
1189
|
});
|
|
1181
1190
|
}
|
|
@@ -1185,7 +1194,7 @@ export class Checker {
|
|
|
1185
1194
|
getTypeArguments(type) {
|
|
1186
1195
|
const data = this.client.apiRequest("getTypeArguments", {
|
|
1187
1196
|
snapshot: this.snapshotId,
|
|
1188
|
-
project: this.
|
|
1197
|
+
project: this.project.id,
|
|
1189
1198
|
type: type.id,
|
|
1190
1199
|
});
|
|
1191
1200
|
return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
|
|
@@ -1206,20 +1215,28 @@ export class Emitter {
|
|
|
1206
1215
|
}
|
|
1207
1216
|
}
|
|
1208
1217
|
export class NodeHandle {
|
|
1218
|
+
/**
|
|
1219
|
+
* The project this handle was produced in, used as the default for {@link resolve}.
|
|
1220
|
+
* Node handles are only meaningful within a project's program, so the producing project
|
|
1221
|
+
* is remembered so callers don't have to pass it explicitly.
|
|
1222
|
+
*/
|
|
1223
|
+
canonicalProject;
|
|
1209
1224
|
index;
|
|
1210
1225
|
kind;
|
|
1211
1226
|
path;
|
|
1212
|
-
constructor(handle) {
|
|
1227
|
+
constructor(handle, canonicalProject) {
|
|
1213
1228
|
const parsed = parseNodeHandle(handle);
|
|
1214
1229
|
this.index = parsed.index;
|
|
1215
1230
|
this.kind = parsed.kind;
|
|
1216
1231
|
this.path = parsed.path;
|
|
1232
|
+
this.canonicalProject = canonicalProject;
|
|
1217
1233
|
}
|
|
1218
1234
|
/**
|
|
1219
|
-
* Resolve this handle to the actual AST node by fetching the source file
|
|
1220
|
-
*
|
|
1235
|
+
* Resolve this handle to the actual AST node by fetching the source file from a project
|
|
1236
|
+
* and looking up the node by index. If no project is passed, the project that produced
|
|
1237
|
+
* the handle is used.
|
|
1221
1238
|
*/
|
|
1222
|
-
resolve(project) {
|
|
1239
|
+
resolve(project = this.canonicalProject) {
|
|
1223
1240
|
const sourceFile = project.program.getSourceFile(this.path);
|
|
1224
1241
|
if (!sourceFile) {
|
|
1225
1242
|
return undefined;
|
|
@@ -1229,6 +1246,12 @@ export class NodeHandle {
|
|
|
1229
1246
|
}
|
|
1230
1247
|
export class Symbol {
|
|
1231
1248
|
objectRegistry;
|
|
1249
|
+
/**
|
|
1250
|
+
* The project this symbol was first observed in, used as the default project for
|
|
1251
|
+
* lookups that need a project context (members/exports/parent). Symbols are shared
|
|
1252
|
+
* snapshot-wide, so these lookups can otherwise be ambiguous about which project to use.
|
|
1253
|
+
*/
|
|
1254
|
+
canonicalProject;
|
|
1232
1255
|
id;
|
|
1233
1256
|
/** The escaped (`__String`) name, used as the key in member/export tables. */
|
|
1234
1257
|
escapedName;
|
|
@@ -1249,15 +1272,20 @@ export class Symbol {
|
|
|
1249
1272
|
this.name = unescapeLeadingUnderscores(data.name);
|
|
1250
1273
|
this.flags = data.flags;
|
|
1251
1274
|
this.checkFlags = data.checkFlags;
|
|
1252
|
-
|
|
1253
|
-
|
|
1275
|
+
const canonicalProject = objectRegistry.getProject(data.project);
|
|
1276
|
+
if (!canonicalProject) {
|
|
1277
|
+
throw new Error(`Symbol ${data.id} references unknown canonical project '${data.project}'`);
|
|
1278
|
+
}
|
|
1279
|
+
this.canonicalProject = canonicalProject;
|
|
1280
|
+
this.declarations = (data.declarations ?? []).map(d => new NodeHandle(d, canonicalProject));
|
|
1281
|
+
this.valueDeclaration = data.valueDeclaration ? new NodeHandle(data.valueDeclaration, canonicalProject) : undefined;
|
|
1254
1282
|
if (data.parent !== undefined)
|
|
1255
1283
|
this.parent = data.parent;
|
|
1256
1284
|
if (data.exportSymbol !== undefined)
|
|
1257
1285
|
this.exportSymbol = data.exportSymbol;
|
|
1258
1286
|
}
|
|
1259
1287
|
getParent() {
|
|
1260
|
-
return this.objectRegistry.fetchSymbol(this, "getParentOfSymbol", this.parent);
|
|
1288
|
+
return this.objectRegistry.fetchSymbol(this, "getParentOfSymbol", this.parent, this.canonicalProject.id);
|
|
1261
1289
|
}
|
|
1262
1290
|
/**
|
|
1263
1291
|
* Get this symbol's members keyed by escaped name. The result is cached on
|
|
@@ -1274,7 +1302,7 @@ export class Symbol {
|
|
|
1274
1302
|
return this.exportsCache ??= this.fetchSymbolTable("getExportsOfSymbol");
|
|
1275
1303
|
}
|
|
1276
1304
|
fetchSymbolTable(method) {
|
|
1277
|
-
const symbols = this.objectRegistry.fetchSymbols(this, method);
|
|
1305
|
+
const symbols = this.objectRegistry.fetchSymbols(this, method, undefined, this.canonicalProject.id);
|
|
1278
1306
|
const table = new Map();
|
|
1279
1307
|
for (const symbol of symbols) {
|
|
1280
1308
|
table.set(symbol.escapedName, symbol);
|
|
@@ -1284,7 +1312,7 @@ export class Symbol {
|
|
|
1284
1312
|
getExportSymbol() {
|
|
1285
1313
|
if (!this.exportSymbol)
|
|
1286
1314
|
return this;
|
|
1287
|
-
return this.objectRegistry.fetchSymbol(this, "getExportSymbolOfSymbol", this.exportSymbol);
|
|
1315
|
+
return this.objectRegistry.fetchSymbol(this, "getExportSymbolOfSymbol", this.exportSymbol, this.canonicalProject.id);
|
|
1288
1316
|
}
|
|
1289
1317
|
getJsDocTags(checker) {
|
|
1290
1318
|
return checker.getJsDocTagsOfSymbol(this);
|
|
@@ -1584,11 +1612,11 @@ export class Signature {
|
|
|
1584
1612
|
parameters;
|
|
1585
1613
|
thisParameter;
|
|
1586
1614
|
target;
|
|
1587
|
-
constructor(data, objectRegistry) {
|
|
1615
|
+
constructor(data, project, objectRegistry) {
|
|
1588
1616
|
this.id = data.id;
|
|
1589
1617
|
this.flags = data.flags;
|
|
1590
1618
|
this.objectRegistry = objectRegistry;
|
|
1591
|
-
this.declaration = data.declaration ? new NodeHandle(data.declaration) : undefined;
|
|
1619
|
+
this.declaration = data.declaration ? new NodeHandle(data.declaration, project) : undefined;
|
|
1592
1620
|
this.typeParameters = data.typeParameters ?? [];
|
|
1593
1621
|
this.parameters = data.parameters ?? [];
|
|
1594
1622
|
this.thisParameter = data.thisParameter;
|