typescript 7.1.0-dev.20261123.1 → 7.1.0-dev.20261125.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 +19 -7
- package/dist/api/async/api.d.ts.map +1 -1
- package/dist/api/async/api.js +78 -33
- package/dist/api/async/api.js.map +1 -1
- package/dist/api/async/client.js +4 -4
- package/dist/api/async/client.js.map +1 -1
- package/dist/api/async/jsonrpc.d.ts +3 -2
- package/dist/api/async/jsonrpc.d.ts.map +1 -1
- package/dist/api/async/jsonrpc.js +1 -1
- package/dist/api/async/jsonrpc.js.map +1 -1
- package/dist/api/async/transportClient.js +1 -2
- package/dist/api/async/transportClient.js.map +1 -1
- package/dist/api/fsCallbacks.js +6 -6
- package/dist/api/fsCallbacks.js.map +1 -1
- package/dist/api/node/encoder.d.ts.map +1 -1
- package/dist/api/node/encoder.js +5 -5
- package/dist/api/node/encoder.js.map +1 -1
- package/dist/api/node/msgpack.js +6 -6
- package/dist/api/node/msgpack.js.map +1 -1
- package/dist/api/node/node.d.ts.map +1 -1
- package/dist/api/node/node.generated.d.ts +2 -1
- package/dist/api/node/node.generated.d.ts.map +1 -1
- package/dist/api/node/node.generated.js +4 -0
- package/dist/api/node/node.generated.js.map +1 -1
- package/dist/api/node/node.infrastructure.d.ts.map +1 -1
- package/dist/api/node/node.infrastructure.js +13 -13
- package/dist/api/node/node.infrastructure.js.map +1 -1
- package/dist/api/node/node.js +30 -30
- package/dist/api/node/node.js.map +1 -1
- package/dist/api/node/wtf8.d.ts.map +1 -1
- package/dist/api/node/wtf8.js +2 -2
- package/dist/api/node/wtf8.js.map +1 -1
- package/dist/api/options.js +2 -2
- package/dist/api/options.js.map +1 -1
- package/dist/api/path.js +3 -3
- package/dist/api/path.js.map +1 -1
- package/dist/api/printer.d.ts.map +1 -1
- package/dist/api/printer.js.map +1 -1
- package/dist/api/proto.d.ts.map +1 -1
- package/dist/api/proto.generated.d.ts +25 -5
- package/dist/api/proto.generated.d.ts.map +1 -1
- package/dist/api/proto.generated.js.map +1 -1
- package/dist/api/proto.js +2 -2
- package/dist/api/proto.js.map +1 -1
- package/dist/api/sourceFileCache.d.ts +4 -4
- package/dist/api/sourceFileCache.d.ts.map +1 -1
- package/dist/api/sourceFileCache.js +2 -1
- package/dist/api/sourceFileCache.js.map +1 -1
- package/dist/api/sync/api.d.ts +37 -9
- package/dist/api/sync/api.d.ts.map +1 -1
- package/dist/api/sync/api.js +136 -44
- package/dist/api/sync/api.js.map +1 -1
- package/dist/api/sync/client.js +1 -1
- package/dist/api/sync/client.js.map +1 -1
- package/dist/api/sync/generatorSupport.js +4 -4
- package/dist/api/sync/generatorSupport.js.map +1 -1
- package/dist/api/sync/transportClient.js.map +1 -1
- package/dist/api/syncChannel.js +7 -7
- package/dist/api/syncChannel.js.map +1 -1
- package/dist/api/timing.d.ts +0 -14
- package/dist/api/timing.d.ts.map +1 -1
- package/dist/api/timing.js +1 -1
- package/dist/api/timingDump.d.ts.map +1 -1
- package/dist/api/timingDump.js +1 -0
- package/dist/api/timingDump.js.map +1 -1
- package/dist/ast/ast.d.ts +7 -1
- package/dist/ast/ast.d.ts.map +1 -1
- package/dist/ast/ast.js.map +1 -1
- package/dist/ast/astnav.js.map +1 -1
- package/dist/ast/factory.generated.d.ts.map +1 -1
- package/dist/ast/factory.generated.js +4 -1
- package/dist/ast/factory.generated.js.map +1 -1
- package/dist/ast/is.d.ts +7 -1
- package/dist/ast/is.d.ts.map +1 -1
- package/dist/ast/is.js +51 -10
- package/dist/ast/is.js.map +1 -1
- package/dist/ast/modifiers.d.ts.map +1 -1
- package/dist/ast/modifiers.js +6 -0
- package/dist/ast/modifiers.js.map +1 -1
- package/dist/ast/scanner.d.ts +3 -1
- package/dist/ast/scanner.d.ts.map +1 -1
- package/dist/ast/scanner.js +6 -17
- package/dist/ast/scanner.js.map +1 -1
- package/dist/ast/spanMap.d.ts.map +1 -1
- package/dist/ast/spanMap.js +21 -17
- package/dist/ast/spanMap.js.map +1 -1
- package/dist/ast/utils.d.ts +11 -2
- package/dist/ast/utils.d.ts.map +1 -1
- package/dist/ast/utils.js +45 -23
- package/dist/ast/utils.js.map +1 -1
- package/dist/ast/visitor.d.ts.map +1 -1
- package/dist/ast/visitor.js.map +1 -1
- package/dist/vscode/extensionApi.d.ts +2 -2
- package/dist/vscode/extensionApi.d.ts.map +1 -1
- package/dist/vscode/moduleLoader.d.ts.map +1 -1
- package/dist/vscode/moduleLoader.js +6 -1
- package/dist/vscode/moduleLoader.js.map +1 -1
- package/dist/wasm/transport.d.ts +1 -1
- package/dist/wasm/transport.d.ts.map +1 -1
- package/dist/wasm/transport.js +3 -2
- package/dist/wasm/transport.js.map +1 -1
- package/dist/wasm/wasi.d.ts +2 -4
- package/dist/wasm/wasi.d.ts.map +1 -1
- package/dist/wasm/wasi.js +6 -6
- package/dist/wasm/wasi.js.map +1 -1
- package/package.json +9 -9
package/dist/api/sync/api.js
CHANGED
|
@@ -21,10 +21,10 @@ import { SymbolOwnerKind } from "../../../enums/symbolOwnerKind.js";
|
|
|
21
21
|
import { TypeFlags } from "../../../enums/typeFlags.js";
|
|
22
22
|
import { TypeFormatFlags } from "../../../enums/typeFormatFlags.js";
|
|
23
23
|
import { TypePredicateKind } from "../../../enums/typePredicateKind.js";
|
|
24
|
-
import { ModifierFlags,
|
|
24
|
+
import { ModifierFlags, symbolName, } from "../../ast/index.js";
|
|
25
25
|
import { assertNever } from "../../internal/utils.js";
|
|
26
26
|
import { encodeNode, sourceFileResponseToUint8Array, uint8ArrayToBase64, } from "../node/encoder.js";
|
|
27
|
-
import { decodeNode, getNodeId, getNodeRequestHandle, parseNodeHandleFromCompiler,
|
|
27
|
+
import { decodeNode, getNodeId, getNodeRequestHandle, parseNodeHandleFromCompiler, readSourceFileLease, RemoteNode, RemoteSourceFile, } from "../node/node.js";
|
|
28
28
|
import { Wtf8Decoder } from "../node/wtf8.js";
|
|
29
29
|
import { canonicalize, CaseSensitivity, pathKey, toRootedDirectoryPath, toRootedPath, } from "../path.js";
|
|
30
30
|
import { prepareCompilerOptions } from "../prepareCompilerOptions.generated.js";
|
|
@@ -77,35 +77,35 @@ export class API {
|
|
|
77
77
|
this.debug = new DebugHandlers(this.client, this.ensureInitialized);
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
|
-
* Looks up a remote
|
|
80
|
+
* Looks up a remote node's binder symbol. Throws for synthesized or configuration ASTs.
|
|
81
81
|
*/
|
|
82
82
|
get getSymbol() {
|
|
83
83
|
const owner = this;
|
|
84
|
-
|
|
85
|
-
const file = getRemoteSourceFile(
|
|
84
|
+
function getSymbol(node) {
|
|
85
|
+
const file = getRemoteSourceFile(node);
|
|
86
86
|
if (!file)
|
|
87
87
|
throw new Error(`Source file not found for declaration`);
|
|
88
88
|
const record = file.symbolCache;
|
|
89
89
|
if (!record)
|
|
90
90
|
throw new Error(`Cached source file not found for declaration`);
|
|
91
|
-
const index = parseNodeHandleFromCompiler(getNodeId(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return cached;
|
|
91
|
+
const index = parseNodeHandleFromCompiler(getNodeId(node)).index;
|
|
92
|
+
if (record.symbolsByDeclarationNodeIndex.has(index))
|
|
93
|
+
return record.symbolsByDeclarationNodeIndex.get(index);
|
|
95
94
|
return owner.fetchDeclarationSymbol(record, index);
|
|
96
|
-
}
|
|
97
|
-
|
|
95
|
+
}
|
|
96
|
+
function* gen(node) {
|
|
97
|
+
const file = getRemoteSourceFile(node);
|
|
98
98
|
if (!file)
|
|
99
99
|
throw new Error(`Source file not found for declaration`);
|
|
100
100
|
const record = file.symbolCache;
|
|
101
101
|
if (!record)
|
|
102
102
|
throw new Error(`Cached source file not found for declaration`);
|
|
103
|
-
const index = parseNodeHandleFromCompiler(getNodeId(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return cached;
|
|
103
|
+
const index = parseNodeHandleFromCompiler(getNodeId(node)).index;
|
|
104
|
+
if (record.symbolsByDeclarationNodeIndex.has(index))
|
|
105
|
+
return record.symbolsByDeclarationNodeIndex.get(index);
|
|
107
106
|
return yield* owner.fetchDeclarationSymbol.gen(record, index);
|
|
108
|
-
}
|
|
107
|
+
}
|
|
108
|
+
return cacheGeneratorMethod(owner, "getSymbol", getSymbol, gen);
|
|
109
109
|
}
|
|
110
110
|
get fetchDeclarationSymbol() {
|
|
111
111
|
const owner = this;
|
|
@@ -114,6 +114,10 @@ export class API {
|
|
|
114
114
|
file: record.descriptor,
|
|
115
115
|
index,
|
|
116
116
|
});
|
|
117
|
+
if (!data) {
|
|
118
|
+
record.symbolsByDeclarationNodeIndex.set(index, undefined);
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
|
117
121
|
validateSymbolResponse(data);
|
|
118
122
|
const reference = data.reference;
|
|
119
123
|
if (reference.kind !== SymbolOwnerKind.File) {
|
|
@@ -128,6 +132,10 @@ export class API {
|
|
|
128
132
|
file: record.descriptor,
|
|
129
133
|
index,
|
|
130
134
|
});
|
|
135
|
+
if (!data) {
|
|
136
|
+
record.symbolsByDeclarationNodeIndex.set(index, undefined);
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
131
139
|
validateSymbolResponse(data);
|
|
132
140
|
const reference = data.reference;
|
|
133
141
|
if (reference.kind !== SymbolOwnerKind.File) {
|
|
@@ -174,7 +182,8 @@ export class API {
|
|
|
174
182
|
const owner = this;
|
|
175
183
|
return cacheGeneratorMethod(owner, "initializeWorker", function () {
|
|
176
184
|
try {
|
|
177
|
-
|
|
185
|
+
// eslint-disable-next-line no-restricted-syntax -- The initialize request requires null parameters.
|
|
186
|
+
const response = owner.client.apiRequest("initialize", /*params*/ null);
|
|
178
187
|
owner.currentDirectory = response.currentDirectory;
|
|
179
188
|
owner.caseSensitivity = response.caseSensitivity;
|
|
180
189
|
owner.toPath = (fileName, basePath = response.currentDirectory) => pathKey(toRootedPath(fileName, toRootedDirectoryPath(basePath, response.currentDirectory)), response.caseSensitivity);
|
|
@@ -186,6 +195,7 @@ export class API {
|
|
|
186
195
|
}
|
|
187
196
|
}, function* () {
|
|
188
197
|
try {
|
|
198
|
+
// eslint-disable-next-line no-restricted-syntax -- The initialize request requires null parameters.
|
|
189
199
|
const response = yield* apiRequest("initialize", null);
|
|
190
200
|
owner.currentDirectory = response.currentDirectory;
|
|
191
201
|
owner.caseSensitivity = response.caseSensitivity;
|
|
@@ -251,6 +261,49 @@ export class API {
|
|
|
251
261
|
return orchestrator;
|
|
252
262
|
});
|
|
253
263
|
}
|
|
264
|
+
/** Gets the compiler's default formatting settings, independent of snapshot preferences. */
|
|
265
|
+
get getDefaultFormatCodeSettings() {
|
|
266
|
+
const owner = this;
|
|
267
|
+
return cacheGeneratorMethod(owner, "getDefaultFormatCodeSettings", function () {
|
|
268
|
+
owner.ensureInitialized();
|
|
269
|
+
// eslint-disable-next-line no-restricted-syntax -- The getDefaultFormatCodeSettings request requires null parameters.
|
|
270
|
+
return owner.client.apiRequest("getDefaultFormatCodeSettings", /*params*/ null);
|
|
271
|
+
}, function* () {
|
|
272
|
+
yield* owner.ensureInitialized.gen();
|
|
273
|
+
// eslint-disable-next-line no-restricted-syntax -- The getDefaultFormatCodeSettings request requires null parameters.
|
|
274
|
+
return yield* apiRequest("getDefaultFormatCodeSettings", null);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/** Returns configured type roots or ancestor node_modules/@types candidates, without checking directory existence. */
|
|
278
|
+
get getEffectiveTypeRoots() {
|
|
279
|
+
const owner = this;
|
|
280
|
+
return cacheGeneratorMethod(owner, "getEffectiveTypeRoots", function (compilerOptions) {
|
|
281
|
+
owner.ensureInitialized();
|
|
282
|
+
return owner.client.apiRequest("getEffectiveTypeRoots", {
|
|
283
|
+
compilerOptions: prepareCompilerOptions(compilerOptions, owner.getCurrentDirectory()),
|
|
284
|
+
});
|
|
285
|
+
}, function* (compilerOptions) {
|
|
286
|
+
yield* owner.ensureInitialized.gen();
|
|
287
|
+
return yield* apiRequest("getEffectiveTypeRoots", {
|
|
288
|
+
compilerOptions: prepareCompilerOptions(compilerOptions, owner.getCurrentDirectory()),
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/** Returns the native build-info output path, or undefined when the options do not produce one. */
|
|
293
|
+
get getTsBuildInfoEmitOutputFilePath() {
|
|
294
|
+
const owner = this;
|
|
295
|
+
return cacheGeneratorMethod(owner, "getTsBuildInfoEmitOutputFilePath", function (compilerOptions) {
|
|
296
|
+
owner.ensureInitialized();
|
|
297
|
+
return (owner.client.apiRequest("getTsBuildInfoEmitOutputFilePath", {
|
|
298
|
+
compilerOptions: prepareCompilerOptions(compilerOptions, owner.getCurrentDirectory()),
|
|
299
|
+
})) ?? undefined;
|
|
300
|
+
}, function* (compilerOptions) {
|
|
301
|
+
yield* owner.ensureInitialized.gen();
|
|
302
|
+
return (yield* apiRequest("getTsBuildInfoEmitOutputFilePath", {
|
|
303
|
+
compilerOptions: prepareCompilerOptions(compilerOptions, owner.getCurrentDirectory()),
|
|
304
|
+
})) ?? undefined;
|
|
305
|
+
});
|
|
306
|
+
}
|
|
254
307
|
get parseConfigFile() {
|
|
255
308
|
const owner = this;
|
|
256
309
|
return cacheGeneratorMethod(owner, "parseConfigFile", function (file) {
|
|
@@ -447,7 +500,8 @@ export class API {
|
|
|
447
500
|
const snapshot = new Snapshot(data, owner.toPath, owner, () => {
|
|
448
501
|
owner.activeSnapshots.delete(snapshot.id);
|
|
449
502
|
owner.sourceFileCache.releaseSnapshot(snapshot.id);
|
|
450
|
-
}, owner.createSnapshotUpdater(() => snapshot),
|
|
503
|
+
}, owner.createSnapshotUpdater(() => snapshot),
|
|
504
|
+
/*baseSnapshot*/ undefined);
|
|
451
505
|
owner.activeSnapshots.set(snapshot.id, snapshot);
|
|
452
506
|
return snapshot;
|
|
453
507
|
}
|
|
@@ -458,7 +512,8 @@ export class API {
|
|
|
458
512
|
const snapshot = new Snapshot(data, owner.toPath, owner, () => {
|
|
459
513
|
owner.activeSnapshots.delete(snapshot.id);
|
|
460
514
|
owner.sourceFileCache.releaseSnapshot(snapshot.id);
|
|
461
|
-
}, owner.createSnapshotUpdater(() => snapshot),
|
|
515
|
+
}, owner.createSnapshotUpdater(() => snapshot),
|
|
516
|
+
/*baseSnapshot*/ undefined);
|
|
462
517
|
owner.activeSnapshots.set(snapshot.id, snapshot);
|
|
463
518
|
return snapshot;
|
|
464
519
|
}
|
|
@@ -815,19 +870,19 @@ function getNodeAPI(node) {
|
|
|
815
870
|
throw new Error("Source file does not belong to the sync API");
|
|
816
871
|
return api;
|
|
817
872
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
const api = getNodeAPI(declaration);
|
|
873
|
+
export function getSymbol(node) {
|
|
874
|
+
const api = getNodeAPI(node);
|
|
821
875
|
if (!api)
|
|
822
876
|
throw new Error("Source file not found for declaration");
|
|
823
|
-
return api.getSymbol(
|
|
877
|
+
return api.getSymbol(node);
|
|
824
878
|
}
|
|
825
|
-
|
|
826
|
-
const api = getNodeAPI(
|
|
879
|
+
function* getSymbolGenerator(node) {
|
|
880
|
+
const api = getNodeAPI(node);
|
|
827
881
|
if (!api)
|
|
828
882
|
throw new Error("Source file not found for declaration");
|
|
829
|
-
return yield* api.getSymbol.gen(
|
|
830
|
-
}
|
|
883
|
+
return yield* api.getSymbol.gen(node);
|
|
884
|
+
}
|
|
885
|
+
getSymbol.gen = getSymbolGenerator;
|
|
831
886
|
/** An independently retained source file and its disposable remote-lifetime lease. */
|
|
832
887
|
export class RetainedSourceFile {
|
|
833
888
|
sourceFile;
|
|
@@ -903,10 +958,12 @@ export class DebugHandlers {
|
|
|
903
958
|
const owner = this;
|
|
904
959
|
return cacheGeneratorMethod(owner, "stopCPUProfile", function () {
|
|
905
960
|
owner.ensureInitialized();
|
|
906
|
-
|
|
961
|
+
// eslint-disable-next-line no-restricted-syntax -- The stopCPUProfile request requires null parameters.
|
|
962
|
+
const result = owner.client.apiRequest("stopCPUProfile", /*params*/ null);
|
|
907
963
|
return result.file;
|
|
908
964
|
}, function* () {
|
|
909
965
|
yield* owner.ensureInitialized.gen();
|
|
966
|
+
// eslint-disable-next-line no-restricted-syntax -- The stopCPUProfile request requires null parameters.
|
|
910
967
|
const result = yield* apiRequest("stopCPUProfile", null);
|
|
911
968
|
return result.file;
|
|
912
969
|
});
|
|
@@ -1127,6 +1184,37 @@ export class ModuleResolver {
|
|
|
1127
1184
|
});
|
|
1128
1185
|
});
|
|
1129
1186
|
}
|
|
1187
|
+
/** Resolves a type directive using this resolver's options and the selected snapshot or live filesystem. */
|
|
1188
|
+
get resolveTypeReferenceDirective() {
|
|
1189
|
+
const owner = this;
|
|
1190
|
+
return cacheGeneratorMethod(owner, "resolveTypeReferenceDirective", function (typeReferenceDirectiveName, containingFile, resolutionMode, options) {
|
|
1191
|
+
owner.ensureNotDisposed();
|
|
1192
|
+
if (options?.snapshot instanceof Snapshot && options.snapshot.isDisposed()) {
|
|
1193
|
+
throw new Error("Snapshot is disposed");
|
|
1194
|
+
}
|
|
1195
|
+
return owner.client.apiRequest("resolveTypeReferenceDirective", {
|
|
1196
|
+
snapshot: options?.snapshot instanceof Snapshot ? options.snapshot.id : undefined,
|
|
1197
|
+
inProgressSnapshot: typeof options?.snapshot === "number" ? -options.snapshot : undefined,
|
|
1198
|
+
resolver: owner.id,
|
|
1199
|
+
typeReferenceDirectiveName,
|
|
1200
|
+
containingFile,
|
|
1201
|
+
resolutionMode,
|
|
1202
|
+
});
|
|
1203
|
+
}, function* (typeReferenceDirectiveName, containingFile, resolutionMode, options) {
|
|
1204
|
+
owner.ensureNotDisposed();
|
|
1205
|
+
if (options?.snapshot instanceof Snapshot && options.snapshot.isDisposed()) {
|
|
1206
|
+
throw new Error("Snapshot is disposed");
|
|
1207
|
+
}
|
|
1208
|
+
return yield* apiRequest("resolveTypeReferenceDirective", {
|
|
1209
|
+
snapshot: options?.snapshot instanceof Snapshot ? options.snapshot.id : undefined,
|
|
1210
|
+
inProgressSnapshot: typeof options?.snapshot === "number" ? -options.snapshot : undefined,
|
|
1211
|
+
resolver: owner.id,
|
|
1212
|
+
typeReferenceDirectiveName,
|
|
1213
|
+
containingFile,
|
|
1214
|
+
resolutionMode,
|
|
1215
|
+
});
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1130
1218
|
[globalThis.Symbol.dispose]() {
|
|
1131
1219
|
return this.dispose();
|
|
1132
1220
|
}
|
|
@@ -1418,7 +1506,7 @@ class ProjectObjectRegistry {
|
|
|
1418
1506
|
project: owner.project.handle,
|
|
1419
1507
|
objectId: source.id,
|
|
1420
1508
|
});
|
|
1421
|
-
if (typesData ==
|
|
1509
|
+
if (typesData == undefined)
|
|
1422
1510
|
return [];
|
|
1423
1511
|
else
|
|
1424
1512
|
return typesData.map(data => owner.getOrCreateType(data));
|
|
@@ -1442,7 +1530,7 @@ class ProjectObjectRegistry {
|
|
|
1442
1530
|
project: owner.project.handle,
|
|
1443
1531
|
objectId: source.id,
|
|
1444
1532
|
});
|
|
1445
|
-
if (typesData ==
|
|
1533
|
+
if (typesData == undefined)
|
|
1446
1534
|
return [];
|
|
1447
1535
|
else
|
|
1448
1536
|
return typesData.map(data => owner.getOrCreateType(data));
|
|
@@ -1510,7 +1598,7 @@ class ProjectObjectRegistry {
|
|
|
1510
1598
|
project: owner.project.handle,
|
|
1511
1599
|
type: source.id,
|
|
1512
1600
|
});
|
|
1513
|
-
if (typesData ==
|
|
1601
|
+
if (typesData == undefined)
|
|
1514
1602
|
return [];
|
|
1515
1603
|
return typesData.map(data => owner.getOrCreateType(data));
|
|
1516
1604
|
}, function* (source) {
|
|
@@ -1519,7 +1607,7 @@ class ProjectObjectRegistry {
|
|
|
1519
1607
|
project: owner.project.handle,
|
|
1520
1608
|
type: source.id,
|
|
1521
1609
|
});
|
|
1522
|
-
if (typesData ==
|
|
1610
|
+
if (typesData == undefined)
|
|
1523
1611
|
return [];
|
|
1524
1612
|
return typesData.map(data => owner.getOrCreateType(data));
|
|
1525
1613
|
});
|
|
@@ -2324,7 +2412,7 @@ export class Program {
|
|
|
2324
2412
|
if (!binaryData) {
|
|
2325
2413
|
return undefined;
|
|
2326
2414
|
}
|
|
2327
|
-
return new RemoteSourceFile(binaryData, owner.decoder, undefined, owner.project.api);
|
|
2415
|
+
return new RemoteSourceFile(binaryData, owner.decoder, /*timing*/ undefined, owner.project.api);
|
|
2328
2416
|
}, function* (file) {
|
|
2329
2417
|
const binaryData = sourceFileResponseToUint8Array(yield* apiRequest("getConfigSourceFile", {
|
|
2330
2418
|
snapshot: owner.snapshotId,
|
|
@@ -2334,7 +2422,7 @@ export class Program {
|
|
|
2334
2422
|
if (!binaryData) {
|
|
2335
2423
|
return undefined;
|
|
2336
2424
|
}
|
|
2337
|
-
return new RemoteSourceFile(binaryData, owner.decoder, undefined, owner.project.api);
|
|
2425
|
+
return new RemoteSourceFile(binaryData, owner.decoder, /*timing*/ undefined, owner.project.api);
|
|
2338
2426
|
});
|
|
2339
2427
|
}
|
|
2340
2428
|
/**
|
|
@@ -2800,6 +2888,9 @@ function encodeNumberLiteralValue(value) {
|
|
|
2800
2888
|
return "NaN";
|
|
2801
2889
|
return value;
|
|
2802
2890
|
}
|
|
2891
|
+
function isNodeLocation(location) {
|
|
2892
|
+
return !!location.kind;
|
|
2893
|
+
}
|
|
2803
2894
|
export class Checker {
|
|
2804
2895
|
/** Get the original symbols underlying a synthetic, instantiated, or mapped property. */
|
|
2805
2896
|
get getRootSymbols() {
|
|
@@ -3342,7 +3433,7 @@ export class Checker {
|
|
|
3342
3433
|
const owner = this;
|
|
3343
3434
|
return cacheGeneratorMethod(owner, "resolveName", function (name, meaning, location, excludeGlobals) {
|
|
3344
3435
|
// Distinguish Node (has `kind`) from DocumentPosition (has `document` and `position`)
|
|
3345
|
-
const isNode = location &&
|
|
3436
|
+
const isNode = location && isNodeLocation(location);
|
|
3346
3437
|
const data = owner.client.apiRequest("resolveName", {
|
|
3347
3438
|
snapshot: owner.snapshotId,
|
|
3348
3439
|
project: owner.project.handle,
|
|
@@ -3356,7 +3447,7 @@ export class Checker {
|
|
|
3356
3447
|
return data ? owner.objectRegistry.getOrCreateSymbol(data) : undefined;
|
|
3357
3448
|
}, function* (name, meaning, location, excludeGlobals) {
|
|
3358
3449
|
// Distinguish Node (has `kind`) from DocumentPosition (has `document` and `position`)
|
|
3359
|
-
const isNode = location &&
|
|
3450
|
+
const isNode = location && isNodeLocation(location);
|
|
3360
3451
|
const data = yield* apiRequest("resolveName", {
|
|
3361
3452
|
snapshot: owner.snapshotId,
|
|
3362
3453
|
project: owner.project.handle,
|
|
@@ -3377,7 +3468,7 @@ export class Checker {
|
|
|
3377
3468
|
const owner = this;
|
|
3378
3469
|
return cacheGeneratorMethod(owner, "getSymbolsInScope", function (location, meaning) {
|
|
3379
3470
|
// Distinguish Node (has `kind`) from DocumentPosition (has `document` and `position`)
|
|
3380
|
-
const isNode =
|
|
3471
|
+
const isNode = isNodeLocation(location);
|
|
3381
3472
|
const data = owner.client.apiRequest("getSymbolsInScope", {
|
|
3382
3473
|
snapshot: owner.snapshotId,
|
|
3383
3474
|
project: owner.project.handle,
|
|
@@ -3389,7 +3480,7 @@ export class Checker {
|
|
|
3389
3480
|
return data ? data.map(d => owner.objectRegistry.getOrCreateSymbol(d)) : [];
|
|
3390
3481
|
}, function* (location, meaning) {
|
|
3391
3482
|
// Distinguish Node (has `kind`) from DocumentPosition (has `document` and `position`)
|
|
3392
|
-
const isNode =
|
|
3483
|
+
const isNode = isNodeLocation(location);
|
|
3393
3484
|
const data = yield* apiRequest("getSymbolsInScope", {
|
|
3394
3485
|
snapshot: owner.snapshotId,
|
|
3395
3486
|
project: owner.project.handle,
|
|
@@ -5066,7 +5157,7 @@ export class Symbol {
|
|
|
5066
5157
|
}
|
|
5067
5158
|
/** The escaped (`__String`) name, used as the key in member/export tables. */
|
|
5068
5159
|
escapedName;
|
|
5069
|
-
/** The display name
|
|
5160
|
+
/** The display name, including the source spelling of private identifiers. */
|
|
5070
5161
|
name;
|
|
5071
5162
|
flags;
|
|
5072
5163
|
checkFlags;
|
|
@@ -5087,7 +5178,7 @@ export class Symbol {
|
|
|
5087
5178
|
this.storage = storage;
|
|
5088
5179
|
this.reference = data.reference;
|
|
5089
5180
|
this.escapedName = data.name;
|
|
5090
|
-
this.name =
|
|
5181
|
+
this.name = symbolName(this);
|
|
5091
5182
|
this.flags = data.flags;
|
|
5092
5183
|
this.checkFlags = data.checkFlags ?? 0;
|
|
5093
5184
|
this.declarationHandles = data.declarations;
|
|
@@ -5112,7 +5203,7 @@ export class Symbol {
|
|
|
5112
5203
|
// A file-owned symbol has no canonical project; its declarations resolve through its file.
|
|
5113
5204
|
return this.storage.kind === SymbolOwnerKind.Snapshot
|
|
5114
5205
|
? this.storage.registry.createNodeHandle(handle)
|
|
5115
|
-
: new NodeHandle(handle, undefined, this.storage.owner);
|
|
5206
|
+
: new NodeHandle(handle, /*canonicalProject*/ undefined, this.storage.owner);
|
|
5116
5207
|
}
|
|
5117
5208
|
get getParent() {
|
|
5118
5209
|
const owner = this;
|
|
@@ -5316,10 +5407,11 @@ class TypeObject {
|
|
|
5316
5407
|
this.objectFlags = data.objectFlags ?? 0;
|
|
5317
5408
|
if (data.symbol !== undefined)
|
|
5318
5409
|
this.symbol = data.symbol;
|
|
5319
|
-
|
|
5410
|
+
const typeValue = data.value;
|
|
5411
|
+
if (typeValue != undefined) {
|
|
5320
5412
|
// BigInt literal values are serialized as decimal strings (e.g. "-123") because
|
|
5321
5413
|
// JSON cannot represent bigint. Decode them back into a real bigint here.
|
|
5322
|
-
const value =
|
|
5414
|
+
const value = typeValue;
|
|
5323
5415
|
if (data.flags & TypeFlags.BigIntLiteral) {
|
|
5324
5416
|
this.value = BigInt(value);
|
|
5325
5417
|
}
|
|
@@ -5662,7 +5754,7 @@ class TypeObject {
|
|
|
5662
5754
|
return cacheGeneratorMethod(owner, "getThisType", function () {
|
|
5663
5755
|
return owner.objectRegistry.fetchOptionalType(owner, "getThisTypeOfType", owner.thisType);
|
|
5664
5756
|
}, function* () {
|
|
5665
|
-
return
|
|
5757
|
+
return yield* owner.objectRegistry.fetchOptionalType.gen(owner, "getThisTypeOfType", owner.thisType);
|
|
5666
5758
|
});
|
|
5667
5759
|
}
|
|
5668
5760
|
get getAliasTypeArguments() {
|