@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/sync/api.js
CHANGED
|
@@ -26,8 +26,8 @@ import { createGetCanonicalFileName, toPath, } from "../path.js";
|
|
|
26
26
|
import { resolveFileName, toUpdateSnapshotRequest, } from "../proto.js";
|
|
27
27
|
import { SourceFileCache } from "../sourceFileCache.js";
|
|
28
28
|
import { Client, } from "./client.js";
|
|
29
|
-
export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, ModuleKind, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
|
|
30
29
|
export { documentURIToFileName, fileNameToDocumentURI } from "../path.js";
|
|
30
|
+
export { CompletionItemKind, DiagnosticCategory, ElementFlags, ModifierFlags, ModuleKind, NodeBuilderFlags, ObjectFlags, SignatureFlags, SignatureKind, SymbolFlags, TypeFlags, TypePredicateKind };
|
|
31
31
|
export class API {
|
|
32
32
|
client;
|
|
33
33
|
sourceFileCache;
|
|
@@ -100,6 +100,24 @@ export class API {
|
|
|
100
100
|
clearSourceFileCache() {
|
|
101
101
|
this.sourceFileCache.clear();
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Returns a snapshot of collected timing information for requests made
|
|
105
|
+
* through this API instance: client-measured round-trip latency and bytes
|
|
106
|
+
* transferred, folded together with the server's own per-request processing
|
|
107
|
+
* time and an estimated transport overhead (round-trip minus server time).
|
|
108
|
+
*
|
|
109
|
+
* Fetching the snapshot issues a lightweight request to the server to
|
|
110
|
+
* retrieve its timing collection. Collection must be enabled via the
|
|
111
|
+
* `collectTiming` option; when it is not, the returned snapshot has
|
|
112
|
+
* `enabled: false` and zeroed totals.
|
|
113
|
+
*/
|
|
114
|
+
getTimingInfo() {
|
|
115
|
+
return this.client.getTimingInfo();
|
|
116
|
+
}
|
|
117
|
+
/** Clears all accumulated timing totals and recent-request history, on both the client and the server. */
|
|
118
|
+
resetTimingInfo() {
|
|
119
|
+
return this.client.resetTimingInfo();
|
|
120
|
+
}
|
|
103
121
|
}
|
|
104
122
|
export class InternalAPI {
|
|
105
123
|
client;
|
|
@@ -137,8 +155,8 @@ export class Snapshot {
|
|
|
137
155
|
this.client = client;
|
|
138
156
|
this.toPath = toPath;
|
|
139
157
|
this.onDispose = onDispose;
|
|
140
|
-
this.snapshotRegistry = new SnapshotObjectRegistry(client, this.id);
|
|
141
158
|
this.projectMap = new Map();
|
|
159
|
+
this.snapshotRegistry = new SnapshotObjectRegistry(client, this.id, projectId => this.projectMap.get(projectId));
|
|
142
160
|
for (const projData of data.projects) {
|
|
143
161
|
const project = new Project(projData, this.id, client, sourceFileCache, toPath, this.snapshotRegistry);
|
|
144
162
|
this.projectMap.set(toPath(projData.configFileName), project);
|
|
@@ -190,9 +208,15 @@ class SnapshotObjectRegistry {
|
|
|
190
208
|
symbols = new Map();
|
|
191
209
|
client;
|
|
192
210
|
snapshotId;
|
|
193
|
-
|
|
211
|
+
resolveProject;
|
|
212
|
+
constructor(client, snapshotId, resolveProject) {
|
|
194
213
|
this.client = client;
|
|
195
214
|
this.snapshotId = snapshotId;
|
|
215
|
+
this.resolveProject = resolveProject;
|
|
216
|
+
}
|
|
217
|
+
/** Resolve a project id (a config file path) to its Project within this snapshot. */
|
|
218
|
+
getProject(projectId) {
|
|
219
|
+
return this.resolveProject(projectId);
|
|
196
220
|
}
|
|
197
221
|
getOrCreateSymbol(data) {
|
|
198
222
|
let symbol = this.symbols.get(data.id);
|
|
@@ -252,14 +276,14 @@ class SnapshotObjectRegistry {
|
|
|
252
276
|
class ProjectObjectRegistry {
|
|
253
277
|
client;
|
|
254
278
|
snapshotId;
|
|
255
|
-
|
|
279
|
+
project;
|
|
256
280
|
snapshotRegistry;
|
|
257
281
|
types = new Map();
|
|
258
282
|
signatures = new Map();
|
|
259
|
-
constructor(client, snapshotId,
|
|
283
|
+
constructor(client, snapshotId, project, snapshotRegistry) {
|
|
260
284
|
this.client = client;
|
|
261
285
|
this.snapshotId = snapshotId;
|
|
262
|
-
this.
|
|
286
|
+
this.project = project;
|
|
263
287
|
this.snapshotRegistry = snapshotRegistry;
|
|
264
288
|
}
|
|
265
289
|
getOrCreateSymbol(data) {
|
|
@@ -282,7 +306,7 @@ class ProjectObjectRegistry {
|
|
|
282
306
|
getOrCreateSignature(data) {
|
|
283
307
|
let sig = this.signatures.get(data.id);
|
|
284
308
|
if (!sig) {
|
|
285
|
-
sig = new Signature(data, this);
|
|
309
|
+
sig = new Signature(data, this.project, this);
|
|
286
310
|
this.signatures.set(data.id, sig);
|
|
287
311
|
}
|
|
288
312
|
return sig;
|
|
@@ -304,7 +328,7 @@ class ProjectObjectRegistry {
|
|
|
304
328
|
}
|
|
305
329
|
const data = this.client.apiRequest(method, {
|
|
306
330
|
snapshot: this.snapshotId,
|
|
307
|
-
project: this.
|
|
331
|
+
project: this.project.id,
|
|
308
332
|
objectId: source.id,
|
|
309
333
|
});
|
|
310
334
|
if (!data)
|
|
@@ -312,7 +336,7 @@ class ProjectObjectRegistry {
|
|
|
312
336
|
return this.getOrCreateType(data);
|
|
313
337
|
}
|
|
314
338
|
fetchSymbol(source, method, handle) {
|
|
315
|
-
return this.snapshotRegistry.fetchSymbol(source, method, handle, this.
|
|
339
|
+
return this.snapshotRegistry.fetchSymbol(source, method, handle, this.project.id);
|
|
316
340
|
}
|
|
317
341
|
fetchSignature(source, method, handle) {
|
|
318
342
|
if (!handle)
|
|
@@ -322,7 +346,7 @@ class ProjectObjectRegistry {
|
|
|
322
346
|
return cached;
|
|
323
347
|
const data = this.client.apiRequest(method, {
|
|
324
348
|
snapshot: this.snapshotId,
|
|
325
|
-
project: this.
|
|
349
|
+
project: this.project.id,
|
|
326
350
|
objectId: source.id,
|
|
327
351
|
});
|
|
328
352
|
if (!data)
|
|
@@ -346,7 +370,7 @@ class ProjectObjectRegistry {
|
|
|
346
370
|
}
|
|
347
371
|
const typesData = this.client.apiRequest(method, {
|
|
348
372
|
snapshot: this.snapshotId,
|
|
349
|
-
project: this.
|
|
373
|
+
project: this.project.id,
|
|
350
374
|
objectId: source.id,
|
|
351
375
|
});
|
|
352
376
|
if (typesData == null)
|
|
@@ -355,14 +379,14 @@ class ProjectObjectRegistry {
|
|
|
355
379
|
return typesData.map(data => this.getOrCreateType(data));
|
|
356
380
|
}
|
|
357
381
|
fetchSymbols(source, method, handles) {
|
|
358
|
-
return this.snapshotRegistry.fetchSymbols(source, method, handles, this.
|
|
382
|
+
return this.snapshotRegistry.fetchSymbols(source, method, handles, this.project.id);
|
|
359
383
|
}
|
|
360
384
|
// getBaseTypes is a checker-level endpoint keyed by `type` (not `objectId`),
|
|
361
385
|
// so it cannot go through fetchTypes. This helper reuses that server method.
|
|
362
386
|
fetchBaseTypes(source) {
|
|
363
387
|
const typesData = this.client.apiRequest("getBaseTypes", {
|
|
364
388
|
snapshot: this.snapshotId,
|
|
365
|
-
project: this.
|
|
389
|
+
project: this.project.id,
|
|
366
390
|
type: source.id,
|
|
367
391
|
});
|
|
368
392
|
if (typesData == null)
|
|
@@ -385,9 +409,9 @@ export class Project {
|
|
|
385
409
|
this.compilerOptions = data.compilerOptions;
|
|
386
410
|
this.rootFiles = data.rootFiles;
|
|
387
411
|
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
|
|
412
|
+
this.program = new Program(snapshotId, this, client, sourceFileCache, toPath);
|
|
413
|
+
const objectRegistry = new ProjectObjectRegistry(client, snapshotId, this, snapshotRegistry);
|
|
414
|
+
this.checker = new Checker(snapshotId, this, client, objectRegistry);
|
|
391
415
|
this.emitter = new Emitter(client);
|
|
392
416
|
}
|
|
393
417
|
dispose() {
|
|
@@ -396,31 +420,34 @@ export class Project {
|
|
|
396
420
|
}
|
|
397
421
|
export class Program {
|
|
398
422
|
snapshotId;
|
|
399
|
-
|
|
423
|
+
project;
|
|
400
424
|
client;
|
|
401
425
|
sourceFileCache;
|
|
402
426
|
toPath;
|
|
403
427
|
decoder = new Wtf8Decoder();
|
|
404
428
|
sourceFileMetadataCache = new Map();
|
|
405
|
-
constructor(snapshotId,
|
|
429
|
+
constructor(snapshotId, project, client, sourceFileCache, toPath) {
|
|
406
430
|
this.snapshotId = snapshotId;
|
|
407
|
-
this.
|
|
431
|
+
this.project = project;
|
|
408
432
|
this.client = client;
|
|
409
433
|
this.sourceFileCache = sourceFileCache;
|
|
410
434
|
this.toPath = toPath;
|
|
411
435
|
}
|
|
436
|
+
getCompilerOptions() {
|
|
437
|
+
return this.project.compilerOptions;
|
|
438
|
+
}
|
|
412
439
|
getSourceFile(file) {
|
|
413
440
|
const fileName = resolveFileName(file);
|
|
414
441
|
const path = this.toPath(fileName);
|
|
415
442
|
// Check if we already have a retained cache entry for this (snapshot, project) pair
|
|
416
|
-
const retained = this.sourceFileCache.getRetained(path, this.snapshotId, this.
|
|
443
|
+
const retained = this.sourceFileCache.getRetained(path, this.snapshotId, this.project.id);
|
|
417
444
|
if (retained) {
|
|
418
445
|
return retained;
|
|
419
446
|
}
|
|
420
447
|
// Fetch from server
|
|
421
448
|
const binaryData = this.client.apiRequestBinary("getSourceFile", {
|
|
422
449
|
snapshot: this.snapshotId,
|
|
423
|
-
project: this.
|
|
450
|
+
project: this.project.id,
|
|
424
451
|
file,
|
|
425
452
|
});
|
|
426
453
|
if (!binaryData) {
|
|
@@ -430,13 +457,13 @@ export class Program {
|
|
|
430
457
|
const contentHash = readSourceFileHash(view);
|
|
431
458
|
const parseOptionsKey = readParseOptionsKey(view);
|
|
432
459
|
// Create a new RemoteSourceFile and cache it (set returns existing if hash matches)
|
|
433
|
-
const sourceFile = new RemoteSourceFile(binaryData, this.decoder);
|
|
434
|
-
return this.sourceFileCache.set(path, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.
|
|
460
|
+
const sourceFile = new RemoteSourceFile(binaryData, this.decoder, this.client.getTimingCollector());
|
|
461
|
+
return this.sourceFileCache.set(path, sourceFile, parseOptionsKey, contentHash, this.snapshotId, this.project.id);
|
|
435
462
|
}
|
|
436
463
|
getSourceFileNames() {
|
|
437
464
|
const data = this.client.apiRequest("getSourceFileNames", {
|
|
438
465
|
snapshot: this.snapshotId,
|
|
439
|
-
project: this.
|
|
466
|
+
project: this.project.id,
|
|
440
467
|
});
|
|
441
468
|
return data ?? [];
|
|
442
469
|
}
|
|
@@ -465,7 +492,7 @@ export class Program {
|
|
|
465
492
|
fetchSourceFileMetadata(path) {
|
|
466
493
|
const data = this.client.apiRequest("getSourceFileMetadata", {
|
|
467
494
|
snapshot: this.snapshotId,
|
|
468
|
-
project: this.
|
|
495
|
+
project: this.project.id,
|
|
469
496
|
file: path,
|
|
470
497
|
});
|
|
471
498
|
return data ?? undefined;
|
|
@@ -495,7 +522,7 @@ export class Program {
|
|
|
495
522
|
getSyntacticDiagnostics(file) {
|
|
496
523
|
const data = this.client.apiRequest("getSyntacticDiagnostics", {
|
|
497
524
|
snapshot: this.snapshotId,
|
|
498
|
-
project: this.
|
|
525
|
+
project: this.project.id,
|
|
499
526
|
...(file !== undefined ? { file } : {}),
|
|
500
527
|
});
|
|
501
528
|
return data ?? [];
|
|
@@ -507,7 +534,7 @@ export class Program {
|
|
|
507
534
|
getBindDiagnostics(file) {
|
|
508
535
|
const data = this.client.apiRequest("getBindDiagnostics", {
|
|
509
536
|
snapshot: this.snapshotId,
|
|
510
|
-
project: this.
|
|
537
|
+
project: this.project.id,
|
|
511
538
|
...(file !== undefined ? { file } : {}),
|
|
512
539
|
});
|
|
513
540
|
return data ?? [];
|
|
@@ -519,7 +546,7 @@ export class Program {
|
|
|
519
546
|
getSemanticDiagnostics(file) {
|
|
520
547
|
const data = this.client.apiRequest("getSemanticDiagnostics", {
|
|
521
548
|
snapshot: this.snapshotId,
|
|
522
|
-
project: this.
|
|
549
|
+
project: this.project.id,
|
|
523
550
|
...(file !== undefined ? { file } : {}),
|
|
524
551
|
});
|
|
525
552
|
return data ?? [];
|
|
@@ -531,7 +558,7 @@ export class Program {
|
|
|
531
558
|
getSuggestionDiagnostics(file) {
|
|
532
559
|
const data = this.client.apiRequest("getSuggestionDiagnostics", {
|
|
533
560
|
snapshot: this.snapshotId,
|
|
534
|
-
project: this.
|
|
561
|
+
project: this.project.id,
|
|
535
562
|
...(file !== undefined ? { file } : {}),
|
|
536
563
|
});
|
|
537
564
|
return data ?? [];
|
|
@@ -543,7 +570,7 @@ export class Program {
|
|
|
543
570
|
getDeclarationDiagnostics(file) {
|
|
544
571
|
const data = this.client.apiRequest("getDeclarationDiagnostics", {
|
|
545
572
|
snapshot: this.snapshotId,
|
|
546
|
-
project: this.
|
|
573
|
+
project: this.project.id,
|
|
547
574
|
...(file !== undefined ? { file } : {}),
|
|
548
575
|
});
|
|
549
576
|
return data ?? [];
|
|
@@ -554,7 +581,7 @@ export class Program {
|
|
|
554
581
|
getProgramDiagnostics() {
|
|
555
582
|
const data = this.client.apiRequest("getProgramDiagnostics", {
|
|
556
583
|
snapshot: this.snapshotId,
|
|
557
|
-
project: this.
|
|
584
|
+
project: this.project.id,
|
|
558
585
|
});
|
|
559
586
|
return data ?? [];
|
|
560
587
|
}
|
|
@@ -564,7 +591,7 @@ export class Program {
|
|
|
564
591
|
getGlobalDiagnostics() {
|
|
565
592
|
const data = this.client.apiRequest("getGlobalDiagnostics", {
|
|
566
593
|
snapshot: this.snapshotId,
|
|
567
|
-
project: this.
|
|
594
|
+
project: this.project.id,
|
|
568
595
|
});
|
|
569
596
|
return data ?? [];
|
|
570
597
|
}
|
|
@@ -574,20 +601,20 @@ export class Program {
|
|
|
574
601
|
getConfigFileParsingDiagnostics() {
|
|
575
602
|
const data = this.client.apiRequest("getConfigFileParsingDiagnostics", {
|
|
576
603
|
snapshot: this.snapshotId,
|
|
577
|
-
project: this.
|
|
604
|
+
project: this.project.id,
|
|
578
605
|
});
|
|
579
606
|
return data ?? [];
|
|
580
607
|
}
|
|
581
608
|
}
|
|
582
609
|
export class Checker {
|
|
583
610
|
snapshotId;
|
|
584
|
-
|
|
611
|
+
project;
|
|
585
612
|
client;
|
|
586
613
|
objectRegistry;
|
|
587
614
|
wellKnownSymbols;
|
|
588
|
-
constructor(snapshotId,
|
|
615
|
+
constructor(snapshotId, project, client, objectRegistry) {
|
|
589
616
|
this.snapshotId = snapshotId;
|
|
590
|
-
this.
|
|
617
|
+
this.project = project;
|
|
591
618
|
this.client = client;
|
|
592
619
|
this.objectRegistry = objectRegistry;
|
|
593
620
|
}
|
|
@@ -598,14 +625,14 @@ export class Checker {
|
|
|
598
625
|
if (Array.isArray(nodeOrNodes)) {
|
|
599
626
|
const data = this.client.apiRequest("getSymbolsAtLocations", {
|
|
600
627
|
snapshot: this.snapshotId,
|
|
601
|
-
project: this.
|
|
628
|
+
project: this.project.id,
|
|
602
629
|
locations: nodeOrNodes.map(node => getNodeId(node)),
|
|
603
630
|
});
|
|
604
631
|
return data.map(d => d ? this.objectRegistry.getOrCreateSymbol(d) : undefined);
|
|
605
632
|
}
|
|
606
633
|
const data = this.client.apiRequest("getSymbolAtLocation", {
|
|
607
634
|
snapshot: this.snapshotId,
|
|
608
|
-
project: this.
|
|
635
|
+
project: this.project.id,
|
|
609
636
|
location: getNodeId(nodeOrNodes),
|
|
610
637
|
});
|
|
611
638
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -614,7 +641,7 @@ export class Checker {
|
|
|
614
641
|
if (typeof positionOrPositions === "number") {
|
|
615
642
|
const data = this.client.apiRequest("getSymbolAtPosition", {
|
|
616
643
|
snapshot: this.snapshotId,
|
|
617
|
-
project: this.
|
|
644
|
+
project: this.project.id,
|
|
618
645
|
file,
|
|
619
646
|
position: positionOrPositions,
|
|
620
647
|
});
|
|
@@ -622,7 +649,7 @@ export class Checker {
|
|
|
622
649
|
}
|
|
623
650
|
const data = this.client.apiRequest("getSymbolsAtPositions", {
|
|
624
651
|
snapshot: this.snapshotId,
|
|
625
|
-
project: this.
|
|
652
|
+
project: this.project.id,
|
|
626
653
|
file,
|
|
627
654
|
positions: positionOrPositions,
|
|
628
655
|
});
|
|
@@ -632,14 +659,14 @@ export class Checker {
|
|
|
632
659
|
if (Array.isArray(symbolOrSymbols)) {
|
|
633
660
|
const data = this.client.apiRequest("getTypesOfSymbols", {
|
|
634
661
|
snapshot: this.snapshotId,
|
|
635
|
-
project: this.
|
|
662
|
+
project: this.project.id,
|
|
636
663
|
symbols: symbolOrSymbols.map(s => s.id),
|
|
637
664
|
});
|
|
638
665
|
return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
|
|
639
666
|
}
|
|
640
667
|
const data = this.client.apiRequest("getTypeOfSymbol", {
|
|
641
668
|
snapshot: this.snapshotId,
|
|
642
|
-
project: this.
|
|
669
|
+
project: this.project.id,
|
|
643
670
|
symbol: symbolOrSymbols.id,
|
|
644
671
|
});
|
|
645
672
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -652,7 +679,7 @@ export class Checker {
|
|
|
652
679
|
getDeclaredTypeOfSymbol(symbol) {
|
|
653
680
|
const data = this.client.apiRequest("getDeclaredTypeOfSymbol", {
|
|
654
681
|
snapshot: this.snapshotId,
|
|
655
|
-
project: this.
|
|
682
|
+
project: this.project.id,
|
|
656
683
|
symbol: symbol.id,
|
|
657
684
|
});
|
|
658
685
|
if (!data)
|
|
@@ -662,40 +689,40 @@ export class Checker {
|
|
|
662
689
|
getReferencesToSymbolInFile(file, symbol) {
|
|
663
690
|
const data = this.client.apiRequest("getReferencesToSymbolInFile", {
|
|
664
691
|
snapshot: this.snapshotId,
|
|
665
|
-
project: this.
|
|
692
|
+
project: this.project.id,
|
|
666
693
|
file,
|
|
667
694
|
symbol: symbol.id,
|
|
668
695
|
});
|
|
669
|
-
return (data ?? []).map(h => new NodeHandle(h));
|
|
696
|
+
return (data ?? []).map(h => new NodeHandle(h, this.project));
|
|
670
697
|
}
|
|
671
698
|
getReferencedSymbolsForNode(node, position) {
|
|
672
699
|
const data = this.client.apiRequest("getReferencedSymbolsForNode", {
|
|
673
700
|
snapshot: this.snapshotId,
|
|
674
|
-
project: this.
|
|
701
|
+
project: this.project.id,
|
|
675
702
|
node: getNodeId(node),
|
|
676
703
|
position,
|
|
677
704
|
});
|
|
678
705
|
return (data ?? []).map(entry => ({
|
|
679
|
-
definition: new NodeHandle(entry.definition),
|
|
706
|
+
definition: new NodeHandle(entry.definition, this.project),
|
|
680
707
|
symbol: entry.symbol ? this.objectRegistry.getOrCreateSymbol(entry.symbol) : undefined,
|
|
681
|
-
references: (entry.references ?? []).map(h => new NodeHandle(h)),
|
|
708
|
+
references: (entry.references ?? []).map(h => new NodeHandle(h, this.project)),
|
|
682
709
|
}));
|
|
683
710
|
}
|
|
684
711
|
getSignatureUsage(signatureDecl) {
|
|
685
712
|
const data = this.client.apiRequest("getSignatureUsages", {
|
|
686
713
|
snapshot: this.snapshotId,
|
|
687
|
-
project: this.
|
|
714
|
+
project: this.project.id,
|
|
688
715
|
signatureDecl: getNodeId(signatureDecl),
|
|
689
716
|
});
|
|
690
717
|
return (data ?? []).map(entry => ({
|
|
691
|
-
name: new NodeHandle(entry.name),
|
|
692
|
-
call: entry.call ? new NodeHandle(entry.call) : undefined,
|
|
718
|
+
name: new NodeHandle(entry.name, this.project),
|
|
719
|
+
call: entry.call ? new NodeHandle(entry.call, this.project) : undefined,
|
|
693
720
|
}));
|
|
694
721
|
}
|
|
695
722
|
getCompletionsAtPosition(document, position, options) {
|
|
696
723
|
const data = this.client.apiRequest("getCompletionsAtPosition", {
|
|
697
724
|
snapshot: this.snapshotId,
|
|
698
|
-
project: this.
|
|
725
|
+
project: this.project.id,
|
|
699
726
|
file: document,
|
|
700
727
|
position,
|
|
701
728
|
triggerCharacter: options?.triggerCharacter,
|
|
@@ -715,14 +742,14 @@ export class Checker {
|
|
|
715
742
|
if (Array.isArray(nodeOrNodes)) {
|
|
716
743
|
const data = this.client.apiRequest("getTypeAtLocations", {
|
|
717
744
|
snapshot: this.snapshotId,
|
|
718
|
-
project: this.
|
|
745
|
+
project: this.project.id,
|
|
719
746
|
locations: nodeOrNodes.map(node => getNodeId(node)),
|
|
720
747
|
});
|
|
721
748
|
return data.map(d => d ? this.objectRegistry.getOrCreateType(d) : undefined);
|
|
722
749
|
}
|
|
723
750
|
const data = this.client.apiRequest("getTypeAtLocation", {
|
|
724
751
|
snapshot: this.snapshotId,
|
|
725
|
-
project: this.
|
|
752
|
+
project: this.project.id,
|
|
726
753
|
location: getNodeId(nodeOrNodes),
|
|
727
754
|
});
|
|
728
755
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -730,7 +757,7 @@ export class Checker {
|
|
|
730
757
|
getSignaturesOfType(type, kind) {
|
|
731
758
|
const data = this.client.apiRequest("getSignaturesOfType", {
|
|
732
759
|
snapshot: this.snapshotId,
|
|
733
|
-
project: this.
|
|
760
|
+
project: this.project.id,
|
|
734
761
|
type: type.id,
|
|
735
762
|
kind,
|
|
736
763
|
});
|
|
@@ -739,7 +766,7 @@ export class Checker {
|
|
|
739
766
|
getResolvedSignature(node) {
|
|
740
767
|
const data = this.client.apiRequest("getResolvedSignature", {
|
|
741
768
|
snapshot: this.snapshotId,
|
|
742
|
-
project: this.
|
|
769
|
+
project: this.project.id,
|
|
743
770
|
location: getNodeId(node),
|
|
744
771
|
});
|
|
745
772
|
return data ? this.objectRegistry.getOrCreateSignature(data) : undefined;
|
|
@@ -748,7 +775,7 @@ export class Checker {
|
|
|
748
775
|
if (typeof positionOrPositions === "number") {
|
|
749
776
|
const data = this.client.apiRequest("getTypeAtPosition", {
|
|
750
777
|
snapshot: this.snapshotId,
|
|
751
|
-
project: this.
|
|
778
|
+
project: this.project.id,
|
|
752
779
|
file,
|
|
753
780
|
position: positionOrPositions,
|
|
754
781
|
});
|
|
@@ -756,7 +783,7 @@ export class Checker {
|
|
|
756
783
|
}
|
|
757
784
|
const data = this.client.apiRequest("getTypesAtPositions", {
|
|
758
785
|
snapshot: this.snapshotId,
|
|
759
|
-
project: this.
|
|
786
|
+
project: this.project.id,
|
|
760
787
|
file,
|
|
761
788
|
positions: positionOrPositions,
|
|
762
789
|
});
|
|
@@ -767,7 +794,7 @@ export class Checker {
|
|
|
767
794
|
const isNode = location && "kind" in location;
|
|
768
795
|
const data = this.client.apiRequest("resolveName", {
|
|
769
796
|
snapshot: this.snapshotId,
|
|
770
|
-
project: this.
|
|
797
|
+
project: this.project.id,
|
|
771
798
|
name,
|
|
772
799
|
meaning,
|
|
773
800
|
location: isNode ? getNodeId(location) : undefined,
|
|
@@ -786,7 +813,7 @@ export class Checker {
|
|
|
786
813
|
getContextualType(node) {
|
|
787
814
|
const data = this.client.apiRequest("getContextualType", {
|
|
788
815
|
snapshot: this.snapshotId,
|
|
789
|
-
project: this.
|
|
816
|
+
project: this.project.id,
|
|
790
817
|
location: getNodeId(node),
|
|
791
818
|
});
|
|
792
819
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -794,7 +821,7 @@ export class Checker {
|
|
|
794
821
|
getBaseTypeOfLiteralType(type) {
|
|
795
822
|
const data = this.client.apiRequest("getBaseTypeOfLiteralType", {
|
|
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
|
getNonNullableType(type) {
|
|
803
830
|
const data = this.client.apiRequest("getNonNullableType", {
|
|
804
831
|
snapshot: this.snapshotId,
|
|
805
|
-
project: this.
|
|
832
|
+
project: this.project.id,
|
|
806
833
|
type: type.id,
|
|
807
834
|
});
|
|
808
835
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -810,7 +837,7 @@ export class Checker {
|
|
|
810
837
|
getTypeFromTypeNode(node) {
|
|
811
838
|
const data = this.client.apiRequest("getTypeFromTypeNode", {
|
|
812
839
|
snapshot: this.snapshotId,
|
|
813
|
-
project: this.
|
|
840
|
+
project: this.project.id,
|
|
814
841
|
location: getNodeId(node),
|
|
815
842
|
});
|
|
816
843
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -818,7 +845,7 @@ export class Checker {
|
|
|
818
845
|
getWidenedType(type) {
|
|
819
846
|
const data = this.client.apiRequest("getWidenedType", {
|
|
820
847
|
snapshot: this.snapshotId,
|
|
821
|
-
project: this.
|
|
848
|
+
project: this.project.id,
|
|
822
849
|
type: type.id,
|
|
823
850
|
});
|
|
824
851
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -826,7 +853,7 @@ export class Checker {
|
|
|
826
853
|
getParameterType(signature, index) {
|
|
827
854
|
const data = this.client.apiRequest("getParameterType", {
|
|
828
855
|
snapshot: this.snapshotId,
|
|
829
|
-
project: this.
|
|
856
|
+
project: this.project.id,
|
|
830
857
|
signature: signature.id,
|
|
831
858
|
index,
|
|
832
859
|
});
|
|
@@ -835,14 +862,14 @@ export class Checker {
|
|
|
835
862
|
isArrayLikeType(type) {
|
|
836
863
|
return this.client.apiRequest("isArrayLikeType", {
|
|
837
864
|
snapshot: this.snapshotId,
|
|
838
|
-
project: this.
|
|
865
|
+
project: this.project.id,
|
|
839
866
|
type: type.id,
|
|
840
867
|
});
|
|
841
868
|
}
|
|
842
869
|
isTypeAssignableTo(source, target) {
|
|
843
870
|
return this.client.apiRequest("isTypeAssignableTo", {
|
|
844
871
|
snapshot: this.snapshotId,
|
|
845
|
-
project: this.
|
|
872
|
+
project: this.project.id,
|
|
846
873
|
source: source.id,
|
|
847
874
|
target: target.id,
|
|
848
875
|
});
|
|
@@ -850,7 +877,7 @@ export class Checker {
|
|
|
850
877
|
getShorthandAssignmentValueSymbol(node) {
|
|
851
878
|
const data = this.client.apiRequest("getShorthandAssignmentValueSymbol", {
|
|
852
879
|
snapshot: this.snapshotId,
|
|
853
|
-
project: this.
|
|
880
|
+
project: this.project.id,
|
|
854
881
|
location: getNodeId(node),
|
|
855
882
|
});
|
|
856
883
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -863,7 +890,7 @@ export class Checker {
|
|
|
863
890
|
getTypeOfSymbolAtLocation(symbol, location) {
|
|
864
891
|
const data = this.client.apiRequest("getTypeOfSymbolAtLocation", {
|
|
865
892
|
snapshot: this.snapshotId,
|
|
866
|
-
project: this.
|
|
893
|
+
project: this.project.id,
|
|
867
894
|
symbol: symbol.id,
|
|
868
895
|
location: getNodeId(location),
|
|
869
896
|
});
|
|
@@ -874,7 +901,7 @@ export class Checker {
|
|
|
874
901
|
getIntrinsicType(method) {
|
|
875
902
|
const data = this.client.apiRequest(method, {
|
|
876
903
|
snapshot: this.snapshotId,
|
|
877
|
-
project: this.
|
|
904
|
+
project: this.project.id,
|
|
878
905
|
});
|
|
879
906
|
return this.objectRegistry.getOrCreateType(data);
|
|
880
907
|
}
|
|
@@ -914,7 +941,7 @@ export class Checker {
|
|
|
914
941
|
typeToTypeNode(type, enclosingDeclaration, flags) {
|
|
915
942
|
const binaryData = this.client.apiRequestBinary("typeToTypeNode", {
|
|
916
943
|
snapshot: this.snapshotId,
|
|
917
|
-
project: this.
|
|
944
|
+
project: this.project.id,
|
|
918
945
|
type: type.id,
|
|
919
946
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
920
947
|
flags,
|
|
@@ -926,7 +953,7 @@ export class Checker {
|
|
|
926
953
|
signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags) {
|
|
927
954
|
const binaryData = this.client.apiRequestBinary("signatureToSignatureDeclaration", {
|
|
928
955
|
snapshot: this.snapshotId,
|
|
929
|
-
project: this.
|
|
956
|
+
project: this.project.id,
|
|
930
957
|
signature: signature.id,
|
|
931
958
|
kind,
|
|
932
959
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
@@ -939,7 +966,7 @@ export class Checker {
|
|
|
939
966
|
typeToString(type, enclosingDeclaration, flags) {
|
|
940
967
|
return this.client.apiRequest("typeToString", {
|
|
941
968
|
snapshot: this.snapshotId,
|
|
942
|
-
project: this.
|
|
969
|
+
project: this.project.id,
|
|
943
970
|
type: type.id,
|
|
944
971
|
location: enclosingDeclaration ? getNodeId(enclosingDeclaration) : undefined,
|
|
945
972
|
flags,
|
|
@@ -948,28 +975,28 @@ export class Checker {
|
|
|
948
975
|
isContextSensitive(node) {
|
|
949
976
|
return this.client.apiRequest("isContextSensitive", {
|
|
950
977
|
snapshot: this.snapshotId,
|
|
951
|
-
project: this.
|
|
978
|
+
project: this.project.id,
|
|
952
979
|
location: getNodeId(node),
|
|
953
980
|
});
|
|
954
981
|
}
|
|
955
982
|
isArrayType(type) {
|
|
956
983
|
return this.client.apiRequest("isArrayType", {
|
|
957
984
|
snapshot: this.snapshotId,
|
|
958
|
-
project: this.
|
|
985
|
+
project: this.project.id,
|
|
959
986
|
type: type.id,
|
|
960
987
|
});
|
|
961
988
|
}
|
|
962
989
|
isTupleType(type) {
|
|
963
990
|
return this.client.apiRequest("isTupleType", {
|
|
964
991
|
snapshot: this.snapshotId,
|
|
965
|
-
project: this.
|
|
992
|
+
project: this.project.id,
|
|
966
993
|
type: type.id,
|
|
967
994
|
});
|
|
968
995
|
}
|
|
969
996
|
getReturnTypeOfSignature(signature) {
|
|
970
997
|
const data = this.client.apiRequest("getReturnTypeOfSignature", {
|
|
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
|
getRestTypeOfSignature(signature) {
|
|
978
1005
|
const data = this.client.apiRequest("getRestTypeOfSignature", {
|
|
979
1006
|
snapshot: this.snapshotId,
|
|
980
|
-
project: this.
|
|
1007
|
+
project: this.project.id,
|
|
981
1008
|
signature: signature.id,
|
|
982
1009
|
});
|
|
983
1010
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -985,7 +1012,7 @@ export class Checker {
|
|
|
985
1012
|
getTypePredicateOfSignature(signature) {
|
|
986
1013
|
const data = this.client.apiRequest("getTypePredicateOfSignature", {
|
|
987
1014
|
snapshot: this.snapshotId,
|
|
988
|
-
project: this.
|
|
1015
|
+
project: this.project.id,
|
|
989
1016
|
signature: signature.id,
|
|
990
1017
|
});
|
|
991
1018
|
if (!data)
|
|
@@ -1004,7 +1031,7 @@ export class Checker {
|
|
|
1004
1031
|
getBaseTypes(type) {
|
|
1005
1032
|
const data = this.client.apiRequest("getBaseTypes", {
|
|
1006
1033
|
snapshot: this.snapshotId,
|
|
1007
|
-
project: this.
|
|
1034
|
+
project: this.project.id,
|
|
1008
1035
|
type: type.id,
|
|
1009
1036
|
});
|
|
1010
1037
|
return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
|
|
@@ -1012,7 +1039,7 @@ export class Checker {
|
|
|
1012
1039
|
getApparentType(type) {
|
|
1013
1040
|
const data = this.client.apiRequest("getApparentType", {
|
|
1014
1041
|
snapshot: this.snapshotId,
|
|
1015
|
-
project: this.
|
|
1042
|
+
project: this.project.id,
|
|
1016
1043
|
type: type.id,
|
|
1017
1044
|
});
|
|
1018
1045
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1020,7 +1047,7 @@ export class Checker {
|
|
|
1020
1047
|
getPropertiesOfType(type) {
|
|
1021
1048
|
const data = this.client.apiRequest("getPropertiesOfType", {
|
|
1022
1049
|
snapshot: this.snapshotId,
|
|
1023
|
-
project: this.
|
|
1050
|
+
project: this.project.id,
|
|
1024
1051
|
type: type.id,
|
|
1025
1052
|
});
|
|
1026
1053
|
return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
@@ -1028,7 +1055,7 @@ export class Checker {
|
|
|
1028
1055
|
getIndexInfosOfType(type) {
|
|
1029
1056
|
const data = this.client.apiRequest("getIndexInfosOfType", {
|
|
1030
1057
|
snapshot: this.snapshotId,
|
|
1031
|
-
project: this.
|
|
1058
|
+
project: this.project.id,
|
|
1032
1059
|
type: type.id,
|
|
1033
1060
|
});
|
|
1034
1061
|
if (!data)
|
|
@@ -1037,7 +1064,7 @@ export class Checker {
|
|
|
1037
1064
|
keyType: this.objectRegistry.getOrCreateType(d.keyType),
|
|
1038
1065
|
valueType: this.objectRegistry.getOrCreateType(d.valueType),
|
|
1039
1066
|
isReadonly: d.isReadonly ?? false,
|
|
1040
|
-
declaration: d.declaration ? new NodeHandle(d.declaration) : undefined,
|
|
1067
|
+
declaration: d.declaration ? new NodeHandle(d.declaration, this.project) : undefined,
|
|
1041
1068
|
}));
|
|
1042
1069
|
}
|
|
1043
1070
|
/**
|
|
@@ -1047,7 +1074,7 @@ export class Checker {
|
|
|
1047
1074
|
getConstraintOfTypeParameter(type) {
|
|
1048
1075
|
const data = this.client.apiRequest("getConstraintOfTypeParameter", {
|
|
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
|
getBaseConstraintOfType(type) {
|
|
1056
1083
|
const data = this.client.apiRequest("getBaseConstraintOfType", {
|
|
1057
1084
|
snapshot: this.snapshotId,
|
|
1058
|
-
project: this.
|
|
1085
|
+
project: this.project.id,
|
|
1059
1086
|
type: type.id,
|
|
1060
1087
|
});
|
|
1061
1088
|
return data ? this.objectRegistry.getOrCreateType(data) : undefined;
|
|
@@ -1063,7 +1090,7 @@ export class Checker {
|
|
|
1063
1090
|
getPropertyOfType(type, name) {
|
|
1064
1091
|
const data = this.client.apiRequest("getPropertyOfType", {
|
|
1065
1092
|
snapshot: this.snapshotId,
|
|
1066
|
-
project: this.
|
|
1093
|
+
project: this.project.id,
|
|
1067
1094
|
type: type.id,
|
|
1068
1095
|
name,
|
|
1069
1096
|
});
|
|
@@ -1072,7 +1099,7 @@ export class Checker {
|
|
|
1072
1099
|
getConstantValue(node) {
|
|
1073
1100
|
const data = this.client.apiRequest("getConstantValue", {
|
|
1074
1101
|
snapshot: this.snapshotId,
|
|
1075
|
-
project: this.
|
|
1102
|
+
project: this.project.id,
|
|
1076
1103
|
location: getNodeId(node),
|
|
1077
1104
|
});
|
|
1078
1105
|
return data ?? undefined;
|
|
@@ -1080,7 +1107,7 @@ export class Checker {
|
|
|
1080
1107
|
getSignatureFromDeclaration(node) {
|
|
1081
1108
|
const data = this.client.apiRequest("getSignatureFromDeclaration", {
|
|
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.getOrCreateSignature(data) : undefined;
|
|
@@ -1088,7 +1115,7 @@ export class Checker {
|
|
|
1088
1115
|
getExportSpecifierLocalTargetSymbol(node) {
|
|
1089
1116
|
const data = this.client.apiRequest("getExportSpecifierLocalTargetSymbol", {
|
|
1090
1117
|
snapshot: this.snapshotId,
|
|
1091
|
-
project: this.
|
|
1118
|
+
project: this.project.id,
|
|
1092
1119
|
location: getNodeId(node),
|
|
1093
1120
|
});
|
|
1094
1121
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -1101,7 +1128,7 @@ export class Checker {
|
|
|
1101
1128
|
getAliasedSymbol(symbol) {
|
|
1102
1129
|
const data = this.client.apiRequest("getAliasedSymbol", {
|
|
1103
1130
|
snapshot: this.snapshotId,
|
|
1104
|
-
project: this.
|
|
1131
|
+
project: this.project.id,
|
|
1105
1132
|
symbol: symbol.id,
|
|
1106
1133
|
});
|
|
1107
1134
|
if (!data)
|
|
@@ -1111,7 +1138,7 @@ export class Checker {
|
|
|
1111
1138
|
getImmediateAliasedSymbol(symbol) {
|
|
1112
1139
|
const data = this.client.apiRequest("getImmediateAliasedSymbol", {
|
|
1113
1140
|
snapshot: this.snapshotId,
|
|
1114
|
-
project: this.
|
|
1141
|
+
project: this.project.id,
|
|
1115
1142
|
symbol: symbol.id,
|
|
1116
1143
|
});
|
|
1117
1144
|
return data ? this.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
@@ -1125,7 +1152,7 @@ export class Checker {
|
|
|
1125
1152
|
getWellKnownSymbols() {
|
|
1126
1153
|
return this.wellKnownSymbols ??= this.client.apiRequest("getWellKnownSymbols", {
|
|
1127
1154
|
snapshot: this.snapshotId,
|
|
1128
|
-
project: this.
|
|
1155
|
+
project: this.project.id,
|
|
1129
1156
|
});
|
|
1130
1157
|
}
|
|
1131
1158
|
/**
|
|
@@ -1150,7 +1177,7 @@ export class Checker {
|
|
|
1150
1177
|
getExportsOfModule(symbol) {
|
|
1151
1178
|
const data = this.client.apiRequest("getExportsOfModule", {
|
|
1152
1179
|
snapshot: this.snapshotId,
|
|
1153
|
-
project: this.
|
|
1180
|
+
project: this.project.id,
|
|
1154
1181
|
symbol: symbol.id,
|
|
1155
1182
|
});
|
|
1156
1183
|
return data ? data.map(d => this.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
@@ -1158,7 +1185,7 @@ export class Checker {
|
|
|
1158
1185
|
getMemberInModuleExports(symbol, name) {
|
|
1159
1186
|
const data = this.client.apiRequest("getMemberInModuleExports", {
|
|
1160
1187
|
snapshot: this.snapshotId,
|
|
1161
|
-
project: this.
|
|
1188
|
+
project: this.project.id,
|
|
1162
1189
|
symbol: symbol.id,
|
|
1163
1190
|
name,
|
|
1164
1191
|
});
|
|
@@ -1167,7 +1194,7 @@ export class Checker {
|
|
|
1167
1194
|
getJsDocTagsOfSymbol(symbol) {
|
|
1168
1195
|
const data = this.client.apiRequest("getJsDocTags", {
|
|
1169
1196
|
snapshot: this.snapshotId,
|
|
1170
|
-
project: this.
|
|
1197
|
+
project: this.project.id,
|
|
1171
1198
|
symbol: symbol.id,
|
|
1172
1199
|
});
|
|
1173
1200
|
return data ?? [];
|
|
@@ -1175,7 +1202,7 @@ export class Checker {
|
|
|
1175
1202
|
getDocumentationCommentOfSymbol(symbol) {
|
|
1176
1203
|
return this.client.apiRequest("getDocumentationComment", {
|
|
1177
1204
|
snapshot: this.snapshotId,
|
|
1178
|
-
project: this.
|
|
1205
|
+
project: this.project.id,
|
|
1179
1206
|
symbol: symbol.id,
|
|
1180
1207
|
});
|
|
1181
1208
|
}
|
|
@@ -1185,7 +1212,7 @@ export class Checker {
|
|
|
1185
1212
|
getTypeArguments(type) {
|
|
1186
1213
|
const data = this.client.apiRequest("getTypeArguments", {
|
|
1187
1214
|
snapshot: this.snapshotId,
|
|
1188
|
-
project: this.
|
|
1215
|
+
project: this.project.id,
|
|
1189
1216
|
type: type.id,
|
|
1190
1217
|
});
|
|
1191
1218
|
return data ? data.map(d => this.objectRegistry.getOrCreateType(d)) : [];
|
|
@@ -1206,20 +1233,28 @@ export class Emitter {
|
|
|
1206
1233
|
}
|
|
1207
1234
|
}
|
|
1208
1235
|
export class NodeHandle {
|
|
1236
|
+
/**
|
|
1237
|
+
* The project this handle was produced in, used as the default for {@link resolve}.
|
|
1238
|
+
* Node handles are only meaningful within a project's program, so the producing project
|
|
1239
|
+
* is remembered so callers don't have to pass it explicitly.
|
|
1240
|
+
*/
|
|
1241
|
+
canonicalProject;
|
|
1209
1242
|
index;
|
|
1210
1243
|
kind;
|
|
1211
1244
|
path;
|
|
1212
|
-
constructor(handle) {
|
|
1245
|
+
constructor(handle, canonicalProject) {
|
|
1213
1246
|
const parsed = parseNodeHandle(handle);
|
|
1214
1247
|
this.index = parsed.index;
|
|
1215
1248
|
this.kind = parsed.kind;
|
|
1216
1249
|
this.path = parsed.path;
|
|
1250
|
+
this.canonicalProject = canonicalProject;
|
|
1217
1251
|
}
|
|
1218
1252
|
/**
|
|
1219
|
-
* Resolve this handle to the actual AST node by fetching the source file
|
|
1220
|
-
*
|
|
1253
|
+
* Resolve this handle to the actual AST node by fetching the source file from a project
|
|
1254
|
+
* and looking up the node by index. If no project is passed, the project that produced
|
|
1255
|
+
* the handle is used.
|
|
1221
1256
|
*/
|
|
1222
|
-
resolve(project) {
|
|
1257
|
+
resolve(project = this.canonicalProject) {
|
|
1223
1258
|
const sourceFile = project.program.getSourceFile(this.path);
|
|
1224
1259
|
if (!sourceFile) {
|
|
1225
1260
|
return undefined;
|
|
@@ -1229,6 +1264,12 @@ export class NodeHandle {
|
|
|
1229
1264
|
}
|
|
1230
1265
|
export class Symbol {
|
|
1231
1266
|
objectRegistry;
|
|
1267
|
+
/**
|
|
1268
|
+
* The project this symbol was first observed in, used as the default project for
|
|
1269
|
+
* lookups that need a project context (members/exports/parent). Symbols are shared
|
|
1270
|
+
* snapshot-wide, so these lookups can otherwise be ambiguous about which project to use.
|
|
1271
|
+
*/
|
|
1272
|
+
canonicalProject;
|
|
1232
1273
|
id;
|
|
1233
1274
|
/** The escaped (`__String`) name, used as the key in member/export tables. */
|
|
1234
1275
|
escapedName;
|
|
@@ -1249,15 +1290,20 @@ export class Symbol {
|
|
|
1249
1290
|
this.name = unescapeLeadingUnderscores(data.name);
|
|
1250
1291
|
this.flags = data.flags;
|
|
1251
1292
|
this.checkFlags = data.checkFlags;
|
|
1252
|
-
|
|
1253
|
-
|
|
1293
|
+
const canonicalProject = objectRegistry.getProject(data.project);
|
|
1294
|
+
if (!canonicalProject) {
|
|
1295
|
+
throw new Error(`Symbol ${data.id} references unknown canonical project '${data.project}'`);
|
|
1296
|
+
}
|
|
1297
|
+
this.canonicalProject = canonicalProject;
|
|
1298
|
+
this.declarations = (data.declarations ?? []).map(d => new NodeHandle(d, canonicalProject));
|
|
1299
|
+
this.valueDeclaration = data.valueDeclaration ? new NodeHandle(data.valueDeclaration, canonicalProject) : undefined;
|
|
1254
1300
|
if (data.parent !== undefined)
|
|
1255
1301
|
this.parent = data.parent;
|
|
1256
1302
|
if (data.exportSymbol !== undefined)
|
|
1257
1303
|
this.exportSymbol = data.exportSymbol;
|
|
1258
1304
|
}
|
|
1259
1305
|
getParent() {
|
|
1260
|
-
return this.objectRegistry.fetchSymbol(this, "getParentOfSymbol", this.parent);
|
|
1306
|
+
return this.objectRegistry.fetchSymbol(this, "getParentOfSymbol", this.parent, this.canonicalProject.id);
|
|
1261
1307
|
}
|
|
1262
1308
|
/**
|
|
1263
1309
|
* Get this symbol's members keyed by escaped name. The result is cached on
|
|
@@ -1274,7 +1320,7 @@ export class Symbol {
|
|
|
1274
1320
|
return this.exportsCache ??= this.fetchSymbolTable("getExportsOfSymbol");
|
|
1275
1321
|
}
|
|
1276
1322
|
fetchSymbolTable(method) {
|
|
1277
|
-
const symbols = this.objectRegistry.fetchSymbols(this, method);
|
|
1323
|
+
const symbols = this.objectRegistry.fetchSymbols(this, method, undefined, this.canonicalProject.id);
|
|
1278
1324
|
const table = new Map();
|
|
1279
1325
|
for (const symbol of symbols) {
|
|
1280
1326
|
table.set(symbol.escapedName, symbol);
|
|
@@ -1284,7 +1330,7 @@ export class Symbol {
|
|
|
1284
1330
|
getExportSymbol() {
|
|
1285
1331
|
if (!this.exportSymbol)
|
|
1286
1332
|
return this;
|
|
1287
|
-
return this.objectRegistry.fetchSymbol(this, "getExportSymbolOfSymbol", this.exportSymbol);
|
|
1333
|
+
return this.objectRegistry.fetchSymbol(this, "getExportSymbolOfSymbol", this.exportSymbol, this.canonicalProject.id);
|
|
1288
1334
|
}
|
|
1289
1335
|
getJsDocTags(checker) {
|
|
1290
1336
|
return checker.getJsDocTagsOfSymbol(this);
|
|
@@ -1584,11 +1630,11 @@ export class Signature {
|
|
|
1584
1630
|
parameters;
|
|
1585
1631
|
thisParameter;
|
|
1586
1632
|
target;
|
|
1587
|
-
constructor(data, objectRegistry) {
|
|
1633
|
+
constructor(data, project, objectRegistry) {
|
|
1588
1634
|
this.id = data.id;
|
|
1589
1635
|
this.flags = data.flags;
|
|
1590
1636
|
this.objectRegistry = objectRegistry;
|
|
1591
|
-
this.declaration = data.declaration ? new NodeHandle(data.declaration) : undefined;
|
|
1637
|
+
this.declaration = data.declaration ? new NodeHandle(data.declaration, project) : undefined;
|
|
1592
1638
|
this.typeParameters = data.typeParameters ?? [];
|
|
1593
1639
|
this.parameters = data.parameters ?? [];
|
|
1594
1640
|
this.thisParameter = data.thisParameter;
|