@typescript/native-preview 7.0.0-dev.20260701.1 → 7.0.0-dev.20260703.1
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 +51 -20
- package/dist/api/async/api.d.ts.map +1 -1
- package/dist/api/async/api.js +155 -109
- package/dist/api/async/api.js.map +1 -1
- package/dist/api/async/client.d.ts +17 -0
- package/dist/api/async/client.d.ts.map +1 -1
- package/dist/api/async/client.js +72 -1
- package/dist/api/async/client.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/node/node.d.ts +3 -1
- package/dist/api/node/node.d.ts.map +1 -1
- package/dist/api/node/node.generated.d.ts.map +1 -1
- package/dist/api/node/node.generated.js +7 -4
- package/dist/api/node/node.generated.js.map +1 -1
- package/dist/api/node/node.infrastructure.d.ts +8 -0
- package/dist/api/node/node.infrastructure.d.ts.map +1 -1
- package/dist/api/node/node.infrastructure.js.map +1 -1
- package/dist/api/node/node.js +7 -1
- package/dist/api/node/node.js.map +1 -1
- package/dist/api/options.d.ts +8 -0
- package/dist/api/options.d.ts.map +1 -1
- package/dist/api/options.js.map +1 -1
- 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 +51 -20
- package/dist/api/sync/api.d.ts.map +1 -1
- package/dist/api/sync/api.js +155 -109
- package/dist/api/sync/api.js.map +1 -1
- package/dist/api/sync/client.d.ts +17 -0
- package/dist/api/sync/client.d.ts.map +1 -1
- package/dist/api/sync/client.js +53 -1
- package/dist/api/sync/client.js.map +1 -1
- package/dist/api/syncChannel.d.ts +4 -1
- package/dist/api/syncChannel.d.ts.map +1 -1
- package/dist/api/syncChannel.js +21 -1
- package/dist/api/syncChannel.js.map +1 -1
- package/dist/api/timing.d.ts +175 -0
- package/dist/api/timing.d.ts.map +1 -0
- package/dist/api/timing.js +149 -0
- package/dist/api/timing.js.map +1 -0
- 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/async/api.js
CHANGED
|
@@ -18,8 +18,8 @@ import { createGetCanonicalFileName, toPath, } from "../path.js";
|
|
|
18
18
|
import { resolveFileName, toUpdateSnapshotRequest, } from "../proto.js";
|
|
19
19
|
import { SourceFileCache } from "../sourceFileCache.js";
|
|
20
20
|
import { Client, } from "./client.js";
|
|
21
|
-
export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, ModuleKind, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
|
|
22
21
|
export { documentURIToFileName, fileNameToDocumentURI } from "../path.js";
|
|
22
|
+
export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, ModuleKind, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
|
|
23
23
|
export class API {
|
|
24
24
|
client;
|
|
25
25
|
sourceFileCache;
|
|
@@ -92,6 +92,24 @@ export class API {
|
|
|
92
92
|
clearSourceFileCache() {
|
|
93
93
|
this.sourceFileCache.clear();
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Returns a snapshot of collected timing information for requests made
|
|
97
|
+
* through this API instance: client-measured round-trip latency and bytes
|
|
98
|
+
* transferred, folded together with the server's own per-request processing
|
|
99
|
+
* time and an estimated transport overhead (round-trip minus server time).
|
|
100
|
+
*
|
|
101
|
+
* Fetching the snapshot issues a lightweight request to the server to
|
|
102
|
+
* retrieve its timing collection. Collection must be enabled via the
|
|
103
|
+
* `collectTiming` option; when it is not, the returned snapshot has
|
|
104
|
+
* `enabled: false` and zeroed totals.
|
|
105
|
+
*/
|
|
106
|
+
getTimingInfo() {
|
|
107
|
+
return this.client.getTimingInfo();
|
|
108
|
+
}
|
|
109
|
+
/** Clears all accumulated timing totals and recent-request history, on both the client and the server. */
|
|
110
|
+
resetTimingInfo() {
|
|
111
|
+
return this.client.resetTimingInfo();
|
|
112
|
+
}
|
|
95
113
|
}
|
|
96
114
|
export class InternalAPI {
|
|
97
115
|
client;
|
|
@@ -129,8 +147,8 @@ export class Snapshot {
|
|
|
129
147
|
this.client = client;
|
|
130
148
|
this.toPath = toPath;
|
|
131
149
|
this.onDispose = onDispose;
|
|
132
|
-
this.snapshotRegistry = new SnapshotObjectRegistry(client, this.id);
|
|
133
150
|
this.projectMap = new Map();
|
|
151
|
+
this.snapshotRegistry = new SnapshotObjectRegistry(client, this.id, projectId => this.projectMap.get(projectId));
|
|
134
152
|
for (const projData of data.projects) {
|
|
135
153
|
const project = new Project(projData, this.id, client, sourceFileCache, toPath, this.snapshotRegistry);
|
|
136
154
|
this.projectMap.set(toPath(projData.configFileName), project);
|
|
@@ -182,9 +200,15 @@ class SnapshotObjectRegistry {
|
|
|
182
200
|
symbols = new Map();
|
|
183
201
|
client;
|
|
184
202
|
snapshotId;
|
|
185
|
-
|
|
203
|
+
resolveProject;
|
|
204
|
+
constructor(client, snapshotId, resolveProject) {
|
|
186
205
|
this.client = client;
|
|
187
206
|
this.snapshotId = snapshotId;
|
|
207
|
+
this.resolveProject = resolveProject;
|
|
208
|
+
}
|
|
209
|
+
/** Resolve a project id (a config file path) to its Project within this snapshot. */
|
|
210
|
+
getProject(projectId) {
|
|
211
|
+
return this.resolveProject(projectId);
|
|
188
212
|
}
|
|
189
213
|
getOrCreateSymbol(data) {
|
|
190
214
|
let symbol = this.symbols.get(data.id);
|
|
@@ -244,14 +268,14 @@ class SnapshotObjectRegistry {
|
|
|
244
268
|
class ProjectObjectRegistry {
|
|
245
269
|
client;
|
|
246
270
|
snapshotId;
|
|
247
|
-
|
|
271
|
+
project;
|
|
248
272
|
snapshotRegistry;
|
|
249
273
|
types = new Map();
|
|
250
274
|
signatures = new Map();
|
|
251
|
-
constructor(client, snapshotId,
|
|
275
|
+
constructor(client, snapshotId, project, snapshotRegistry) {
|
|
252
276
|
this.client = client;
|
|
253
277
|
this.snapshotId = snapshotId;
|
|
254
|
-
this.
|
|
278
|
+
this.project = project;
|
|
255
279
|
this.snapshotRegistry = snapshotRegistry;
|
|
256
280
|
}
|
|
257
281
|
getOrCreateSymbol(data) {
|
|
@@ -274,7 +298,7 @@ class ProjectObjectRegistry {
|
|
|
274
298
|
getOrCreateSignature(data) {
|
|
275
299
|
let sig = this.signatures.get(data.id);
|
|
276
300
|
if (!sig) {
|
|
277
|
-
sig = new Signature(data, this);
|
|
301
|
+
sig = new Signature(data, this.project, this);
|
|
278
302
|
this.signatures.set(data.id, sig);
|
|
279
303
|
}
|
|
280
304
|
return sig;
|
|
@@ -296,7 +320,7 @@ class ProjectObjectRegistry {
|
|
|
296
320
|
}
|
|
297
321
|
const data = await this.client.apiRequest(method, {
|
|
298
322
|
snapshot: this.snapshotId,
|
|
299
|
-
project: this.
|
|
323
|
+
project: this.project.id,
|
|
300
324
|
objectId: source.id,
|
|
301
325
|
});
|
|
302
326
|
if (!data)
|
|
@@ -304,7 +328,7 @@ class ProjectObjectRegistry {
|
|
|
304
328
|
return this.getOrCreateType(data);
|
|
305
329
|
}
|
|
306
330
|
async fetchSymbol(source, method, handle) {
|
|
307
|
-
return this.snapshotRegistry.fetchSymbol(source, method, handle, this.
|
|
331
|
+
return this.snapshotRegistry.fetchSymbol(source, method, handle, this.project.id);
|
|
308
332
|
}
|
|
309
333
|
async fetchSignature(source, method, handle) {
|
|
310
334
|
if (!handle)
|
|
@@ -314,7 +338,7 @@ class ProjectObjectRegistry {
|
|
|
314
338
|
return cached;
|
|
315
339
|
const data = await this.client.apiRequest(method, {
|
|
316
340
|
snapshot: this.snapshotId,
|
|
317
|
-
project: this.
|
|
341
|
+
project: this.project.id,
|
|
318
342
|
objectId: source.id,
|
|
319
343
|
});
|
|
320
344
|
if (!data)
|
|
@@ -338,7 +362,7 @@ class ProjectObjectRegistry {
|
|
|
338
362
|
}
|
|
339
363
|
const typesData = await this.client.apiRequest(method, {
|
|
340
364
|
snapshot: this.snapshotId,
|
|
341
|
-
project: this.
|
|
365
|
+
project: this.project.id,
|
|
342
366
|
objectId: source.id,
|
|
343
367
|
});
|
|
344
368
|
if (typesData == null)
|
|
@@ -347,14 +371,14 @@ class ProjectObjectRegistry {
|
|
|
347
371
|
return typesData.map(data => this.getOrCreateType(data));
|
|
348
372
|
}
|
|
349
373
|
async fetchSymbols(source, method, handles) {
|
|
350
|
-
return this.snapshotRegistry.fetchSymbols(source, method, handles, this.
|
|
374
|
+
return this.snapshotRegistry.fetchSymbols(source, method, handles, this.project.id);
|
|
351
375
|
}
|
|
352
376
|
// getBaseTypes is a checker-level endpoint keyed by `type` (not `objectId`),
|
|
353
377
|
// so it cannot go through fetchTypes. This helper reuses that server method.
|
|
354
378
|
async fetchBaseTypes(source) {
|
|
355
379
|
const typesData = await this.client.apiRequest("getBaseTypes", {
|
|
356
380
|
snapshot: this.snapshotId,
|
|
357
|
-
project: this.
|
|
381
|
+
project: this.project.id,
|
|
358
382
|
type: source.id,
|
|
359
383
|
});
|
|
360
384
|
if (typesData == null)
|
|
@@ -377,9 +401,9 @@ export class Project {
|
|
|
377
401
|
this.compilerOptions = data.compilerOptions;
|
|
378
402
|
this.rootFiles = data.rootFiles;
|
|
379
403
|
this.client = client;
|
|
380
|
-
this.program = new Program(snapshotId, this
|
|
381
|
-
const objectRegistry = new ProjectObjectRegistry(client, snapshotId, this
|
|
382
|
-
this.checker = new Checker(snapshotId, this
|
|
404
|
+
this.program = new Program(snapshotId, this, client, sourceFileCache, toPath);
|
|
405
|
+
const objectRegistry = new ProjectObjectRegistry(client, snapshotId, this, snapshotRegistry);
|
|
406
|
+
this.checker = new Checker(snapshotId, this, client, objectRegistry);
|
|
383
407
|
this.emitter = new Emitter(client);
|
|
384
408
|
}
|
|
385
409
|
dispose() {
|
|
@@ -388,31 +412,34 @@ export class Project {
|
|
|
388
412
|
}
|
|
389
413
|
export class Program {
|
|
390
414
|
snapshotId;
|
|
391
|
-
|
|
415
|
+
project;
|
|
392
416
|
client;
|
|
393
417
|
sourceFileCache;
|
|
394
418
|
toPath;
|
|
395
419
|
decoder = new Wtf8Decoder();
|
|
396
420
|
sourceFileMetadataCache = new Map();
|
|
397
|
-
constructor(snapshotId,
|
|
421
|
+
constructor(snapshotId, project, client, sourceFileCache, toPath) {
|
|
398
422
|
this.snapshotId = snapshotId;
|
|
399
|
-
this.
|
|
423
|
+
this.project = project;
|
|
400
424
|
this.client = client;
|
|
401
425
|
this.sourceFileCache = sourceFileCache;
|
|
402
426
|
this.toPath = toPath;
|
|
403
427
|
}
|
|
428
|
+
getCompilerOptions() {
|
|
429
|
+
return this.project.compilerOptions;
|
|
430
|
+
}
|
|
404
431
|
async getSourceFile(file) {
|
|
405
432
|
const fileName = resolveFileName(file);
|
|
406
433
|
const path = this.toPath(fileName);
|
|
407
434
|
// Check if we already have a retained cache entry for this (snapshot, project) pair
|
|
408
|
-
const retained = this.sourceFileCache.getRetained(path, this.snapshotId, this.
|
|
435
|
+
const retained = this.sourceFileCache.getRetained(path, this.snapshotId, this.project.id);
|
|
409
436
|
if (retained) {
|
|
410
437
|
return retained;
|
|
411
438
|
}
|
|
412
439
|
// Fetch from server
|
|
413
440
|
const binaryData = await this.client.apiRequestBinary("getSourceFile", {
|
|
414
441
|
snapshot: this.snapshotId,
|
|
415
|
-
project: this.
|
|
442
|
+
project: this.project.id,
|
|
416
443
|
file,
|
|
417
444
|
});
|
|
418
445
|
if (!binaryData) {
|
|
@@ -422,13 +449,13 @@ export class Program {
|
|
|
422
449
|
const contentHash = readSourceFileHash(view);
|
|
423
450
|
const parseOptionsKey = readParseOptionsKey(view);
|
|
424
451
|
// Create a new RemoteSourceFile and cache it (set returns existing if hash matches)
|
|
425
|
-
const sourceFile = new RemoteSourceFile(binaryData, this.decoder);
|
|
426
|
-
return this.sourceFileCache.set(path, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.
|
|
452
|
+
const sourceFile = new RemoteSourceFile(binaryData, this.decoder, this.client.getTimingCollector());
|
|
453
|
+
return this.sourceFileCache.set(path, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.project.id);
|
|
427
454
|
}
|
|
428
455
|
async getSourceFileNames() {
|
|
429
456
|
const data = await this.client.apiRequest("getSourceFileNames", {
|
|
430
457
|
snapshot: this.snapshotId,
|
|
431
|
-
project: this.
|
|
458
|
+
project: this.project.id,
|
|
432
459
|
});
|
|
433
460
|
return data ?? [];
|
|
434
461
|
}
|
|
@@ -457,7 +484,7 @@ export class Program {
|
|
|
457
484
|
async fetchSourceFileMetadata(path) {
|
|
458
485
|
const data = await this.client.apiRequest("getSourceFileMetadata", {
|
|
459
486
|
snapshot: this.snapshotId,
|
|
460
|
-
project: this.
|
|
487
|
+
project: this.project.id,
|
|
461
488
|
file: path,
|
|
462
489
|
});
|
|
463
490
|
return data ?? undefined;
|
|
@@ -487,7 +514,7 @@ export class Program {
|
|
|
487
514
|
async getSyntacticDiagnostics(file) {
|
|
488
515
|
const data = await this.client.apiRequest("getSyntacticDiagnostics", {
|
|
489
516
|
snapshot: this.snapshotId,
|
|
490
|
-
project: this.
|
|
517
|
+
project: this.project.id,
|
|
491
518
|
...(file !== undefined ? { file } : {}),
|
|
492
519
|
});
|
|
493
520
|
return data ?? [];
|
|
@@ -499,7 +526,7 @@ export class Program {
|
|
|
499
526
|
async getBindDiagnostics(file) {
|
|
500
527
|
const data = await this.client.apiRequest("getBindDiagnostics", {
|
|
501
528
|
snapshot: this.snapshotId,
|
|
502
|
-
project: this.
|
|
529
|
+
project: this.project.id,
|
|
503
530
|
...(file !== undefined ? { file } : {}),
|
|
504
531
|
});
|
|
505
532
|
return data ?? [];
|
|
@@ -511,7 +538,7 @@ export class Program {
|
|
|
511
538
|
async getSemanticDiagnostics(file) {
|
|
512
539
|
const data = await this.client.apiRequest("getSemanticDiagnostics", {
|
|
513
540
|
snapshot: this.snapshotId,
|
|
514
|
-
project: this.
|
|
541
|
+
project: this.project.id,
|
|
515
542
|
...(file !== undefined ? { file } : {}),
|
|
516
543
|
});
|
|
517
544
|
return data ?? [];
|
|
@@ -523,7 +550,7 @@ export class Program {
|
|
|
523
550
|
async getSuggestionDiagnostics(file) {
|
|
524
551
|
const data = await this.client.apiRequest("getSuggestionDiagnostics", {
|
|
525
552
|
snapshot: this.snapshotId,
|
|
526
|
-
project: this.
|
|
553
|
+
project: this.project.id,
|
|
527
554
|
...(file !== undefined ? { file } : {}),
|
|
528
555
|
});
|
|
529
556
|
return data ?? [];
|
|
@@ -535,7 +562,7 @@ export class Program {
|
|
|
535
562
|
async getDeclarationDiagnostics(file) {
|
|
536
563
|
const data = await this.client.apiRequest("getDeclarationDiagnostics", {
|
|
537
564
|
snapshot: this.snapshotId,
|
|
538
|
-
project: this.
|
|
565
|
+
project: this.project.id,
|
|
539
566
|
...(file !== undefined ? { file } : {}),
|
|
540
567
|
});
|
|
541
568
|
return data ?? [];
|
|
@@ -546,7 +573,7 @@ export class Program {
|
|
|
546
573
|
async getProgramDiagnostics() {
|
|
547
574
|
const data = await this.client.apiRequest("getProgramDiagnostics", {
|
|
548
575
|
snapshot: this.snapshotId,
|
|
549
|
-
project: this.
|
|
576
|
+
project: this.project.id,
|
|
550
577
|
});
|
|
551
578
|
return data ?? [];
|
|
552
579
|
}
|
|
@@ -556,7 +583,7 @@ export class Program {
|
|
|
556
583
|
async getGlobalDiagnostics() {
|
|
557
584
|
const data = await this.client.apiRequest("getGlobalDiagnostics", {
|
|
558
585
|
snapshot: this.snapshotId,
|
|
559
|
-
project: this.
|
|
586
|
+
project: this.project.id,
|
|
560
587
|
});
|
|
561
588
|
return data ?? [];
|
|
562
589
|
}
|
|
@@ -566,20 +593,20 @@ export class Program {
|
|
|
566
593
|
async getConfigFileParsingDiagnostics() {
|
|
567
594
|
const data = await this.client.apiRequest("getConfigFileParsingDiagnostics", {
|
|
568
595
|
snapshot: this.snapshotId,
|
|
569
|
-
project: this.
|
|
596
|
+
project: this.project.id,
|
|
570
597
|
});
|
|
571
598
|
return data ?? [];
|
|
572
599
|
}
|
|
573
600
|
}
|
|
574
601
|
export class Checker {
|
|
575
602
|
snapshotId;
|
|
576
|
-
|
|
603
|
+
project;
|
|
577
604
|
client;
|
|
578
605
|
objectRegistry;
|
|
579
606
|
wellKnownSymbols;
|
|
580
|
-
constructor(snapshotId,
|
|
607
|
+
constructor(snapshotId, project, client, objectRegistry) {
|
|
581
608
|
this.snapshotId = snapshotId;
|
|
582
|
-
this.
|
|
609
|
+
this.project = project;
|
|
583
610
|
this.client = client;
|
|
584
611
|
this.objectRegistry = objectRegistry;
|
|
585
612
|
}
|
|
@@ -590,14 +617,14 @@ export class Checker {
|
|
|
590
617
|
if (Array.isArray(nodeOrNodes)) {
|
|
591
618
|
const data = await this.client.apiRequest("getSymbolsAtLocations", {
|
|
592
619
|
snapshot: this.snapshotId,
|
|
593
|
-
project: this.
|
|
620
|
+
project: this.project.id,
|
|
594
621
|
locations: nodeOrNodes.map(node => getNodeId(node)),
|
|
595
622
|
});
|
|
596
623
|
return data.map(d => d ? this.objectRegistry.getOrCreateSymbol(d) : undefined);
|
|
597
624
|
}
|
|
598
625
|
const data = await this.client.apiRequest("getSymbolAtLocation", {
|
|
599
626
|
snapshot: this.snapshotId,
|
|
600
|
-
project: this.
|
|
627
|
+
project: this.project.id,
|
|
601
628
|
location: getNodeId(nodeOrNodes),
|
|
602
629
|
});
|
|
603
630
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -606,7 +633,7 @@ export class Checker {
|
|
|
606
633
|
if (typeof positionOrPositions === "number") {
|
|
607
634
|
const data = await this.client.apiRequest("getSymbolAtPosition", {
|
|
608
635
|
snapshot: this.snapshotId,
|
|
609
|
-
project: this.
|
|
636
|
+
project: this.project.id,
|
|
610
637
|
file,
|
|
611
638
|
position: positionOrPositions,
|
|
612
639
|
});
|
|
@@ -614,7 +641,7 @@ export class Checker {
|
|
|
614
641
|
}
|
|
615
642
|
const data = await this.client.apiRequest("getSymbolsAtPositions", {
|
|
616
643
|
snapshot: this.snapshotId,
|
|
617
|
-
project: this.
|
|
644
|
+
project: this.project.id,
|
|
618
645
|
file,
|
|
619
646
|
positions: positionOrPositions,
|
|
620
647
|
});
|
|
@@ -624,14 +651,14 @@ export class Checker {
|
|
|
624
651
|
if (Array.isArray(symbolOrSymbols)) {
|
|
625
652
|
const data = await this.client.apiRequest("getTypesOfSymbols", {
|
|
626
653
|
snapshot: this.snapshotId,
|
|
627
|
-
project: this.
|
|
654
|
+
project: this.project.id,
|
|
628
655
|
symbols: symbolOrSymbols.map(s => s.id),
|
|
629
656
|
});
|
|
630
657
|
return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
|
|
631
658
|
}
|
|
632
659
|
const data = await this.client.apiRequest("getTypeOfSymbol", {
|
|
633
660
|
snapshot: this.snapshotId,
|
|
634
|
-
project: this.
|
|
661
|
+
project: this.project.id,
|
|
635
662
|
symbol: symbolOrSymbols.id,
|
|
636
663
|
});
|
|
637
664
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -644,7 +671,7 @@ export class Checker {
|
|
|
644
671
|
async getDeclaredTypeOfSymbol(symbol) {
|
|
645
672
|
const data = await this.client.apiRequest("getDeclaredTypeOfSymbol", {
|
|
646
673
|
snapshot: this.snapshotId,
|
|
647
|
-
project: this.
|
|
674
|
+
project: this.project.id,
|
|
648
675
|
symbol: symbol.id,
|
|
649
676
|
});
|
|
650
677
|
if (!data)
|
|
@@ -654,40 +681,40 @@ export class Checker {
|
|
|
654
681
|
async getReferencesToSymbolInFile(file, symbol) {
|
|
655
682
|
const data = await this.client.apiRequest("getReferencesToSymbolInFile", {
|
|
656
683
|
snapshot: this.snapshotId,
|
|
657
|
-
project: this.
|
|
684
|
+
project: this.project.id,
|
|
658
685
|
file,
|
|
659
686
|
symbol: symbol.id,
|
|
660
687
|
});
|
|
661
|
-
return (data ?? []).map(h => new NodeHandle(h));
|
|
688
|
+
return (data ?? []).map(h => new NodeHandle(h, this.project));
|
|
662
689
|
}
|
|
663
690
|
async getReferencedSymbolsForNode(node, position) {
|
|
664
691
|
const data = await this.client.apiRequest("getReferencedSymbolsForNode", {
|
|
665
692
|
snapshot: this.snapshotId,
|
|
666
|
-
project: this.
|
|
693
|
+
project: this.project.id,
|
|
667
694
|
node: getNodeId(node),
|
|
668
695
|
position,
|
|
669
696
|
});
|
|
670
697
|
return (data ?? []).map(entry => ({
|
|
671
|
-
definition: new NodeHandle(entry.definition),
|
|
698
|
+
definition: new NodeHandle(entry.definition, this.project),
|
|
672
699
|
symbol: entry.symbol ? this.objectRegistry.getOrCreateSymbol(entry.symbol) : undefined,
|
|
673
|
-
references: (entry.references ?? []).map(h => new NodeHandle(h)),
|
|
700
|
+
references: (entry.references ?? []).map(h => new NodeHandle(h, this.project)),
|
|
674
701
|
}));
|
|
675
702
|
}
|
|
676
703
|
async getSignatureUsage(signatureDecl) {
|
|
677
704
|
const data = await this.client.apiRequest("getSignatureUsages", {
|
|
678
705
|
snapshot: this.snapshotId,
|
|
679
|
-
project: this.
|
|
706
|
+
project: this.project.id,
|
|
680
707
|
signatureDecl: getNodeId(signatureDecl),
|
|
681
708
|
});
|
|
682
709
|
return (data ?? []).map(entry => ({
|
|
683
|
-
name: new NodeHandle(entry.name),
|
|
684
|
-
call: entry.call ? new NodeHandle(entry.call) : undefined,
|
|
710
|
+
name: new NodeHandle(entry.name, this.project),
|
|
711
|
+
call: entry.call ? new NodeHandle(entry.call, this.project) : undefined,
|
|
685
712
|
}));
|
|
686
713
|
}
|
|
687
714
|
async getCompletionsAtPosition(document, position, options) {
|
|
688
715
|
const data = await this.client.apiRequest("getCompletionsAtPosition", {
|
|
689
716
|
snapshot: this.snapshotId,
|
|
690
|
-
project: this.
|
|
717
|
+
project: this.project.id,
|
|
691
718
|
file: document,
|
|
692
719
|
position,
|
|
693
720
|
triggerCharacter: options?.triggerCharacter,
|
|
@@ -707,14 +734,14 @@ export class Checker {
|
|
|
707
734
|
if (Array.isArray(nodeOrNodes)) {
|
|
708
735
|
const data = await this.client.apiRequest("getTypeAtLocations", {
|
|
709
736
|
snapshot: this.snapshotId,
|
|
710
|
-
project: this.
|
|
737
|
+
project: this.project.id,
|
|
711
738
|
locations: nodeOrNodes.map(node => getNodeId(node)),
|
|
712
739
|
});
|
|
713
740
|
return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
|
|
714
741
|
}
|
|
715
742
|
const data = await this.client.apiRequest("getTypeAtLocation", {
|
|
716
743
|
snapshot: this.snapshotId,
|
|
717
|
-
project: this.
|
|
744
|
+
project: this.project.id,
|
|
718
745
|
location: getNodeId(nodeOrNodes),
|
|
719
746
|
});
|
|
720
747
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -722,7 +749,7 @@ export class Checker {
|
|
|
722
749
|
async getSignaturesOfType(type, kind) {
|
|
723
750
|
const data = await this.client.apiRequest("getSignaturesOfType", {
|
|
724
751
|
snapshot: this.snapshotId,
|
|
725
|
-
project: this.
|
|
752
|
+
project: this.project.id,
|
|
726
753
|
type: type.id,
|
|
727
754
|
kind,
|
|
728
755
|
});
|
|
@@ -731,7 +758,7 @@ export class Checker {
|
|
|
731
758
|
async getResolvedSignature(node) {
|
|
732
759
|
const data = await this.client.apiRequest("getResolvedSignature", {
|
|
733
760
|
snapshot: this.snapshotId,
|
|
734
|
-
project: this.
|
|
761
|
+
project: this.project.id,
|
|
735
762
|
location: getNodeId(node),
|
|
736
763
|
});
|
|
737
764
|
return data ? this.objectRegistry.getOrCreateSignature(data) : undefined;
|
|
@@ -740,7 +767,7 @@ export class Checker {
|
|
|
740
767
|
if (typeof positionOrPositions === "number") {
|
|
741
768
|
const data = await this.client.apiRequest("getTypeAtPosition", {
|
|
742
769
|
snapshot: this.snapshotId,
|
|
743
|
-
project: this.
|
|
770
|
+
project: this.project.id,
|
|
744
771
|
file,
|
|
745
772
|
position: positionOrPositions,
|
|
746
773
|
});
|
|
@@ -748,7 +775,7 @@ export class Checker {
|
|
|
748
775
|
}
|
|
749
776
|
const data = await this.client.apiRequest("getTypesAtPositions", {
|
|
750
777
|
snapshot: this.snapshotId,
|
|
751
|
-
project: this.
|
|
778
|
+
project: this.project.id,
|
|
752
779
|
file,
|
|
753
780
|
positions: positionOrPositions,
|
|
754
781
|
});
|
|
@@ -759,7 +786,7 @@ export class Checker {
|
|
|
759
786
|
const isNode = location && "kind" in location;
|
|
760
787
|
const data = await this.client.apiRequest("resolveName", {
|
|
761
788
|
snapshot: this.snapshotId,
|
|
762
|
-
project: this.
|
|
789
|
+
project: this.project.id,
|
|
763
790
|
name,
|
|
764
791
|
meaning,
|
|
765
792
|
location: isNode ? getNodeId(location) : undefined,
|
|
@@ -778,7 +805,7 @@ export class Checker {
|
|
|
778
805
|
async getContextualType(node) {
|
|
779
806
|
const data = await this.client.apiRequest("getContextualType", {
|
|
780
807
|
snapshot: this.snapshotId,
|
|
781
|
-
project: this.
|
|
808
|
+
project: this.project.id,
|
|
782
809
|
location: getNodeId(node),
|
|
783
810
|
});
|
|
784
811
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -786,7 +813,7 @@ export class Checker {
|
|
|
786
813
|
async getBaseTypeOfLiteralType(type) {
|
|
787
814
|
const data = await this.client.apiRequest("getBaseTypeOfLiteralType", {
|
|
788
815
|
snapshot: this.snapshotId,
|
|
789
|
-
project: this.
|
|
816
|
+
project: this.project.id,
|
|
790
817
|
type: type.id,
|
|
791
818
|
});
|
|
792
819
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -794,7 +821,7 @@ export class Checker {
|
|
|
794
821
|
async getNonNullableType(type) {
|
|
795
822
|
const data = await this.client.apiRequest("getNonNullableType", {
|
|
796
823
|
snapshot: this.snapshotId,
|
|
797
|
-
project: this.
|
|
824
|
+
project: this.project.id,
|
|
798
825
|
type: type.id,
|
|
799
826
|
});
|
|
800
827
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -802,7 +829,7 @@ export class Checker {
|
|
|
802
829
|
async getTypeFromTypeNode(node) {
|
|
803
830
|
const data = await this.client.apiRequest("getTypeFromTypeNode", {
|
|
804
831
|
snapshot: this.snapshotId,
|
|
805
|
-
project: this.
|
|
832
|
+
project: this.project.id,
|
|
806
833
|
location: getNodeId(node),
|
|
807
834
|
});
|
|
808
835
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -810,7 +837,7 @@ export class Checker {
|
|
|
810
837
|
async getWidenedType(type) {
|
|
811
838
|
const data = await this.client.apiRequest("getWidenedType", {
|
|
812
839
|
snapshot: this.snapshotId,
|
|
813
|
-
project: this.
|
|
840
|
+
project: this.project.id,
|
|
814
841
|
type: type.id,
|
|
815
842
|
});
|
|
816
843
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -818,7 +845,7 @@ export class Checker {
|
|
|
818
845
|
async getParameterType(signature, index) {
|
|
819
846
|
const data = await this.client.apiRequest("getParameterType", {
|
|
820
847
|
snapshot: this.snapshotId,
|
|
821
|
-
project: this.
|
|
848
|
+
project: this.project.id,
|
|
822
849
|
signature: signature.id,
|
|
823
850
|
index,
|
|
824
851
|
});
|
|
@@ -827,14 +854,14 @@ export class Checker {
|
|
|
827
854
|
async isArrayLikeType(type) {
|
|
828
855
|
return this.client.apiRequest("isArrayLikeType", {
|
|
829
856
|
snapshot: this.snapshotId,
|
|
830
|
-
project: this.
|
|
857
|
+
project: this.project.id,
|
|
831
858
|
type: type.id,
|
|
832
859
|
});
|
|
833
860
|
}
|
|
834
861
|
async isTypeAssignableTo(source, target) {
|
|
835
862
|
return this.client.apiRequest("isTypeAssignableTo", {
|
|
836
863
|
snapshot: this.snapshotId,
|
|
837
|
-
project: this.
|
|
864
|
+
project: this.project.id,
|
|
838
865
|
source: source.id,
|
|
839
866
|
target: target.id,
|
|
840
867
|
});
|
|
@@ -842,7 +869,7 @@ export class Checker {
|
|
|
842
869
|
async getShorthandAssignmentValueSymbol(node) {
|
|
843
870
|
const data = await this.client.apiRequest("getShorthandAssignmentValueSymbol", {
|
|
844
871
|
snapshot: this.snapshotId,
|
|
845
|
-
project: this.
|
|
872
|
+
project: this.project.id,
|
|
846
873
|
location: getNodeId(node),
|
|
847
874
|
});
|
|
848
875
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -855,7 +882,7 @@ export class Checker {
|
|
|
855
882
|
async getTypeOfSymbolAtLocation(symbol, location) {
|
|
856
883
|
const data = await this.client.apiRequest("getTypeOfSymbolAtLocation", {
|
|
857
884
|
snapshot: this.snapshotId,
|
|
858
|
-
project: this.
|
|
885
|
+
project: this.project.id,
|
|
859
886
|
symbol: symbol.id,
|
|
860
887
|
location: getNodeId(location),
|
|
861
888
|
});
|
|
@@ -866,7 +893,7 @@ export class Checker {
|
|
|
866
893
|
async getIntrinsicType(method) {
|
|
867
894
|
const data = await this.client.apiRequest(method, {
|
|
868
895
|
snapshot: this.snapshotId,
|
|
869
|
-
project: this.
|
|
896
|
+
project: this.project.id,
|
|
870
897
|
});
|
|
871
898
|
return this.objectRegistry.getOrCreateType(data);
|
|
872
899
|
}
|
|
@@ -906,7 +933,7 @@ export class Checker {
|
|
|
906
933
|
async typeToTypeNode(type, enclosingDeclaration, flags) {
|
|
907
934
|
const binaryData = await this.client.apiRequestBinary("typeToTypeNode", {
|
|
908
935
|
snapshot: this.snapshotId,
|
|
909
|
-
project: this.
|
|
936
|
+
project: this.project.id,
|
|
910
937
|
type: type.id,
|
|
911
938
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
912
939
|
flags,
|
|
@@ -918,7 +945,7 @@ export class Checker {
|
|
|
918
945
|
async signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags) {
|
|
919
946
|
const binaryData = await this.client.apiRequestBinary("signatureToSignatureDeclaration", {
|
|
920
947
|
snapshot: this.snapshotId,
|
|
921
|
-
project: this.
|
|
948
|
+
project: this.project.id,
|
|
922
949
|
signature: signature.id,
|
|
923
950
|
kind,
|
|
924
951
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
@@ -931,7 +958,7 @@ export class Checker {
|
|
|
931
958
|
async typeToString(type, enclosingDeclaration, flags) {
|
|
932
959
|
return this.client.apiRequest("typeToString", {
|
|
933
960
|
snapshot: this.snapshotId,
|
|
934
|
-
project: this.
|
|
961
|
+
project: this.project.id,
|
|
935
962
|
type: type.id,
|
|
936
963
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
937
964
|
flags,
|
|
@@ -940,28 +967,28 @@ export class Checker {
|
|
|
940
967
|
async isContextSensitive(node) {
|
|
941
968
|
return this.client.apiRequest("isContextSensitive", {
|
|
942
969
|
snapshot: this.snapshotId,
|
|
943
|
-
project: this.
|
|
970
|
+
project: this.project.id,
|
|
944
971
|
location: getNodeId(node),
|
|
945
972
|
});
|
|
946
973
|
}
|
|
947
974
|
async isArrayType(type) {
|
|
948
975
|
return this.client.apiRequest("isArrayType", {
|
|
949
976
|
snapshot: this.snapshotId,
|
|
950
|
-
project: this.
|
|
977
|
+
project: this.project.id,
|
|
951
978
|
type: type.id,
|
|
952
979
|
});
|
|
953
980
|
}
|
|
954
981
|
async isTupleType(type) {
|
|
955
982
|
return this.client.apiRequest("isTupleType", {
|
|
956
983
|
snapshot: this.snapshotId,
|
|
957
|
-
project: this.
|
|
984
|
+
project: this.project.id,
|
|
958
985
|
type: type.id,
|
|
959
986
|
});
|
|
960
987
|
}
|
|
961
988
|
async getReturnTypeOfSignature(signature) {
|
|
962
989
|
const data = await this.client.apiRequest("getReturnTypeOfSignature", {
|
|
963
990
|
snapshot: this.snapshotId,
|
|
964
|
-
project: this.
|
|
991
|
+
project: this.project.id,
|
|
965
992
|
signature: signature.id,
|
|
966
993
|
});
|
|
967
994
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -969,7 +996,7 @@ export class Checker {
|
|
|
969
996
|
async getRestTypeOfSignature(signature) {
|
|
970
997
|
const data = await this.client.apiRequest("getRestTypeOfSignature", {
|
|
971
998
|
snapshot: this.snapshotId,
|
|
972
|
-
project: this.
|
|
999
|
+
project: this.project.id,
|
|
973
1000
|
signature: signature.id,
|
|
974
1001
|
});
|
|
975
1002
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -977,7 +1004,7 @@ export class Checker {
|
|
|
977
1004
|
async getTypePredicateOfSignature(signature) {
|
|
978
1005
|
const data = await this.client.apiRequest("getTypePredicateOfSignature", {
|
|
979
1006
|
snapshot: this.snapshotId,
|
|
980
|
-
project: this.
|
|
1007
|
+
project: this.project.id,
|
|
981
1008
|
signature: signature.id,
|
|
982
1009
|
});
|
|
983
1010
|
if (!data)
|
|
@@ -996,7 +1023,7 @@ export class Checker {
|
|
|
996
1023
|
async getBaseTypes(type) {
|
|
997
1024
|
const data = await this.client.apiRequest("getBaseTypes", {
|
|
998
1025
|
snapshot: this.snapshotId,
|
|
999
|
-
project: this.
|
|
1026
|
+
project: this.project.id,
|
|
1000
1027
|
type: type.id,
|
|
1001
1028
|
});
|
|
1002
1029
|
return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
|
|
@@ -1004,7 +1031,7 @@ export class Checker {
|
|
|
1004
1031
|
async getApparentType(type) {
|
|
1005
1032
|
const data = await this.client.apiRequest("getApparentType", {
|
|
1006
1033
|
snapshot: this.snapshotId,
|
|
1007
|
-
project: this.
|
|
1034
|
+
project: this.project.id,
|
|
1008
1035
|
type: type.id,
|
|
1009
1036
|
});
|
|
1010
1037
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1012,7 +1039,7 @@ export class Checker {
|
|
|
1012
1039
|
async getPropertiesOfType(type) {
|
|
1013
1040
|
const data = await this.client.apiRequest("getPropertiesOfType", {
|
|
1014
1041
|
snapshot: this.snapshotId,
|
|
1015
|
-
project: this.
|
|
1042
|
+
project: this.project.id,
|
|
1016
1043
|
type: type.id,
|
|
1017
1044
|
});
|
|
1018
1045
|
return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
@@ -1020,7 +1047,7 @@ export class Checker {
|
|
|
1020
1047
|
async getIndexInfosOfType(type) {
|
|
1021
1048
|
const data = await this.client.apiRequest("getIndexInfosOfType", {
|
|
1022
1049
|
snapshot: this.snapshotId,
|
|
1023
|
-
project: this.
|
|
1050
|
+
project: this.project.id,
|
|
1024
1051
|
type: type.id,
|
|
1025
1052
|
});
|
|
1026
1053
|
if (!data)
|
|
@@ -1029,7 +1056,7 @@ export class Checker {
|
|
|
1029
1056
|
keyType: this.objectRegistry.getOrCreateType(d.keyType),
|
|
1030
1057
|
valueType: this.objectRegistry.getOrCreateType(d.valueType),
|
|
1031
1058
|
isReadonly: d.isReadonly ?? false,
|
|
1032
|
-
declaration: d.declaration ? new NodeHandle(d.declaration) : undefined,
|
|
1059
|
+
declaration: d.declaration ? new NodeHandle(d.declaration, this.project) : undefined,
|
|
1033
1060
|
}));
|
|
1034
1061
|
}
|
|
1035
1062
|
/**
|
|
@@ -1039,7 +1066,7 @@ export class Checker {
|
|
|
1039
1066
|
async getConstraintOfTypeParameter(type) {
|
|
1040
1067
|
const data = await this.client.apiRequest("getConstraintOfTypeParameter", {
|
|
1041
1068
|
snapshot: this.snapshotId,
|
|
1042
|
-
project: this.
|
|
1069
|
+
project: this.project.id,
|
|
1043
1070
|
type: type.id,
|
|
1044
1071
|
});
|
|
1045
1072
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1047,7 +1074,7 @@ export class Checker {
|
|
|
1047
1074
|
async getBaseConstraintOfType(type) {
|
|
1048
1075
|
const data = await this.client.apiRequest("getBaseConstraintOfType", {
|
|
1049
1076
|
snapshot: this.snapshotId,
|
|
1050
|
-
project: this.
|
|
1077
|
+
project: this.project.id,
|
|
1051
1078
|
type: type.id,
|
|
1052
1079
|
});
|
|
1053
1080
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1055,7 +1082,7 @@ export class Checker {
|
|
|
1055
1082
|
async getPropertyOfType(type, name) {
|
|
1056
1083
|
const data = await this.client.apiRequest("getPropertyOfType", {
|
|
1057
1084
|
snapshot: this.snapshotId,
|
|
1058
|
-
project: this.
|
|
1085
|
+
project: this.project.id,
|
|
1059
1086
|
type: type.id,
|
|
1060
1087
|
name,
|
|
1061
1088
|
});
|
|
@@ -1064,7 +1091,7 @@ export class Checker {
|
|
|
1064
1091
|
async getConstantValue(node) {
|
|
1065
1092
|
const data = await this.client.apiRequest("getConstantValue", {
|
|
1066
1093
|
snapshot: this.snapshotId,
|
|
1067
|
-
project: this.
|
|
1094
|
+
project: this.project.id,
|
|
1068
1095
|
location: getNodeId(node),
|
|
1069
1096
|
});
|
|
1070
1097
|
return data ?? undefined;
|
|
@@ -1072,7 +1099,7 @@ export class Checker {
|
|
|
1072
1099
|
async getSignatureFromDeclaration(node) {
|
|
1073
1100
|
const data = await this.client.apiRequest("getSignatureFromDeclaration", {
|
|
1074
1101
|
snapshot: this.snapshotId,
|
|
1075
|
-
project: this.
|
|
1102
|
+
project: this.project.id,
|
|
1076
1103
|
location: getNodeId(node),
|
|
1077
1104
|
});
|
|
1078
1105
|
return data ? this.objectRegistry.getOrCreateSignature(data) : undefined;
|
|
@@ -1080,7 +1107,7 @@ export class Checker {
|
|
|
1080
1107
|
async getExportSpecifierLocalTargetSymbol(node) {
|
|
1081
1108
|
const data = await this.client.apiRequest("getExportSpecifierLocalTargetSymbol", {
|
|
1082
1109
|
snapshot: this.snapshotId,
|
|
1083
|
-
project: this.
|
|
1110
|
+
project: this.project.id,
|
|
1084
1111
|
location: getNodeId(node),
|
|
1085
1112
|
});
|
|
1086
1113
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -1093,7 +1120,7 @@ export class Checker {
|
|
|
1093
1120
|
async getAliasedSymbol(symbol) {
|
|
1094
1121
|
const data = await this.client.apiRequest("getAliasedSymbol", {
|
|
1095
1122
|
snapshot: this.snapshotId,
|
|
1096
|
-
project: this.
|
|
1123
|
+
project: this.project.id,
|
|
1097
1124
|
symbol: symbol.id,
|
|
1098
1125
|
});
|
|
1099
1126
|
if (!data)
|
|
@@ -1103,7 +1130,7 @@ export class Checker {
|
|
|
1103
1130
|
async getImmediateAliasedSymbol(symbol) {
|
|
1104
1131
|
const data = await this.client.apiRequest("getImmediateAliasedSymbol", {
|
|
1105
1132
|
snapshot: this.snapshotId,
|
|
1106
|
-
project: this.
|
|
1133
|
+
project: this.project.id,
|
|
1107
1134
|
symbol: symbol.id,
|
|
1108
1135
|
});
|
|
1109
1136
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -1117,7 +1144,7 @@ export class Checker {
|
|
|
1117
1144
|
getWellKnownSymbols() {
|
|
1118
1145
|
return this.wellKnownSymbols ??= this.client.apiRequest("getWellKnownSymbols", {
|
|
1119
1146
|
snapshot: this.snapshotId,
|
|
1120
|
-
project: this.
|
|
1147
|
+
project: this.project.id,
|
|
1121
1148
|
});
|
|
1122
1149
|
}
|
|
1123
1150
|
/**
|
|
@@ -1142,7 +1169,7 @@ export class Checker {
|
|
|
1142
1169
|
async getExportsOfModule(symbol) {
|
|
1143
1170
|
const data = await this.client.apiRequest("getExportsOfModule", {
|
|
1144
1171
|
snapshot: this.snapshotId,
|
|
1145
|
-
project: this.
|
|
1172
|
+
project: this.project.id,
|
|
1146
1173
|
symbol: symbol.id,
|
|
1147
1174
|
});
|
|
1148
1175
|
return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
@@ -1150,7 +1177,7 @@ export class Checker {
|
|
|
1150
1177
|
async getMemberInModuleExports(symbol, name) {
|
|
1151
1178
|
const data = await this.client.apiRequest("getMemberInModuleExports", {
|
|
1152
1179
|
snapshot: this.snapshotId,
|
|
1153
|
-
project: this.
|
|
1180
|
+
project: this.project.id,
|
|
1154
1181
|
symbol: symbol.id,
|
|
1155
1182
|
name,
|
|
1156
1183
|
});
|
|
@@ -1159,7 +1186,7 @@ export class Checker {
|
|
|
1159
1186
|
async getJsDocTagsOfSymbol(symbol) {
|
|
1160
1187
|
const data = await this.client.apiRequest("getJsDocTags", {
|
|
1161
1188
|
snapshot: this.snapshotId,
|
|
1162
|
-
project: this.
|
|
1189
|
+
project: this.project.id,
|
|
1163
1190
|
symbol: symbol.id,
|
|
1164
1191
|
});
|
|
1165
1192
|
return data ?? [];
|
|
@@ -1167,7 +1194,7 @@ export class Checker {
|
|
|
1167
1194
|
async getDocumentationCommentOfSymbol(symbol) {
|
|
1168
1195
|
return this.client.apiRequest("getDocumentationComment", {
|
|
1169
1196
|
snapshot: this.snapshotId,
|
|
1170
|
-
project: this.
|
|
1197
|
+
project: this.project.id,
|
|
1171
1198
|
symbol: symbol.id,
|
|
1172
1199
|
});
|
|
1173
1200
|
}
|
|
@@ -1177,7 +1204,7 @@ export class Checker {
|
|
|
1177
1204
|
async getTypeArguments(type) {
|
|
1178
1205
|
const data = await this.client.apiRequest("getTypeArguments", {
|
|
1179
1206
|
snapshot: this.snapshotId,
|
|
1180
|
-
project: this.
|
|
1207
|
+
project: this.project.id,
|
|
1181
1208
|
type: type.id,
|
|
1182
1209
|
});
|
|
1183
1210
|
return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
|
|
@@ -1198,20 +1225,28 @@ export class Emitter {
|
|
|
1198
1225
|
}
|
|
1199
1226
|
}
|
|
1200
1227
|
export class NodeHandle {
|
|
1228
|
+
/**
|
|
1229
|
+
* The project this handle was produced in, used as the default for {@link resolve}.
|
|
1230
|
+
* Node handles are only meaningful within a project's program, so the producing project
|
|
1231
|
+
* is remembered so callers don't have to pass it explicitly.
|
|
1232
|
+
*/
|
|
1233
|
+
canonicalProject;
|
|
1201
1234
|
index;
|
|
1202
1235
|
kind;
|
|
1203
1236
|
path;
|
|
1204
|
-
constructor(handle) {
|
|
1237
|
+
constructor(handle, canonicalProject) {
|
|
1205
1238
|
const parsed = parseNodeHandle(handle);
|
|
1206
1239
|
this.index = parsed.index;
|
|
1207
1240
|
this.kind = parsed.kind;
|
|
1208
1241
|
this.path = parsed.path;
|
|
1242
|
+
this.canonicalProject = canonicalProject;
|
|
1209
1243
|
}
|
|
1210
1244
|
/**
|
|
1211
|
-
* Resolve this handle to the actual AST node by fetching the source file
|
|
1212
|
-
*
|
|
1245
|
+
* Resolve this handle to the actual AST node by fetching the source file from a project
|
|
1246
|
+
* and looking up the node by index. If no project is passed, the project that produced
|
|
1247
|
+
* the handle is used.
|
|
1213
1248
|
*/
|
|
1214
|
-
async resolve(project) {
|
|
1249
|
+
async resolve(project = this.canonicalProject) {
|
|
1215
1250
|
const sourceFile = await project.program.getSourceFile(this.path);
|
|
1216
1251
|
if (!sourceFile) {
|
|
1217
1252
|
return undefined;
|
|
@@ -1221,6 +1256,12 @@ export class NodeHandle {
|
|
|
1221
1256
|
}
|
|
1222
1257
|
export class Symbol {
|
|
1223
1258
|
objectRegistry;
|
|
1259
|
+
/**
|
|
1260
|
+
* The project this symbol was first observed in, used as the default project for
|
|
1261
|
+
* lookups that need a project context (members/exports/parent). Symbols are shared
|
|
1262
|
+
* snapshot-wide, so these lookups can otherwise be ambiguous about which project to use.
|
|
1263
|
+
*/
|
|
1264
|
+
canonicalProject;
|
|
1224
1265
|
id;
|
|
1225
1266
|
/** The escaped (`__String`) name, used as the key in member/export tables. */
|
|
1226
1267
|
escapedName;
|
|
@@ -1241,15 +1282,20 @@ export class Symbol {
|
|
|
1241
1282
|
this.name = unescapeLeadingUnderscores(data.name);
|
|
1242
1283
|
this.flags = data.flags;
|
|
1243
1284
|
this.checkFlags = data.checkFlags;
|
|
1244
|
-
|
|
1245
|
-
|
|
1285
|
+
const canonicalProject = objectRegistry.getProject(data.project);
|
|
1286
|
+
if (!canonicalProject) {
|
|
1287
|
+
throw new Error(`Symbol ${data.id} references unknown canonical project '${data.project}'`);
|
|
1288
|
+
}
|
|
1289
|
+
this.canonicalProject = canonicalProject;
|
|
1290
|
+
this.declarations = (data.declarations ?? []).map(d => new NodeHandle(d, canonicalProject));
|
|
1291
|
+
this.valueDeclaration = data.valueDeclaration ? new NodeHandle(data.valueDeclaration, canonicalProject) : undefined;
|
|
1246
1292
|
if (data.parent !== undefined)
|
|
1247
1293
|
this.parent = data.parent;
|
|
1248
1294
|
if (data.exportSymbol !== undefined)
|
|
1249
1295
|
this.exportSymbol = data.exportSymbol;
|
|
1250
1296
|
}
|
|
1251
1297
|
async getParent() {
|
|
1252
|
-
return this.objectRegistry.fetchSymbol(this, "getParentOfSymbol", this.parent);
|
|
1298
|
+
return this.objectRegistry.fetchSymbol(this, "getParentOfSymbol", this.parent, this.canonicalProject.id);
|
|
1253
1299
|
}
|
|
1254
1300
|
/**
|
|
1255
1301
|
* Get this symbol's members keyed by escaped name. The result is cached on
|
|
@@ -1266,7 +1312,7 @@ export class Symbol {
|
|
|
1266
1312
|
return this.exportsCache ??= this.fetchSymbolTable("getExportsOfSymbol");
|
|
1267
1313
|
}
|
|
1268
1314
|
async fetchSymbolTable(method) {
|
|
1269
|
-
const symbols = await this.objectRegistry.fetchSymbols(this, method);
|
|
1315
|
+
const symbols = await this.objectRegistry.fetchSymbols(this, method, undefined, this.canonicalProject.id);
|
|
1270
1316
|
const table = new Map();
|
|
1271
1317
|
for (const symbol of symbols) {
|
|
1272
1318
|
table.set(symbol.escapedName, symbol);
|
|
@@ -1276,7 +1322,7 @@ export class Symbol {
|
|
|
1276
1322
|
async getExportSymbol() {
|
|
1277
1323
|
if (!this.exportSymbol)
|
|
1278
1324
|
return this;
|
|
1279
|
-
return this.objectRegistry.fetchSymbol(this, "getExportSymbolOfSymbol", this.exportSymbol);
|
|
1325
|
+
return this.objectRegistry.fetchSymbol(this, "getExportSymbolOfSymbol", this.exportSymbol, this.canonicalProject.id);
|
|
1280
1326
|
}
|
|
1281
1327
|
async getJsDocTags(checker) {
|
|
1282
1328
|
return checker.getJsDocTagsOfSymbol(this);
|
|
@@ -1576,11 +1622,11 @@ export class Signature {
|
|
|
1576
1622
|
parameters;
|
|
1577
1623
|
thisParameter;
|
|
1578
1624
|
target;
|
|
1579
|
-
constructor(data, objectRegistry) {
|
|
1625
|
+
constructor(data, project, objectRegistry) {
|
|
1580
1626
|
this.id = data.id;
|
|
1581
1627
|
this.flags = data.flags;
|
|
1582
1628
|
this.objectRegistry = objectRegistry;
|
|
1583
|
-
this.declaration = data.declaration ? new NodeHandle(data.declaration) : undefined;
|
|
1629
|
+
this.declaration = data.declaration ? new NodeHandle(data.declaration, project) : undefined;
|
|
1584
1630
|
this.typeParameters = data.typeParameters ?? [];
|
|
1585
1631
|
this.parameters = data.parameters ?? [];
|
|
1586
1632
|
this.thisParameter = data.thisParameter;
|