typescript 7.1.0-dev.20261008.1 → 7.1.0-dev.20261009.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 +16 -53
- package/dist/api/async/api.d.ts.map +1 -1
- package/dist/api/async/api.js +35 -79
- package/dist/api/async/api.js.map +1 -1
- package/dist/api/node/node.d.ts +0 -7
- package/dist/api/node/node.d.ts.map +1 -1
- package/dist/api/node/node.js +0 -1
- package/dist/api/node/node.js.map +1 -1
- package/dist/api/path.d.ts +0 -29
- package/dist/api/path.d.ts.map +1 -1
- package/dist/api/proto.d.ts +1 -16
- package/dist/api/proto.d.ts.map +1 -1
- package/dist/api/proto.generated.d.ts +12 -16
- package/dist/api/proto.generated.d.ts.map +1 -1
- package/dist/api/proto.js +0 -15
- package/dist/api/proto.js.map +1 -1
- package/dist/api/sync/api.d.ts +19 -74
- package/dist/api/sync/api.d.ts.map +1 -1
- package/dist/api/sync/api.js +50 -126
- package/dist/api/sync/api.js.map +1 -1
- package/dist/ast/ast.d.ts +1 -4
- package/dist/ast/ast.d.ts.map +1 -1
- package/dist/ast/ast.js +1 -0
- package/dist/ast/ast.js.map +1 -1
- package/dist/ast/astnav.d.ts +0 -2
- package/dist/ast/astnav.d.ts.map +1 -1
- package/dist/ast/factory.generated.d.ts +0 -159
- package/dist/ast/factory.generated.d.ts.map +1 -1
- package/dist/ast/factory.generated.js +1 -0
- package/dist/ast/factory.generated.js.map +1 -1
- package/dist/ast/is.d.ts +1 -12
- package/dist/ast/is.d.ts.map +1 -1
- package/dist/vscode/extensionApi.d.ts +12 -12
- package/dist/vscode/extensionApi.d.ts.map +1 -1
- package/package.json +22 -22
package/dist/api/sync/api.js
CHANGED
|
@@ -26,7 +26,7 @@ import { decodeNode, getNodeId, parseNodeHandleFromCompiler, readParseOptionsKey
|
|
|
26
26
|
import { Wtf8Decoder } from "../node/wtf8.js";
|
|
27
27
|
import { canonicalize, CaseSensitivity, pathKey, toRootedDirectoryPath, toRootedPath, } from "../path.js";
|
|
28
28
|
import { prepareCompilerOptions } from "../prepareCompilerOptions.generated.js";
|
|
29
|
-
import { resolveFileName,
|
|
29
|
+
import { resolveFileName, validateSymbolResponse, } from "../proto.js";
|
|
30
30
|
import { SourceFileCache, } from "../sourceFileCache.js";
|
|
31
31
|
import { Client, } from "./client.js";
|
|
32
32
|
export { formatDiagnostics, formatDiagnosticsWithColorAndContext } from "../diagnosticFormatter.js";
|
|
@@ -66,12 +66,12 @@ export class API {
|
|
|
66
66
|
activeBuildOrchestrators = new Set();
|
|
67
67
|
activeSourceFileLeases = new Map();
|
|
68
68
|
printer;
|
|
69
|
-
|
|
69
|
+
debug;
|
|
70
70
|
constructor(options = {}) {
|
|
71
71
|
this.client = new Client(options);
|
|
72
72
|
this.sourceFileCache = new SourceFileCache();
|
|
73
73
|
this.printer = new Printer(this.client);
|
|
74
|
-
this.
|
|
74
|
+
this.debug = new DebugHandlers(this.client, this.ensureInitialized);
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
77
|
* Looks up a remote declaration's binder symbol. Throws for synthesized or configuration ASTs.
|
|
@@ -213,6 +213,7 @@ export class API {
|
|
|
213
213
|
getNewLine() {
|
|
214
214
|
return "\n";
|
|
215
215
|
}
|
|
216
|
+
/** @internal */
|
|
216
217
|
get createBuildOrchestrator() {
|
|
217
218
|
const owner = this;
|
|
218
219
|
return cacheGeneratorMethod(owner, "createBuildOrchestrator", function (rootNames, buildOrchestratorOptions) {
|
|
@@ -428,7 +429,7 @@ export class API {
|
|
|
428
429
|
const owner = this;
|
|
429
430
|
function createSnapshot(params) {
|
|
430
431
|
owner.ensureInitialized();
|
|
431
|
-
const requestParams =
|
|
432
|
+
const requestParams = owner.prepareCreateSnapshotParams(params);
|
|
432
433
|
const data = owner.client.apiRequest("createSnapshot", requestParams);
|
|
433
434
|
const snapshot = new Snapshot(data, owner.toPath, owner, () => {
|
|
434
435
|
owner.activeSnapshots.delete(snapshot.id);
|
|
@@ -439,7 +440,7 @@ export class API {
|
|
|
439
440
|
}
|
|
440
441
|
function* gen(params) {
|
|
441
442
|
yield* owner.ensureInitialized.gen();
|
|
442
|
-
const requestParams =
|
|
443
|
+
const requestParams = owner.prepareCreateSnapshotParams(params);
|
|
443
444
|
const data = yield* apiRequest("createSnapshot", requestParams);
|
|
444
445
|
const snapshot = new Snapshot(data, owner.toPath, owner, () => {
|
|
445
446
|
owner.activeSnapshots.delete(snapshot.id);
|
|
@@ -459,7 +460,7 @@ export class API {
|
|
|
459
460
|
}
|
|
460
461
|
const data = owner.client.apiRequest("updateSnapshot", {
|
|
461
462
|
snapshot: baseSnapshot.id,
|
|
462
|
-
changes:
|
|
463
|
+
changes: owner.prepareCreateSnapshotParams(params),
|
|
463
464
|
});
|
|
464
465
|
if (data.snapshot === baseSnapshot.id) {
|
|
465
466
|
owner.client.apiRequest("release", { snapshot: data.snapshot });
|
|
@@ -479,7 +480,7 @@ export class API {
|
|
|
479
480
|
}
|
|
480
481
|
const data = yield* apiRequest("updateSnapshot", {
|
|
481
482
|
snapshot: baseSnapshot.id,
|
|
482
|
-
changes:
|
|
483
|
+
changes: owner.prepareCreateSnapshotParams(params),
|
|
483
484
|
});
|
|
484
485
|
if (data.snapshot === baseSnapshot.id) {
|
|
485
486
|
yield* apiRequest("release", { snapshot: data.snapshot });
|
|
@@ -495,8 +496,7 @@ export class API {
|
|
|
495
496
|
});
|
|
496
497
|
}
|
|
497
498
|
prepareCreateSnapshotParams(params) {
|
|
498
|
-
|
|
499
|
-
return undefined;
|
|
499
|
+
params ??= {};
|
|
500
500
|
const prepareOptions = (options) => {
|
|
501
501
|
if (!options)
|
|
502
502
|
return undefined;
|
|
@@ -777,8 +777,12 @@ function sourceFileDescriptor(sourceFile) {
|
|
|
777
777
|
nodeId: sourceFile.nodeId,
|
|
778
778
|
};
|
|
779
779
|
}
|
|
780
|
+
/** Returns whether a node is backed by a remote compiler response. */
|
|
781
|
+
export function isRemoteNode(node) {
|
|
782
|
+
return node instanceof RemoteNode;
|
|
783
|
+
}
|
|
780
784
|
function getRemoteSourceFile(node) {
|
|
781
|
-
if (!(node
|
|
785
|
+
if (!isRemoteNode(node))
|
|
782
786
|
return undefined;
|
|
783
787
|
const file = node.getSourceFile();
|
|
784
788
|
return file instanceof RemoteSourceFile && file.api ? file : undefined;
|
|
@@ -858,10 +862,9 @@ export class RetainedSourceFile {
|
|
|
858
862
|
});
|
|
859
863
|
}
|
|
860
864
|
}
|
|
861
|
-
export class
|
|
865
|
+
export class DebugHandlers {
|
|
862
866
|
client;
|
|
863
867
|
ensureInitialized;
|
|
864
|
-
/** @internal */
|
|
865
868
|
constructor(client, ensureInitialized) {
|
|
866
869
|
this.client = client;
|
|
867
870
|
this.ensureInitialized = ensureInitialized;
|
|
@@ -913,7 +916,6 @@ export class Snapshot {
|
|
|
913
916
|
snapshotRegistry;
|
|
914
917
|
projectDataMap;
|
|
915
918
|
updateSnapshot;
|
|
916
|
-
internal;
|
|
917
919
|
get client() {
|
|
918
920
|
return this.api.client;
|
|
919
921
|
}
|
|
@@ -941,7 +943,6 @@ export class Snapshot {
|
|
|
941
943
|
createdPrograms: data.operation.createdPrograms?.map(projectId => this.requireProject(projectId).program),
|
|
942
944
|
openedFiles: data.operation.openedFiles?.map(result => ({ project: this.requireProject(result.project) })),
|
|
943
945
|
};
|
|
944
|
-
this.internal = new SnapshotInternalAPI(this.id, api.client);
|
|
945
946
|
}
|
|
946
947
|
getProjects() {
|
|
947
948
|
this.ensureNotDisposed();
|
|
@@ -1621,14 +1622,9 @@ export class Project {
|
|
|
1621
1622
|
currentDirectory;
|
|
1622
1623
|
dirty;
|
|
1623
1624
|
parsedCommandLine;
|
|
1624
|
-
/** @deprecated Use `parsedCommandLine.options`. */
|
|
1625
|
-
compilerOptions;
|
|
1626
|
-
/** @deprecated Use `parsedCommandLine.fileNames`. */
|
|
1627
|
-
rootFiles;
|
|
1628
1625
|
program;
|
|
1629
1626
|
checker;
|
|
1630
1627
|
languageService;
|
|
1631
|
-
snapshotId;
|
|
1632
1628
|
constructor(data, snapshotId, toPath, api, snapshotRegistry) {
|
|
1633
1629
|
this.id = data.id;
|
|
1634
1630
|
this.api = api;
|
|
@@ -1639,32 +1635,11 @@ export class Project {
|
|
|
1639
1635
|
throw new Error(`Project '${data.configFileName}' has no parsed command line`);
|
|
1640
1636
|
}
|
|
1641
1637
|
this.parsedCommandLine = data.parsedCommandLine;
|
|
1642
|
-
this.compilerOptions = this.parsedCommandLine.options;
|
|
1643
|
-
this.rootFiles = this.parsedCommandLine.fileNames;
|
|
1644
|
-
this.snapshotId = snapshotId;
|
|
1645
1638
|
this.program = new Program(snapshotId, this, toPath);
|
|
1646
1639
|
const objectRegistry = new ProjectObjectRegistry(snapshotId, this, snapshotRegistry);
|
|
1647
1640
|
this.checker = new Checker(snapshotId, this, objectRegistry);
|
|
1648
1641
|
this.languageService = new LanguageService(snapshotId, this, objectRegistry);
|
|
1649
1642
|
}
|
|
1650
|
-
/** @deprecated Use `languageService.getImportAdderEdits`. */
|
|
1651
|
-
get getImportAdderEdits() {
|
|
1652
|
-
const owner = this;
|
|
1653
|
-
return cacheGeneratorMethod(owner, "getImportAdderEdits", function (file, actions) {
|
|
1654
|
-
return owner.languageService.getImportAdderEdits(file, actions);
|
|
1655
|
-
}, function* (file, actions) {
|
|
1656
|
-
return yield* owner.languageService.getImportAdderEdits.gen(file, actions);
|
|
1657
|
-
});
|
|
1658
|
-
}
|
|
1659
|
-
/** @deprecated Use `languageService.getImportEditsForSymbols`. */
|
|
1660
|
-
get getImportEditsForSymbols() {
|
|
1661
|
-
const owner = this;
|
|
1662
|
-
return cacheGeneratorMethod(owner, "getImportEditsForSymbols", function (file, symbols, options = {}) {
|
|
1663
|
-
return owner.languageService.getImportEditsForSymbols(file, symbols, options);
|
|
1664
|
-
}, function* (file, symbols, options = {}) {
|
|
1665
|
-
return yield* owner.languageService.getImportEditsForSymbols.gen(file, symbols, options);
|
|
1666
|
-
});
|
|
1667
|
-
}
|
|
1668
1643
|
dispose() {
|
|
1669
1644
|
this.checker.dispose();
|
|
1670
1645
|
}
|
|
@@ -1855,6 +1830,39 @@ export class LanguageService {
|
|
|
1855
1830
|
};
|
|
1856
1831
|
});
|
|
1857
1832
|
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Format a synthesized node with the correct indentation for insertion at a
|
|
1835
|
+
* specific position in an existing source file.
|
|
1836
|
+
*
|
|
1837
|
+
* @param node The synthesized AST node to format.
|
|
1838
|
+
* @param file The target file where the node will be inserted.
|
|
1839
|
+
* @param position The UTF-16 code-unit offset in the target file for insertion.
|
|
1840
|
+
* @returns The formatted text of the node, indented for the insertion position.
|
|
1841
|
+
*/
|
|
1842
|
+
get formatNodeForInsertion() {
|
|
1843
|
+
const owner = this;
|
|
1844
|
+
return cacheGeneratorMethod(owner, "formatNodeForInsertion", function (node, file, position) {
|
|
1845
|
+
const encoded = encodeNode(node);
|
|
1846
|
+
const base64 = uint8ArrayToBase64(encoded);
|
|
1847
|
+
return owner.client.apiRequest("formatNodeForInsertion", {
|
|
1848
|
+
snapshot: owner.snapshotId,
|
|
1849
|
+
project: owner.project.id,
|
|
1850
|
+
file,
|
|
1851
|
+
position,
|
|
1852
|
+
data: base64,
|
|
1853
|
+
});
|
|
1854
|
+
}, function* (node, file, position) {
|
|
1855
|
+
const encoded = encodeNode(node);
|
|
1856
|
+
const base64 = uint8ArrayToBase64(encoded);
|
|
1857
|
+
return yield* apiRequest("formatNodeForInsertion", {
|
|
1858
|
+
snapshot: owner.snapshotId,
|
|
1859
|
+
project: owner.project.id,
|
|
1860
|
+
file,
|
|
1861
|
+
position,
|
|
1862
|
+
data: base64,
|
|
1863
|
+
});
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1858
1866
|
}
|
|
1859
1867
|
export class Program {
|
|
1860
1868
|
/** @internal */
|
|
@@ -1885,7 +1893,7 @@ export class Program {
|
|
|
1885
1893
|
return this.project.api.getCanonicalFileName(fileName);
|
|
1886
1894
|
}
|
|
1887
1895
|
getNewLine() {
|
|
1888
|
-
return this.project.
|
|
1896
|
+
return this.project.parsedCommandLine.options.newLine === NewLineKind.CRLF ? "\r\n" : "\n";
|
|
1889
1897
|
}
|
|
1890
1898
|
/** @internal */
|
|
1891
1899
|
setOwnedSnapshot(snapshot) {
|
|
@@ -1917,7 +1925,7 @@ export class Program {
|
|
|
1917
1925
|
});
|
|
1918
1926
|
}
|
|
1919
1927
|
getCompilerOptions() {
|
|
1920
|
-
return this.project.
|
|
1928
|
+
return this.project.parsedCommandLine.options;
|
|
1921
1929
|
}
|
|
1922
1930
|
get getSourceFile() {
|
|
1923
1931
|
const owner = this;
|
|
@@ -1933,8 +1941,6 @@ export class Program {
|
|
|
1933
1941
|
}
|
|
1934
1942
|
/**
|
|
1935
1943
|
* Returns the source file for an already-canonical path.
|
|
1936
|
-
*
|
|
1937
|
-
* @internal
|
|
1938
1944
|
*/
|
|
1939
1945
|
get getSourceFileByPath() {
|
|
1940
1946
|
const owner = this;
|
|
@@ -3035,33 +3041,6 @@ export class Checker {
|
|
|
3035
3041
|
return (data ?? []).map(h => new NodeHandle(h, owner.project));
|
|
3036
3042
|
});
|
|
3037
3043
|
}
|
|
3038
|
-
/** @deprecated Use `project.languageService.getReferencedSymbolsForNode`. */
|
|
3039
|
-
get getReferencedSymbolsForNode() {
|
|
3040
|
-
const owner = this;
|
|
3041
|
-
return cacheGeneratorMethod(owner, "getReferencedSymbolsForNode", function (node, position) {
|
|
3042
|
-
return owner.project.languageService.getReferencedSymbolsForNode(node, position);
|
|
3043
|
-
}, function* (node, position) {
|
|
3044
|
-
return yield* owner.project.languageService.getReferencedSymbolsForNode.gen(node, position);
|
|
3045
|
-
});
|
|
3046
|
-
}
|
|
3047
|
-
/** @deprecated Use `project.languageService.getSignatureUsage`. */
|
|
3048
|
-
get getSignatureUsage() {
|
|
3049
|
-
const owner = this;
|
|
3050
|
-
return cacheGeneratorMethod(owner, "getSignatureUsage", function (signatureDecl) {
|
|
3051
|
-
return owner.project.languageService.getSignatureUsage(signatureDecl);
|
|
3052
|
-
}, function* (signatureDecl) {
|
|
3053
|
-
return yield* owner.project.languageService.getSignatureUsage.gen(signatureDecl);
|
|
3054
|
-
});
|
|
3055
|
-
}
|
|
3056
|
-
/** @deprecated Use `project.languageService.getCompletionsAtPosition`. */
|
|
3057
|
-
get getCompletionsAtPosition() {
|
|
3058
|
-
const owner = this;
|
|
3059
|
-
return cacheGeneratorMethod(owner, "getCompletionsAtPosition", function (document, position, options) {
|
|
3060
|
-
return owner.project.languageService.getCompletionsAtPosition(document, position, options);
|
|
3061
|
-
}, function* (document, position, options) {
|
|
3062
|
-
return yield* owner.project.languageService.getCompletionsAtPosition.gen(document, position, options);
|
|
3063
|
-
});
|
|
3064
|
-
}
|
|
3065
3044
|
/**
|
|
3066
3045
|
* Get the type at a node location. Always returns a type; for nodes whose
|
|
3067
3046
|
* type cannot be determined the checker yields the error type (use
|
|
@@ -4383,61 +4362,6 @@ export class Printer {
|
|
|
4383
4362
|
});
|
|
4384
4363
|
}
|
|
4385
4364
|
}
|
|
4386
|
-
export class SnapshotInternalAPI {
|
|
4387
|
-
snapshotId;
|
|
4388
|
-
client;
|
|
4389
|
-
constructor(snapshotId, client) {
|
|
4390
|
-
this.snapshotId = snapshotId;
|
|
4391
|
-
this.client = client;
|
|
4392
|
-
}
|
|
4393
|
-
/**
|
|
4394
|
-
* Format a synthesized node with the correct indentation for insertion at a
|
|
4395
|
-
* specific position in an existing source file.
|
|
4396
|
-
*
|
|
4397
|
-
* @param node The synthesized AST node to format.
|
|
4398
|
-
* @param file The target file where the node will be inserted.
|
|
4399
|
-
* @param position The UTF-16 code-unit offset in the target file for insertion.
|
|
4400
|
-
* @returns The formatted text of the node, indented for the insertion position.
|
|
4401
|
-
*/
|
|
4402
|
-
get formatNodeForInsertion() {
|
|
4403
|
-
const owner = this;
|
|
4404
|
-
return cacheGeneratorMethod(owner, "formatNodeForInsertion", function (node, file, position) {
|
|
4405
|
-
const data = owner.client.apiRequest("getDefaultProjectForFile", {
|
|
4406
|
-
snapshot: owner.snapshotId,
|
|
4407
|
-
file,
|
|
4408
|
-
});
|
|
4409
|
-
if (!data) {
|
|
4410
|
-
throw new Error(`No project found for file: ${typeof file === "string" ? file : file.uri}`);
|
|
4411
|
-
}
|
|
4412
|
-
const encoded = encodeNode(node);
|
|
4413
|
-
const base64 = uint8ArrayToBase64(encoded);
|
|
4414
|
-
return owner.client.apiRequest("formatNodeForInsertion", {
|
|
4415
|
-
snapshot: owner.snapshotId,
|
|
4416
|
-
project: data.id,
|
|
4417
|
-
file,
|
|
4418
|
-
position,
|
|
4419
|
-
data: base64,
|
|
4420
|
-
});
|
|
4421
|
-
}, function* (node, file, position) {
|
|
4422
|
-
const data = yield* apiRequest("getDefaultProjectForFile", {
|
|
4423
|
-
snapshot: owner.snapshotId,
|
|
4424
|
-
file,
|
|
4425
|
-
});
|
|
4426
|
-
if (!data) {
|
|
4427
|
-
throw new Error(`No project found for file: ${typeof file === "string" ? file : file.uri}`);
|
|
4428
|
-
}
|
|
4429
|
-
const encoded = encodeNode(node);
|
|
4430
|
-
const base64 = uint8ArrayToBase64(encoded);
|
|
4431
|
-
return yield* apiRequest("formatNodeForInsertion", {
|
|
4432
|
-
snapshot: owner.snapshotId,
|
|
4433
|
-
project: data.id,
|
|
4434
|
-
file,
|
|
4435
|
-
position,
|
|
4436
|
-
data: base64,
|
|
4437
|
-
});
|
|
4438
|
-
});
|
|
4439
|
-
}
|
|
4440
|
-
}
|
|
4441
4365
|
export class NodeHandle {
|
|
4442
4366
|
/**
|
|
4443
4367
|
* The project this handle was produced in, used as the default for {@link resolve}.
|