typescript-language-server 1.1.2 → 2.0.0

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +39 -0
  3. package/README.md +43 -2
  4. package/lib/cli.js +6 -6
  5. package/lib/cli.js.map +1 -1
  6. package/lib/completion.d.ts +1 -2
  7. package/lib/completion.d.ts.map +1 -1
  8. package/lib/completion.js +38 -19
  9. package/lib/completion.js.map +1 -1
  10. package/lib/configuration-manager.d.ts +3 -10
  11. package/lib/configuration-manager.d.ts.map +1 -1
  12. package/lib/configuration-manager.js +24 -4
  13. package/lib/configuration-manager.js.map +1 -1
  14. package/lib/diagnostic-queue.d.ts +1 -1
  15. package/lib/diagnostic-queue.d.ts.map +1 -1
  16. package/lib/features/inlay-hints.js +2 -2
  17. package/lib/features/inlay-hints.js.map +1 -1
  18. package/lib/lsp-connection.d.ts +5 -5
  19. package/lib/lsp-connection.d.ts.map +1 -1
  20. package/lib/lsp-connection.js +2 -3
  21. package/lib/lsp-connection.js.map +1 -1
  22. package/lib/lsp-server.d.ts +7 -10
  23. package/lib/lsp-server.d.ts.map +1 -1
  24. package/lib/lsp-server.js +61 -115
  25. package/lib/lsp-server.js.map +1 -1
  26. package/lib/lsp-server.spec.js +382 -81
  27. package/lib/lsp-server.spec.js.map +1 -1
  28. package/lib/refactor.d.ts +2 -1
  29. package/lib/refactor.d.ts.map +1 -1
  30. package/lib/refactor.js +17 -7
  31. package/lib/refactor.js.map +1 -1
  32. package/lib/test-utils.d.ts +18 -0
  33. package/lib/test-utils.d.ts.map +1 -1
  34. package/lib/test-utils.js +24 -12
  35. package/lib/test-utils.js.map +1 -1
  36. package/lib/ts-protocol.d.ts +30 -8
  37. package/lib/ts-protocol.d.ts.map +1 -1
  38. package/lib/ts-protocol.js +7 -1
  39. package/lib/ts-protocol.js.map +1 -1
  40. package/lib/tsServer/callbackMap.d.ts +17 -0
  41. package/lib/tsServer/callbackMap.d.ts.map +1 -0
  42. package/lib/tsServer/callbackMap.js +47 -0
  43. package/lib/tsServer/callbackMap.js.map +1 -0
  44. package/lib/tsServer/cancellation.d.ts +22 -0
  45. package/lib/tsServer/cancellation.d.ts.map +1 -0
  46. package/lib/tsServer/cancellation.js +51 -0
  47. package/lib/tsServer/cancellation.js.map +1 -0
  48. package/lib/tsServer/logDirectoryProvider.d.ts +13 -0
  49. package/lib/tsServer/logDirectoryProvider.d.ts.map +1 -0
  50. package/lib/tsServer/logDirectoryProvider.js +49 -0
  51. package/lib/tsServer/logDirectoryProvider.js.map +1 -0
  52. package/lib/tsServer/requestQueue.d.ts +34 -0
  53. package/lib/tsServer/requestQueue.d.ts.map +1 -0
  54. package/lib/tsServer/requestQueue.js +74 -0
  55. package/lib/tsServer/requestQueue.js.map +1 -0
  56. package/lib/tsServer/requests.d.ts +68 -0
  57. package/lib/tsServer/requests.d.ts.map +1 -0
  58. package/lib/tsServer/requests.js +28 -0
  59. package/lib/tsServer/requests.js.map +1 -0
  60. package/lib/tsServer/server.d.ts +95 -0
  61. package/lib/tsServer/server.d.ts.map +1 -0
  62. package/lib/tsServer/server.js +209 -0
  63. package/lib/tsServer/server.js.map +1 -0
  64. package/lib/tsServer/serverError.d.ts +18 -0
  65. package/lib/tsServer/serverError.d.ts.map +1 -0
  66. package/lib/tsServer/serverError.js +53 -0
  67. package/lib/tsServer/serverError.js.map +1 -0
  68. package/lib/tsServer/serverProcess.d.ts +7 -0
  69. package/lib/tsServer/serverProcess.d.ts.map +1 -0
  70. package/lib/tsServer/serverProcess.js +238 -0
  71. package/lib/tsServer/serverProcess.js.map +1 -0
  72. package/lib/tsServer/spawner.d.ts +19 -0
  73. package/lib/tsServer/spawner.d.ts.map +1 -0
  74. package/lib/tsServer/spawner.js +130 -0
  75. package/lib/tsServer/spawner.js.map +1 -0
  76. package/lib/tsServer/tracer.d.ts +26 -0
  77. package/lib/tsServer/tracer.d.ts.map +1 -0
  78. package/lib/tsServer/tracer.js +80 -0
  79. package/lib/tsServer/tracer.js.map +1 -0
  80. package/lib/{utils → tsServer}/versionProvider.d.ts +8 -8
  81. package/lib/tsServer/versionProvider.d.ts.map +1 -0
  82. package/lib/{utils → tsServer}/versionProvider.js +28 -22
  83. package/lib/tsServer/versionProvider.js.map +1 -0
  84. package/lib/tsp-client.d.ts +25 -55
  85. package/lib/tsp-client.d.ts.map +1 -1
  86. package/lib/tsp-client.js +186 -140
  87. package/lib/tsp-client.js.map +1 -1
  88. package/lib/tsp-client.spec.js +23 -8
  89. package/lib/tsp-client.spec.js.map +1 -1
  90. package/lib/utils/api.d.ts +1 -0
  91. package/lib/utils/api.d.ts.map +1 -1
  92. package/lib/utils/api.js +1 -0
  93. package/lib/utils/api.js.map +1 -1
  94. package/lib/utils/configuration.d.ts +17 -8
  95. package/lib/utils/configuration.d.ts.map +1 -1
  96. package/lib/utils/configuration.js +43 -1
  97. package/lib/utils/configuration.js.map +1 -1
  98. package/lib/utils/logger.d.ts +65 -0
  99. package/lib/utils/logger.d.ts.map +1 -0
  100. package/lib/utils/logger.js +189 -0
  101. package/lib/utils/logger.js.map +1 -0
  102. package/lib/utils/modules-resolver.spec.js +1 -1
  103. package/lib/utils/modules-resolver.spec.js.map +1 -1
  104. package/package.json +12 -12
  105. package/lib/logger.d.ts +0 -48
  106. package/lib/logger.d.ts.map +0 -1
  107. package/lib/logger.js +0 -106
  108. package/lib/logger.js.map +0 -1
  109. package/lib/utils/versionProvider.d.ts.map +0 -1
  110. package/lib/utils/versionProvider.js.map +0 -1
@@ -0,0 +1,17 @@
1
+ import type tsp from 'typescript/lib/protocol.d.js';
2
+ import { ServerResponse } from './requests.js';
3
+ export interface CallbackItem<R> {
4
+ readonly onSuccess: (value: R) => void;
5
+ readonly onError: (err: Error) => void;
6
+ readonly queuingStartTime: number;
7
+ readonly isAsync: boolean;
8
+ }
9
+ export declare class CallbackMap<R extends tsp.Response> {
10
+ private readonly _callbacks;
11
+ private readonly _asyncCallbacks;
12
+ destroy(cause: string): void;
13
+ add(seq: number, callback: CallbackItem<ServerResponse.Response<R> | undefined>, isAsync: boolean): void;
14
+ fetch(seq: number): CallbackItem<ServerResponse.Response<R> | undefined> | undefined;
15
+ private delete;
16
+ }
17
+ //# sourceMappingURL=callbackMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callbackMap.d.ts","sourceRoot":"","sources":["../../src/tsServer/callbackMap.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,WAAW,YAAY,CAAC,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC7B;AAED,qBAAa,WAAW,CAAC,CAAC,SAAS,GAAG,CAAC,QAAQ;IAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2E;IACtG,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2E;IAEpG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAY5B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAQxG,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,SAAS;IAM3F,OAAO,CAAC,MAAM;CAKjB"}
@@ -0,0 +1,47 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /*
6
+ * Copyright (C) 2022 TypeFox and others.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ */
11
+ import { ServerResponse } from './requests.js';
12
+ export class CallbackMap {
13
+ constructor() {
14
+ this._callbacks = new Map();
15
+ this._asyncCallbacks = new Map();
16
+ }
17
+ destroy(cause) {
18
+ const cancellation = new ServerResponse.Cancelled(cause);
19
+ for (const callback of this._callbacks.values()) {
20
+ callback.onSuccess(cancellation);
21
+ }
22
+ this._callbacks.clear();
23
+ for (const callback of this._asyncCallbacks.values()) {
24
+ callback.onSuccess(cancellation);
25
+ }
26
+ this._asyncCallbacks.clear();
27
+ }
28
+ add(seq, callback, isAsync) {
29
+ if (isAsync) {
30
+ this._asyncCallbacks.set(seq, callback);
31
+ }
32
+ else {
33
+ this._callbacks.set(seq, callback);
34
+ }
35
+ }
36
+ fetch(seq) {
37
+ const callback = this._callbacks.get(seq) || this._asyncCallbacks.get(seq);
38
+ this.delete(seq);
39
+ return callback;
40
+ }
41
+ delete(seq) {
42
+ if (!this._callbacks.delete(seq)) {
43
+ this._asyncCallbacks.delete(seq);
44
+ }
45
+ }
46
+ }
47
+ //# sourceMappingURL=callbackMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callbackMap.js","sourceRoot":"","sources":["../../src/tsServer/callbackMap.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAS/C,MAAM,OAAO,WAAW;IAAxB;QACqB,eAAU,GAAG,IAAI,GAAG,EAAgE,CAAC;QACrF,oBAAe,GAAG,IAAI,GAAG,EAAgE,CAAC;IAiC/G,CAAC;IA/BU,OAAO,CA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equest(seq: number): boolean;
5
+ }
6
+ export interface OngoingRequestCancellerFactory {
7
+ create(serverId: string, tracer: Tracer): OngoingRequestCanceller;
8
+ }
9
+ export declare const noopRequestCancellerFactory: {
10
+ create(_serverId: string, _tracer: Tracer): OngoingRequestCanceller;
11
+ };
12
+ export declare class NodeRequestCanceller implements OngoingRequestCanceller {
13
+ private readonly _serverId;
14
+ private readonly _tracer;
15
+ readonly cancellationPipeName: string;
16
+ constructor(_serverId: string, _tracer: Tracer);
17
+ tryCancelOngoingRequest(seq: number): boolean;
18
+ }
19
+ export declare const nodeRequestCancellerFactory: {
20
+ create(serverId: string, tracer: Tracer): OngoingRequestCanceller;
21
+ };
22
+ //# sourceMappingURL=cancellation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancellation.d.ts","sourceRoot":"","sources":["../../src/tsServer/cancellation.ts"],"names":[],"mappings":"AAaA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,WAAW,uBAAuB;IACpC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IAClD,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjD;AAED,MAAM,WAAW,8BAA8B;IAC3C,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,uBAAuB,CAAC;CACrE;AAUD,eAAO,MAAM,2BAA2B;sBAClB,MAAM,WAAW,MAAM,GAAG,uBAAuB;CAGtE,CAAC;AAEF,qBAAa,oBAAqB,YAAW,uBAAuB;IAI5D,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ5B,SAAgB,oBAAoB,EAAE,MAAM,CAAC;gBAGxB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM;IAK7B,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAYvD;AAED,eAAO,MAAM,2BAA2B;qBACnB,MAAM,UAAU,MAAM,GAAG,uBAAuB;CAGpE,CAAC"}
@@ -0,0 +1,51 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /*
6
+ * Copyright (C) 2022 TypeFox and others.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ */
11
+ import fs from 'node:fs';
12
+ import { temporaryFile } from 'tempy';
13
+ const noopRequestCanceller = new class {
14
+ constructor() {
15
+ this.cancellationPipeName = undefined;
16
+ }
17
+ tryCancelOngoingRequest(_seq) {
18
+ return false;
19
+ }
20
+ };
21
+ export const noopRequestCancellerFactory = new class {
22
+ create(_serverId, _tracer) {
23
+ return noopRequestCanceller;
24
+ }
25
+ };
26
+ export class NodeRequestCanceller {
27
+ constructor(_serverId, _tracer) {
28
+ this._serverId = _serverId;
29
+ this._tracer = _tracer;
30
+ this.cancellationPipeName = temporaryFile({ name: 'tscancellation' });
31
+ }
32
+ tryCancelOngoingRequest(seq) {
33
+ if (!this.cancellationPipeName) {
34
+ return false;
35
+ }
36
+ this._tracer.logTrace(this._serverId, `TypeScript Server: trying to cancel ongoing request with sequence number ${seq}`);
37
+ try {
38
+ fs.writeFileSync(this.cancellationPipeName + String(seq), '');
39
+ }
40
+ catch {
41
+ // noop
42
+ }
43
+ return true;
44
+ }
45
+ }
46
+ export const nodeRequestCancellerFactory = new class {
47
+ create(serverId, tracer) {
48
+ return new NodeRequestCanceller(serverId, tracer);
49
+ }
50
+ };
51
+ //# sourceMappingURL=cancellation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancellation.js","sourceRoot":"","sources":["../../src/tsServer/cancellation.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;;;GAKG;AAEH,OAAO,EAAE,MAA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DirectoryProvider implements ILogDirectoryProvider {
5
+ private readonly rootPath?;
6
+ constructor(rootPath?: string | undefined);
7
+ getNewLogDirectory(): string | undefined;
8
+ private logDirectory;
9
+ }
10
+ export declare const noopLogDirectoryProvider: {
11
+ getNewLogDirectory(): undefined;
12
+ };
13
+ //# sourceMappingURL=logDirectoryProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logDirectoryProvider.d.ts","sourceRoot":"","sources":["../../src/tsServer/logDirectoryProvider.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,qBAAqB;IAClC,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAAC;CAC5C;AAED,qBAAa,oBAAqB,YAAW,qBAAqB;IAE1D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBAAT,QAAQ,CAAC,oBAAQ;IAG/B,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAY/C,OAAO,CAAC,YAAY;CAavB;AAED,eAAO,MAAM,wBAAwB;0BACJ,SAAS;CAGzC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /*
6
+ * Copyright (C) 2022 TypeFox and others.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ */
11
+ import fs from 'node:fs';
12
+ import path from 'node:path';
13
+ export class LogDirectoryProvider {
14
+ constructor(rootPath) {
15
+ this.rootPath = rootPath;
16
+ }
17
+ getNewLogDirectory() {
18
+ const root = this.logDirectory();
19
+ if (root) {
20
+ try {
21
+ return fs.mkdtempSync(path.join(root, 'tsserver-log-'));
22
+ }
23
+ catch (e) {
24
+ return undefined;
25
+ }
26
+ }
27
+ return undefined;
28
+ }
29
+ logDirectory() {
30
+ if (!this.rootPath) {
31
+ return undefined;
32
+ }
33
+ try {
34
+ if (!fs.existsSync(this.rootPath)) {
35
+ fs.mkdirSync(this.rootPath);
36
+ }
37
+ return this.rootPath;
38
+ }
39
+ catch {
40
+ return undefined;
41
+ }
42
+ }
43
+ }
44
+ export const noopLogDirectoryProvider = new class {
45
+ getNewLogDirectory() {
46
+ return undefined;
47
+ }
48
+ };
49
+ //# sourceMappingURL=logDirectoryProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logDirectoryProvider.js","sourceRoot":"","sources":["../../src/tsServer/logDirectoryProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAM7B,MAAM,OAAO,oBAAoB;IAC7B,YACqB,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IAClC,CAAC;IAEE,kBAAkB;QACrB,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,IAAI,IAAI,EAAE;YACN,IAAI;gBACA,OAAO,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;aAC3D;YAAC,OAAO,CAAC,EAAE;gBACR,OAAO,SAAS,CAAC;aACpB;SACJ;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAEO,YAAY;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,OAAO,SAAS,CAAC;SACpB;QACD,IAAI;YACA,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAC/B,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAC/B;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC;SACxB;QAAC,MAAM;YACJ,OAAO,SAAS,CAAC;SACpB;IACL,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI;IACjC,kBAAkB;QACrB,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type tsp from 'typescript/lib/protocol.d.js';
2
+ export declare enum RequestQueueingType {
3
+ /**
4
+ * Normal request that is executed in order.
5
+ */
6
+ Normal = 1,
7
+ /**
8
+ * Request that normal requests jump in front of in the queue.
9
+ */
10
+ LowPriority = 2,
11
+ /**
12
+ * A fence that blocks request reordering.
13
+ *
14
+ * Fences are not reordered. Unlike a normal request, a fence will never jump in front of a low priority request
15
+ * in the request queue.
16
+ */
17
+ Fence = 3
18
+ }
19
+ export interface RequestItem {
20
+ readonly request: tsp.Request;
21
+ readonly expectsResponse: boolean;
22
+ readonly isAsync: boolean;
23
+ readonly queueingType: RequestQueueingType;
24
+ }
25
+ export declare class RequestQueue {
26
+ private readonly queue;
27
+ private sequenceNumber;
28
+ get length(): number;
29
+ enqueue(item: RequestItem): void;
30
+ dequeue(): RequestItem | undefined;
31
+ tryDeletePendingRequest(seq: number): boolean;
32
+ createRequest(command: string, args: any): tsp.Request;
33
+ }
34
+ //# sourceMappingURL=requestQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestQueue.d.ts","sourceRoot":"","sources":["../../src/tsServer/requestQueue.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AAEpD,oBAAY,mBAAmB;IAC3B;;OAEG;IACH,MAAM,IAAI;IAEV;;OAEG;IACH,WAAW,IAAI;IAEf;;;;;OAKG;IACH,KAAK,IAAI;CACZ;AAED,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;IAC9B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;CAC9C;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;IAC3C,OAAO,CAAC,cAAc,CAAK;IAE3B,IAAW,MAAM,IAAI,MAAM,CAE1B;IAEM,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAgBhC,OAAO,IAAI,WAAW,GAAG,SAAS;IAIlC,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAU7C,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO;CAQhE"}
@@ -0,0 +1,74 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /*
6
+ * Copyright (C) 2022 TypeFox and others.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ */
11
+ export var RequestQueueingType;
12
+ (function (RequestQueueingType) {
13
+ /**
14
+ * Normal request that is executed in order.
15
+ */
16
+ RequestQueueingType[RequestQueueingType["Normal"] = 1] = "Normal";
17
+ /**
18
+ * Request that normal requests jump in front of in the queue.
19
+ */
20
+ RequestQueueingType[RequestQueueingType["LowPriority"] = 2] = "LowPriority";
21
+ /**
22
+ * A fence that blocks request reordering.
23
+ *
24
+ * Fences are not reordered. Unlike a normal request, a fence will never jump in front of a low priority request
25
+ * in the request queue.
26
+ */
27
+ RequestQueueingType[RequestQueueingType["Fence"] = 3] = "Fence";
28
+ })(RequestQueueingType = RequestQueueingType || (RequestQueueingType = {}));
29
+ export class RequestQueue {
30
+ constructor() {
31
+ this.queue = [];
32
+ this.sequenceNumber = 0;
33
+ }
34
+ get length() {
35
+ return this.queue.length;
36
+ }
37
+ enqueue(item) {
38
+ if (item.queueingType === RequestQueueingType.Normal) {
39
+ let index = this.queue.length - 1;
40
+ while (index >= 0) {
41
+ if (this.queue[index].queueingType !== RequestQueueingType.LowPriority) {
42
+ break;
43
+ }
44
+ --index;
45
+ }
46
+ this.queue.splice(index + 1, 0, item);
47
+ }
48
+ else {
49
+ // Only normal priority requests can be reordered. All other requests just go to the end.
50
+ this.queue.push(item);
51
+ }
52
+ }
53
+ dequeue() {
54
+ return this.queue.shift();
55
+ }
56
+ tryDeletePendingRequest(seq) {
57
+ for (let i = 0; i < this.queue.length; i++) {
58
+ if (this.queue[i].request.seq === seq) {
59
+ this.queue.splice(i, 1);
60
+ return true;
61
+ }
62
+ }
63
+ return false;
64
+ }
65
+ createRequest(command, args) {
66
+ return {
67
+ seq: this.sequenceNumber++,
68
+ type: 'request',
69
+ command: command,
70
+ arguments: args,
71
+ };
72
+ }
73
+ }
74
+ //# sourceMappingURL=requestQueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestQueue.js","sourceRoot":"","sources":["../../src/tsServer/requestQueue.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;;;GAKG;AAIH,MAAM,CAAN,IAAY,mBAkBX;AAlBD,WAAY,mBAAmB;IAC3B;;OAEG;IACH,iEAAU,CAAA;IAEV;;OAEG;IACH,2EAAe,CAAA;IAEf;;;;;OAKG;IACH,+DAAS,CAAA;AACb,CAAC,EAlBW,mBAAmB,GAAnB,mBAAmB,KAAnB,mBAAmB,QAkB9B;AASD,MAAM,OAAO,YAAY;IAAzB;QACqB,UAAK,GAAkB,EAAE,CAAC;QACnC,mBAAc,GAAG,CAAC,CAAC;IA4C/B,CAAC;IA1CG,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC7B,CAAC;IAEM,OAAO,CAAC,IAAiB;QAC5B,IAAI,IAAI,CAAC,YAAY,KAAK,mBAAmB,CAAC,MAAM,EAAE;YAClD,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YAClC,OAAO,KAAK,IAAI,CAAC,EAAE;gBACf,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,YAAY,KAAK,mBAAmB,CAAC,WAAW,EAAE;oBACpE,MAAM;iBACT;gBACD,EAAE,KAAK,CAAC;aACX;YACD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;SACzC;aAAM;YACH,yFAAyF;YACzF,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACzB;IACL,CAAC;IAEM,OAAO;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;IAEM,uBAAuB,CAAC,GAAW;QACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,KAAK,GAAG,EAAE;gBACnC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACxB,OAAO,IAAI,CAAC;aACf;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEM,aAAa,CAAC,OAAe,EAAE,IAAS;QAC3C,OAAO;YACH,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE;YAC1B,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,IAAI;SAClB,CAAC;IACN,CAAC;CACJ"}
@@ -0,0 +1,68 @@
1
+ import vscodeUri from 'vscode-uri';
2
+ import type tsp from 'typescript/lib/protocol.d.js';
3
+ import { CommandTypes } from '../tsp-command-types.js';
4
+ import { ExecutionTarget } from './server.js';
5
+ export declare enum ServerType {
6
+ Syntax = "syntax",
7
+ Semantic = "semantic"
8
+ }
9
+ export declare namespace ServerResponse {
10
+ class Cancelled {
11
+ readonly reason: string;
12
+ readonly type = "cancelled";
13
+ constructor(reason: string);
14
+ }
15
+ const NoContent: {
16
+ readonly type: "noContent";
17
+ };
18
+ const NoServer: {
19
+ readonly type: "noServer";
20
+ };
21
+ type Response<T extends tsp.Response> = T | Cancelled | typeof NoContent | typeof NoServer;
22
+ }
23
+ export interface TypeScriptRequestTypes {
24
+ [CommandTypes.ApplyCodeActionCommand]: [tsp.ApplyCodeActionCommandRequestArgs, tsp.ApplyCodeActionCommandResponse];
25
+ [CommandTypes.Change]: [tsp.ChangeRequestArgs, null];
26
+ [CommandTypes.Close]: [tsp.FileRequestArgs, null];
27
+ [CommandTypes.CompilerOptionsForInferredProjects]: [tsp.SetCompilerOptionsForInferredProjectsArgs, tsp.SetCompilerOptionsForInferredProjectsResponse];
28
+ [CommandTypes.CompletionDetails]: [tsp.CompletionDetailsRequestArgs, tsp.CompletionDetailsResponse];
29
+ [CommandTypes.CompletionInfo]: [tsp.CompletionsRequestArgs, tsp.CompletionInfoResponse];
30
+ [CommandTypes.Configure]: [tsp.ConfigureRequestArguments, tsp.ConfigureResponse];
31
+ [CommandTypes.Definition]: [tsp.FileLocationRequestArgs, tsp.DefinitionResponse];
32
+ [CommandTypes.DefinitionAndBoundSpan]: [tsp.FileLocationRequestArgs, tsp.DefinitionInfoAndBoundSpanResponse];
33
+ [CommandTypes.DocCommentTemplate]: [tsp.FileLocationRequestArgs, tsp.DocCommandTemplateResponse];
34
+ [CommandTypes.DocumentHighlights]: [tsp.DocumentHighlightsRequestArgs, tsp.DocumentHighlightsResponse];
35
+ [CommandTypes.EncodedSemanticClassificationsFull]: [tsp.EncodedSemanticClassificationsRequestArgs, tsp.EncodedSemanticClassificationsResponse];
36
+ [CommandTypes.FindSourceDefinition]: [tsp.FileLocationRequestArgs, tsp.DefinitionResponse];
37
+ [CommandTypes.Format]: [tsp.FormatRequestArgs, tsp.FormatResponse];
38
+ [CommandTypes.Formatonkey]: [tsp.FormatOnKeyRequestArgs, tsp.FormatResponse];
39
+ [CommandTypes.GetApplicableRefactors]: [tsp.GetApplicableRefactorsRequestArgs, tsp.GetApplicableRefactorsResponse];
40
+ [CommandTypes.GetCodeFixes]: [tsp.CodeFixRequestArgs, tsp.CodeFixResponse];
41
+ [CommandTypes.GetCombinedCodeFix]: [tsp.GetCombinedCodeFixRequestArgs, tsp.GetCombinedCodeFixResponse];
42
+ [CommandTypes.GetEditsForFileRename]: [tsp.GetEditsForFileRenameRequestArgs, tsp.GetEditsForFileRenameResponse];
43
+ [CommandTypes.GetEditsForRefactor]: [tsp.GetEditsForRefactorRequestArgs, tsp.GetEditsForRefactorResponse];
44
+ [CommandTypes.Geterr]: [tsp.GeterrRequestArgs, any];
45
+ [CommandTypes.GetOutliningSpans]: [tsp.FileRequestArgs, tsp.OutliningSpansResponse];
46
+ [CommandTypes.GetSupportedCodeFixes]: [null, tsp.GetSupportedCodeFixesResponse];
47
+ [CommandTypes.Implementation]: [tsp.FileLocationRequestArgs, tsp.ImplementationResponse];
48
+ [CommandTypes.JsxClosingTag]: [tsp.JsxClosingTagRequestArgs, tsp.JsxClosingTagResponse];
49
+ [CommandTypes.Navto]: [tsp.NavtoRequestArgs, tsp.NavtoResponse];
50
+ [CommandTypes.NavTree]: [tsp.FileRequestArgs, tsp.NavTreeResponse];
51
+ [CommandTypes.Open]: [tsp.OpenRequestArgs, null];
52
+ [CommandTypes.OrganizeImports]: [tsp.OrganizeImportsRequestArgs, tsp.OrganizeImportsResponse];
53
+ [CommandTypes.ProjectInfo]: [tsp.ProjectInfoRequestArgs, tsp.ProjectInfoResponse];
54
+ [CommandTypes.ProvideInlayHints]: [tsp.InlayHintsRequestArgs, tsp.InlayHintsResponse];
55
+ [CommandTypes.Quickinfo]: [tsp.FileLocationRequestArgs, tsp.QuickInfoResponse];
56
+ [CommandTypes.References]: [tsp.FileLocationRequestArgs, tsp.ReferencesResponse];
57
+ [CommandTypes.Rename]: [tsp.RenameRequestArgs, tsp.RenameResponse];
58
+ [CommandTypes.SignatureHelp]: [tsp.SignatureHelpRequestArgs, tsp.SignatureHelpResponse];
59
+ [CommandTypes.TypeDefinition]: [tsp.FileLocationRequestArgs, tsp.TypeDefinitionResponse];
60
+ [CommandTypes.UpdateOpen]: [tsp.UpdateOpenRequestArgs, tsp.Response];
61
+ }
62
+ export declare type ExecConfig = {
63
+ readonly lowPriority?: boolean;
64
+ readonly nonRecoverable?: boolean;
65
+ readonly cancelOnResourceChange?: vscodeUri.URI;
66
+ readonly executionTarget?: ExecutionTarget;
67
+ };
68
+ //# sourceMappingURL=requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/tsServer/requests.ts"],"names":[],"mappings":"AAWA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,oBAAY,UAAU;IAClB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACxB;AAED,yBAAiB,cAAc,CAAC;IAE5B,MAAa,SAAS;iBAIE,MAAM,EAAE,MAAM;QAHlC,SAAgB,IAAI,eAAe;oBAGf,MAAM,EAAE,MAAM;KAErC;IAEM,MAAM,SAAS;;KAAiC,CAAC;IAEjD,MAAM,QAAQ;;KAAgC,CAAC;IAEtD,KAAY,QAAQ,CAAC,CAAC,SAAS,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,SAAS,GAAG,OAAO,SAAS,GAAG,OAAO,QAAQ,CAAC;CACrG;AAED,MAAM,WAAW,sBAAsB;IACnC,CAAC,YAAY,CAAC,sBAAsB,CAAC,EAAE,CAAC,GAAG,CAAC,iCAAiC,EAAE,GAAG,CAAC,8BAA8B,CAAC,CAAC;IACnH,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,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GAAG,CAAC,qBAAqB,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;CACxE;AAED,oBAAY,UAAU,GAAG;IACrB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,CAAC,GAAG,CAAC;IAChD,QAAQ,CAAC,eAAe,CAAC,EAAE,eAAe,CAAC;CAC9C,CAAC"}
@@ -0,0 +1,28 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /*
6
+ * Copyright (C) 2022 TypeFox and others.
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ */
11
+ export var ServerType;
12
+ (function (ServerType) {
13
+ ServerType["Syntax"] = "syntax";
14
+ ServerType["Semantic"] = "semantic";
15
+ })(ServerType = ServerType || (ServerType = {}));
16
+ export var ServerResponse;
17
+ (function (ServerResponse) {
18
+ class Cancelled {
19
+ constructor(reason) {
20
+ this.reason = reason;
21
+ this.type = 'cancelled';
22
+ }
23
+ }
24
+ ServerResponse.Cancelled = Cancelled;
25
+ ServerResponse.NoContent = { type: 'noContent' };
26
+ ServerResponse.NoServer = { type: 'noServer' };
27
+ })(ServerResponse = ServerResponse || (ServerResponse = {}));
28
+ //# sourceMappingURL=requests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requests.js","sourceRoot":"","sources":["../../src/tsServer/requests.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;;;GAKG;AAOH,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,mCAAqB,CAAA;AACzB,CAAC,EAHW,UAAU,GAAV,UAAU,KAAV,UAAU,QAGrB;AAED,MAAM,KAAW,cAAc,CAe9B;AAfD,WAAiB,cAAc;IAE3B,MAAa,SAAS;QAGlB,YACoB,MAAc;YAAd,WAAM,GAAN,MAAM,CAAQ;YAHlB,SAAI,GAAG,WAAW,CAAC;QAI/B,CAAC;KACR;IANY,wBAAS,YAMrB,CAAA;IAEY,wBAAS,GAAG,EAAE,IAAI,EAAE,WAAW,EAAW,CAAC;IAE3C,uBAAQ,GAAG,EAAE,IAAI,EAAE,UAAU,EAAW,CAAC;AAG1D,CAAC,EAfgB,cAAc,GAAd,cAAc,KAAd,cAAc,QAe9B"}
@@ -0,0 +1,95 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import type tsp from 'typescript/lib/protocol.d.js';
3
+ import { CancellationToken } from 'vscode-jsonrpc';
4
+ import { ServerResponse, ServerType, TypeScriptRequestTypes } from './requests.js';
5
+ import type { TspClientOptions } from '../tsp-client.js';
6
+ import { OngoingRequestCanceller } from './cancellation.js';
7
+ import type Tracer from './tracer.js';
8
+ import type { TypeScriptVersion } from './versionProvider.js';
9
+ export declare enum ExecutionTarget {
10
+ Semantic = 0,
11
+ Syntax = 1
12
+ }
13
+ export interface TypeScriptServerExitEvent {
14
+ readonly code: number | null;
15
+ readonly signal: NodeJS.Signals | null;
16
+ }
17
+ declare type OnEventHandler = (e: tsp.Event) => any;
18
+ declare type OnExitHandler = (e: TypeScriptServerExitEvent) => any;
19
+ declare type OnErrorHandler = (e: any) => any;
20
+ export interface ITypeScriptServer {
21
+ onEvent(handler: OnEventHandler): void;
22
+ onExit(handler: OnExitHandler): void;
23
+ onError(handler: OnErrorHandler): void;
24
+ readonly tsServerLogFile: string | undefined;
25
+ kill(): void;
26
+ /**
27
+ * @return A list of all execute requests. If there are multiple entries, the first item is the primary
28
+ * request while the rest are secondary ones.
29
+ */
30
+ executeImpl(command: keyof TypeScriptRequestTypes, args: any, executeInfo: {
31
+ isAsync: boolean;
32
+ token?: CancellationToken;
33
+ expectsResult: boolean;
34
+ lowPriority?: boolean;
35
+ executionTarget?: ExecutionTarget;
36
+ }): Array<Promise<ServerResponse.Response<tsp.Response>> | undefined>;
37
+ dispose(): void;
38
+ }
39
+ export declare const enum TsServerProcessKind {
40
+ Main = "main",
41
+ Syntax = "syntax",
42
+ Semantic = "semantic",
43
+ Diagnostics = "diagnostics"
44
+ }
45
+ export interface TsServerProcessFactory {
46
+ fork(version: TypeScriptVersion, args: readonly string[], kind: TsServerProcessKind, configuration: TspClientOptions): TsServerProcess;
47
+ }
48
+ export interface TsServerProcess {
49
+ write(serverRequest: tsp.Request): void;
50
+ onData(handler: (data: tsp.Response) => void): void;
51
+ onExit(handler: (code: number | null, signal: NodeJS.Signals | null) => void): void;
52
+ onError(handler: (error: Error) => void): void;
53
+ kill(): void;
54
+ }
55
+ export declare class ProcessBasedTsServer implements ITypeScriptServer {
56
+ private readonly _serverId;
57
+ private readonly _serverSource;
58
+ private readonly _process;
59
+ private readonly _tsServerLogFile;
60
+ private readonly _requestCanceller;
61
+ private readonly _version;
62
+ private readonly _tracer;
63
+ private readonly _requestQueue;
64
+ private readonly _callbacks;
65
+ private readonly _pendingResponses;
66
+ private readonly _eventHandlers;
67
+ private readonly _exitHandlers;
68
+ private readonly _errorHandlers;
69
+ constructor(_serverId: string, _serverSource: ServerType, _process: TsServerProcess, _tsServerLogFile: string | undefined, _requestCanceller: OngoingRequestCanceller, _version: TypeScriptVersion, _tracer: Tracer);
70
+ onEvent(handler: OnEventHandler): void;
71
+ onExit(handler: OnExitHandler): void;
72
+ onError(handler: OnErrorHandler): void;
73
+ get tsServerLogFile(): string | undefined;
74
+ private write;
75
+ dispose(): void;
76
+ kill(): void;
77
+ private dispatchMessage;
78
+ private tryCancelRequest;
79
+ private dispatchResponse;
80
+ executeImpl(command: keyof TypeScriptRequestTypes, args: any, executeInfo: {
81
+ isAsync: boolean;
82
+ token?: CancellationToken;
83
+ expectsResult: boolean;
84
+ lowPriority?: boolean;
85
+ executionTarget?: ExecutionTarget;
86
+ }): Array<Promise<ServerResponse.Response<tsp.Response>> | undefined>;
87
+ private sendNextRequests;
88
+ private sendRequest;
89
+ private fetchCallback;
90
+ private logTrace;
91
+ private static readonly fenceCommands;
92
+ private static getQueueingType;
93
+ }
94
+ export {};
95
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/tsServer/server.ts"],"names":[],"mappings":";AAWA,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,oBAAY,eAAe;IACvB,QAAQ,IAAA;IACR,MAAM,IAAA;CACT;AAED,MAAM,WAAW,yBAAyB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;CAC1C;AAED,aAAK,cAAc,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC;AAC5C,aAAK,aAAa,GAAG,CAAC,CAAC,EAAE,yBAAyB,KAAK,GAAG,CAAC;AAC3D,aAAK,cAAc,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAC9B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IACvC,MAAM,CAAC,OA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