@zzzen/pyright-internal 1.2.0-dev.20260705 → 1.2.0-dev.20260712

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 (94) hide show
  1. package/dist/tests/typeServer/inProcTypeServerTestUtils.d.ts +39 -0
  2. package/dist/tests/typeServer/inProcTypeServerTestUtils.js +366 -0
  3. package/dist/tests/typeServer/inProcTypeServerTestUtils.js.map +1 -0
  4. package/dist/tests/typeServer/notebook.typeServer.test.d.ts +1 -0
  5. package/dist/tests/typeServer/notebook.typeServer.test.js +315 -0
  6. package/dist/tests/typeServer/notebook.typeServer.test.js.map +1 -0
  7. package/dist/tests/typeServer/typeServer.inProc.test.d.ts +1 -0
  8. package/dist/tests/typeServer/typeServer.inProc.test.js +234 -0
  9. package/dist/tests/typeServer/typeServer.inProc.test.js.map +1 -0
  10. package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.d.ts +1 -0
  11. package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.js +298 -0
  12. package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.js.map +1 -0
  13. package/dist/typeServer/cancellation.d.ts +5 -0
  14. package/dist/typeServer/cancellation.js +14 -0
  15. package/dist/typeServer/cancellation.js.map +1 -0
  16. package/dist/typeServer/diagnosticUtils.d.ts +4 -0
  17. package/dist/typeServer/diagnosticUtils.js +71 -0
  18. package/dist/typeServer/diagnosticUtils.js.map +1 -0
  19. package/dist/typeServer/enums.d.ts +14 -0
  20. package/dist/typeServer/enums.js +524 -0
  21. package/dist/typeServer/enums.js.map +1 -0
  22. package/dist/typeServer/eventEmitter.d.ts +12 -0
  23. package/dist/typeServer/eventEmitter.js +32 -0
  24. package/dist/typeServer/eventEmitter.js.map +1 -0
  25. package/dist/typeServer/nodeMain.d.ts +1 -0
  26. package/dist/typeServer/nodeMain.js +65 -0
  27. package/dist/typeServer/nodeMain.js.map +1 -0
  28. package/dist/typeServer/notebookCellChain.d.ts +34 -0
  29. package/dist/typeServer/notebookCellChain.js +182 -0
  30. package/dist/typeServer/notebookCellChain.js.map +1 -0
  31. package/dist/typeServer/notebookDocumentHandler.d.ts +23 -0
  32. package/dist/typeServer/notebookDocumentHandler.js +158 -0
  33. package/dist/typeServer/notebookDocumentHandler.js.map +1 -0
  34. package/dist/typeServer/notebookUriMapper.d.ts +39 -0
  35. package/dist/typeServer/notebookUriMapper.js +164 -0
  36. package/dist/typeServer/notebookUriMapper.js.map +1 -0
  37. package/dist/typeServer/profilingStub.d.ts +10 -0
  38. package/dist/typeServer/profilingStub.js +12 -0
  39. package/dist/typeServer/profilingStub.js.map +1 -0
  40. package/dist/typeServer/programTypes.d.ts +136 -0
  41. package/dist/typeServer/programTypes.js +3 -0
  42. package/dist/typeServer/programTypes.js.map +1 -0
  43. package/dist/typeServer/programWrapper.d.ts +134 -0
  44. package/dist/typeServer/programWrapper.js +731 -0
  45. package/dist/typeServer/programWrapper.js.map +1 -0
  46. package/dist/typeServer/protocol/tspSupplemental.d.ts +43 -0
  47. package/dist/typeServer/protocol/tspSupplemental.js +48 -0
  48. package/dist/typeServer/protocol/tspSupplemental.js.map +1 -0
  49. package/dist/typeServer/protocol/typeServerProtocol.d.ts +1102 -0
  50. package/dist/typeServer/protocol/typeServerProtocol.js +290 -0
  51. package/dist/typeServer/protocol/typeServerProtocol.js.map +1 -0
  52. package/dist/typeServer/server.d.ts +54 -0
  53. package/dist/typeServer/server.js +620 -0
  54. package/dist/typeServer/server.js.map +1 -0
  55. package/dist/typeServer/serverUtils.d.ts +4 -0
  56. package/dist/typeServer/serverUtils.js +21 -0
  57. package/dist/typeServer/serverUtils.js.map +1 -0
  58. package/dist/typeServer/stubGenerator.d.ts +42 -0
  59. package/dist/typeServer/stubGenerator.js +895 -0
  60. package/dist/typeServer/stubGenerator.js.map +1 -0
  61. package/dist/typeServer/typeCache.d.ts +31 -0
  62. package/dist/typeServer/typeCache.js +54 -0
  63. package/dist/typeServer/typeCache.js.map +1 -0
  64. package/dist/typeServer/typeEvalUtils.d.ts +13 -0
  65. package/dist/typeServer/typeEvalUtils.js +83 -0
  66. package/dist/typeServer/typeEvalUtils.js.map +1 -0
  67. package/dist/typeServer/typeGuards.d.ts +3 -0
  68. package/dist/typeServer/typeGuards.js +55 -0
  69. package/dist/typeServer/typeGuards.js.map +1 -0
  70. package/dist/typeServer/typeServerConversionTypes.d.ts +39 -0
  71. package/dist/typeServer/typeServerConversionTypes.js +448 -0
  72. package/dist/typeServer/typeServerConversionTypes.js.map +1 -0
  73. package/dist/typeServer/typeServerConversionUtils.d.ts +35 -0
  74. package/dist/typeServer/typeServerConversionUtils.js +524 -0
  75. package/dist/typeServer/typeServerConversionUtils.js.map +1 -0
  76. package/dist/typeServer/typeServerEvaluator.d.ts +16 -0
  77. package/dist/typeServer/typeServerEvaluator.js +36 -0
  78. package/dist/typeServer/typeServerEvaluator.js.map +1 -0
  79. package/dist/typeServer/typeServerFileSystem.d.ts +47 -0
  80. package/dist/typeServer/typeServerFileSystem.js +129 -0
  81. package/dist/typeServer/typeServerFileSystem.js.map +1 -0
  82. package/dist/typeServer/typeServerProtocolUtils.d.ts +2 -0
  83. package/dist/typeServer/typeServerProtocolUtils.js +7 -0
  84. package/dist/typeServer/typeServerProtocolUtils.js.map +1 -0
  85. package/dist/typeServer/typeServerServiceKeys.d.ts +7 -0
  86. package/dist/typeServer/typeServerServiceKeys.js +20 -0
  87. package/dist/typeServer/typeServerServiceKeys.js.map +1 -0
  88. package/dist/typeServer/typeUtils.d.ts +4 -0
  89. package/dist/typeServer/typeUtils.js +31 -0
  90. package/dist/typeServer/typeUtils.js.map +1 -0
  91. package/dist/typeServer/virtualFileOverlayFileSystem.d.ts +87 -0
  92. package/dist/typeServer/virtualFileOverlayFileSystem.js +181 -0
  93. package/dist/typeServer/virtualFileOverlayFileSystem.js.map +1 -0
  94. package/package.json +1 -1
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /*
7
+ * typeServer.virtualFileRedirect.test.ts
8
+ * Copyright (c) Microsoft Corporation.
9
+ * Licensed under the MIT license.
10
+ *
11
+ * Tests for the TspSupplemental virtual file redirect notifications in the TypeServer.
12
+ * Verifies that the type server correctly handles setVirtualFileRedirect /
13
+ * removeVirtualFileRedirect notifications, re-reads content, and triggers reanalysis,
14
+ * including observable type changes.
15
+ */
16
+ const assert_1 = __importDefault(require("assert"));
17
+ const tspSupplemental_1 = require("../../typeServer/protocol/tspSupplemental");
18
+ const typeServerProtocol_1 = require("../../typeServer/protocol/typeServerProtocol");
19
+ const inProcTypeServerTestUtils_1 = require("./inProcTypeServerTestUtils");
20
+ jest.setTimeout(120000);
21
+ /** Extract the class name from a protocol Type, if it's a ClassType with a regular declaration. */
22
+ function getClassTypeName(type) {
23
+ if (!type || type.kind !== 3 /* TypeServerProtocol.TypeKind.Class */) {
24
+ return undefined;
25
+ }
26
+ const classType = type;
27
+ if (classType.declaration.kind === 0 /* TypeServerProtocol.DeclarationKind.Regular */) {
28
+ return classType.declaration.name;
29
+ }
30
+ return undefined;
31
+ }
32
+ describe('TypeServer virtual file redirect (TspSupplemental)', () => {
33
+ beforeAll(async () => {
34
+ await (0, inProcTypeServerTestUtils_1.initializeDependenciesForInProcTests)();
35
+ });
36
+ test('setVirtualFileRedirect triggers reanalysis and changes inferred types', async () => {
37
+ const code = `
38
+ // @filename: mymod.py
39
+ //// x: int = 1
40
+ //// # /*mod_marker*/
41
+
42
+ // @filename: virtual_mymod.py
43
+ //// x: str = "hello"
44
+
45
+ // @filename: test.py
46
+ //// from mymod import x
47
+ //// [|/*y*/y|] = x
48
+ //// # /*test_marker*/
49
+ `;
50
+ await (0, inProcTypeServerTestUtils_1.withInProcTypeServer)(code, async (context) => {
51
+ // Open the module file and test file in the type server.
52
+ await context.openFileForMarker('test_marker');
53
+ await context.openFileForMarker('mod_marker');
54
+ // Get the node for y so we can query its computed type.
55
+ const yNode = context.getNodeForMarker('y');
56
+ // Get the initial snapshot (ensures analysis has completed).
57
+ const initialSnapshot = await context.refreshSnapshot();
58
+ // Verify y's type is int before the redirect.
59
+ const typeBefore = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
60
+ arg: yNode,
61
+ });
62
+ (0, assert_1.default)(typeBefore, 'y should have a computed type before redirect');
63
+ assert_1.default.strictEqual(getClassTypeName(typeBefore), 'int', 'y should be int before redirect');
64
+ // Listen for snapshot change — this proves the type server re-analyzed.
65
+ const snapshotChanged = new Promise((resolve) => {
66
+ context.onNotification(typeServerProtocol_1.TypeServerProtocol.SnapshotChangedNotification.type, (params) => {
67
+ resolve(params);
68
+ });
69
+ });
70
+ // Get the file URIs from fourslash data.
71
+ const mymodFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/mymod.py'));
72
+ (0, assert_1.default)(mymodFile, 'mymod.py should exist in fourslash files');
73
+ const virtualFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/virtual_mymod.py'));
74
+ (0, assert_1.default)(virtualFile, 'virtual_mymod.py should exist in fourslash files');
75
+ // Send the virtual file redirect notification to the type server.
76
+ context.sendNotification(tspSupplemental_1.TspSupplemental.SetVirtualFileRedirectNotification.type, {
77
+ realUri: mymodFile.fileUri.toString(),
78
+ virtualUri: virtualFile.fileUri.toString(),
79
+ });
80
+ // Wait for the snapshot change (indicates type server processed the notification
81
+ // and re-analyzed).
82
+ const params = await snapshotChanged;
83
+ (0, assert_1.default)(params.new > params.old, 'Snapshot should have incremented after redirect');
84
+ (0, assert_1.default)(params.old >= initialSnapshot, 'Old snapshot should be >= initial');
85
+ // Verify y's type changed to str after the redirect (mymod.py now serves virtual content).
86
+ const typeAfter = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
87
+ arg: yNode,
88
+ });
89
+ (0, assert_1.default)(typeAfter, 'y should have a computed type after redirect');
90
+ assert_1.default.strictEqual(getClassTypeName(typeAfter), 'str', 'y should be str after redirect');
91
+ });
92
+ });
93
+ test('removeVirtualFileRedirect triggers reanalysis and restores original types', async () => {
94
+ const code = `
95
+ // @filename: mymod.py
96
+ //// x: int = 1
97
+ //// # /*mod_marker*/
98
+
99
+ // @filename: virtual_mymod.py
100
+ //// x: str = "hello"
101
+
102
+ // @filename: test.py
103
+ //// from mymod import x
104
+ //// [|/*y*/y|] = x
105
+ //// # /*test_marker*/
106
+ `;
107
+ await (0, inProcTypeServerTestUtils_1.withInProcTypeServer)(code, async (context) => {
108
+ // Open the module file and test file.
109
+ await context.openFileForMarker('test_marker');
110
+ await context.openFileForMarker('mod_marker');
111
+ // Get the node for y so we can query its computed type.
112
+ const yNode = context.getNodeForMarker('y');
113
+ const mymodFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/mymod.py'));
114
+ (0, assert_1.default)(mymodFile, 'mymod.py should exist in fourslash files');
115
+ const virtualFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/virtual_mymod.py'));
116
+ (0, assert_1.default)(virtualFile, 'virtual_mymod.py should exist in fourslash files');
117
+ // Verify y's type is int before any redirect.
118
+ await context.refreshSnapshot();
119
+ const typeOriginal = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
120
+ arg: yNode,
121
+ });
122
+ assert_1.default.strictEqual(getClassTypeName(typeOriginal), 'int', 'y should be int before redirect');
123
+ // Add the redirect (mymod.py → virtual_mymod.py).
124
+ context.sendNotification(tspSupplemental_1.TspSupplemental.SetVirtualFileRedirectNotification.type, {
125
+ realUri: mymodFile.fileUri.toString(),
126
+ virtualUri: virtualFile.fileUri.toString(),
127
+ });
128
+ // Wait for the snapshot from the add.
129
+ await context.refreshSnapshot();
130
+ // Verify y's type is now str.
131
+ const typeRedirected = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, { arg: yNode });
132
+ assert_1.default.strictEqual(getClassTypeName(typeRedirected), 'str', 'y should be str after redirect');
133
+ // Now listen for the next snapshot change.
134
+ const snapshotChanged = new Promise((resolve) => {
135
+ context.onNotification(typeServerProtocol_1.TypeServerProtocol.SnapshotChangedNotification.type, (params) => {
136
+ resolve(params);
137
+ });
138
+ });
139
+ // Remove the redirect.
140
+ context.sendNotification(tspSupplemental_1.TspSupplemental.RemoveVirtualFileRedirectNotification.type, {
141
+ realUri: mymodFile.fileUri.toString(),
142
+ });
143
+ // Wait for the snapshot change from the removal.
144
+ const params = await snapshotChanged;
145
+ (0, assert_1.default)(params.new > params.old, 'Snapshot should have incremented after removing redirect');
146
+ // Verify y's type is back to int after removal.
147
+ const typeRestored = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
148
+ arg: yNode,
149
+ });
150
+ assert_1.default.strictEqual(getClassTypeName(typeRestored), 'int', 'y should be int after redirect removal');
151
+ });
152
+ });
153
+ test('redirect with annotated class fields updates field types', async () => {
154
+ // Simulates what happens when the Django sidecar produces a virtual
155
+ // file with type-annotated fields: the original has plain assignments,
156
+ // the virtual file has annotations.
157
+ const code = `
158
+ // @filename: models.py
159
+ //// class Author:
160
+ //// name = "default"
161
+ //// # /*mod_marker*/
162
+
163
+ // @filename: virtual_models.py
164
+ //// class Author:
165
+ //// name: str = "default"
166
+
167
+ // @filename: test.py
168
+ //// from models import Author
169
+ //// a = Author()
170
+ //// [|/*result*/result|] = a.name
171
+ //// # /*test_marker*/
172
+ `;
173
+ await (0, inProcTypeServerTestUtils_1.withInProcTypeServer)(code, async (context) => {
174
+ await context.openFileForMarker('test_marker');
175
+ await context.openFileForMarker('mod_marker');
176
+ const resultNode = context.getNodeForMarker('result');
177
+ await context.refreshSnapshot();
178
+ // Before redirect: `name = "default"` is inferred as str.
179
+ const typeBefore = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
180
+ arg: resultNode,
181
+ });
182
+ (0, assert_1.default)(typeBefore, 'result should have a computed type before redirect');
183
+ assert_1.default.strictEqual(getClassTypeName(typeBefore), 'str', 'result should be str before redirect');
184
+ // Apply redirect to the annotated virtual file.
185
+ const modelsFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/models.py'));
186
+ (0, assert_1.default)(modelsFile, 'models.py should exist');
187
+ const virtualFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/virtual_models.py'));
188
+ (0, assert_1.default)(virtualFile, 'virtual_models.py should exist');
189
+ context.sendNotification(tspSupplemental_1.TspSupplemental.SetVirtualFileRedirectNotification.type, {
190
+ realUri: modelsFile.fileUri.toString(),
191
+ virtualUri: virtualFile.fileUri.toString(),
192
+ });
193
+ await context.refreshSnapshot();
194
+ // After redirect: `name: str = "default"` — still str, but now explicitly annotated.
195
+ const typeAfter = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
196
+ arg: resultNode,
197
+ });
198
+ (0, assert_1.default)(typeAfter, 'result should have a computed type after redirect');
199
+ assert_1.default.strictEqual(getClassTypeName(typeAfter), 'str', 'result should still be str after redirect');
200
+ });
201
+ });
202
+ test('redirect changes field type when annotation differs from inferred', async () => {
203
+ // Virtual file adds a type annotation that widens the field type,
204
+ // simulating the sidecar annotating a field as Any.
205
+ const code = `
206
+ // @filename: models.py
207
+ //// class Author:
208
+ //// name = "default"
209
+ //// # /*mod_marker*/
210
+
211
+ // @filename: virtual_models.py
212
+ //// from typing import Any
213
+ //// class Author:
214
+ //// name: Any = "default"
215
+
216
+ // @filename: test.py
217
+ //// from models import Author
218
+ //// a = Author()
219
+ //// [|/*result*/result|] = a.name
220
+ //// # /*test_marker*/
221
+ `;
222
+ await (0, inProcTypeServerTestUtils_1.withInProcTypeServer)(code, async (context) => {
223
+ await context.openFileForMarker('test_marker');
224
+ await context.openFileForMarker('mod_marker');
225
+ const resultNode = context.getNodeForMarker('result');
226
+ await context.refreshSnapshot();
227
+ // Before redirect: inferred as str.
228
+ const typeBefore = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
229
+ arg: resultNode,
230
+ });
231
+ assert_1.default.strictEqual(getClassTypeName(typeBefore), 'str', 'result should be str before redirect');
232
+ // Apply redirect to virtual file where name is annotated as Any.
233
+ const modelsFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/models.py'));
234
+ const virtualFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/virtual_models.py'));
235
+ (0, assert_1.default)(modelsFile && virtualFile, 'both files should exist');
236
+ context.sendNotification(tspSupplemental_1.TspSupplemental.SetVirtualFileRedirectNotification.type, {
237
+ realUri: modelsFile.fileUri.toString(),
238
+ virtualUri: virtualFile.fileUri.toString(),
239
+ });
240
+ await context.refreshSnapshot();
241
+ // After redirect: name is annotated as Any, so result should no longer be str.
242
+ const typeAfter = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
243
+ arg: resultNode,
244
+ });
245
+ (0, assert_1.default)(typeAfter, 'result should have a computed type after redirect');
246
+ // Any is not a ClassType, it has its own kind.
247
+ assert_1.default.notStrictEqual(getClassTypeName(typeAfter), 'str', 'result should no longer be str after redirect');
248
+ });
249
+ });
250
+ test('redirect with synthetic members makes new fields visible', async () => {
251
+ // Simulates the sidecar injecting synthetic members (id, pk)
252
+ // into the virtual file.
253
+ const code = `
254
+ // @filename: models.py
255
+ //// class Author:
256
+ //// name = "default"
257
+ //// # /*mod_marker*/
258
+
259
+ // @filename: virtual_models.py
260
+ //// class Author:
261
+ //// name: str = "default"
262
+ //// id: int
263
+ //// pk: int
264
+
265
+ // @filename: test.py
266
+ //// from models import Author
267
+ //// a = Author()
268
+ //// [|/*id_val*/id_val|] = a.id
269
+ //// # /*test_marker*/
270
+ `;
271
+ await (0, inProcTypeServerTestUtils_1.withInProcTypeServer)(code, async (context) => {
272
+ await context.openFileForMarker('test_marker');
273
+ await context.openFileForMarker('mod_marker');
274
+ const idNode = context.getNodeForMarker('id_val');
275
+ // Apply redirect before checking — `id` doesn't exist in the original.
276
+ const modelsFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/models.py'));
277
+ const virtualFile = context.fourslash.files.find((f) => f.fileUri.toString().endsWith('/virtual_models.py'));
278
+ (0, assert_1.default)(modelsFile && virtualFile, 'both files should exist');
279
+ const snapshotChangedPromise = context.waitForSnapshotChanged();
280
+ context.sendNotification(tspSupplemental_1.TspSupplemental.SetVirtualFileRedirectNotification.type, {
281
+ realUri: modelsFile.fileUri.toString(),
282
+ virtualUri: virtualFile.fileUri.toString(),
283
+ });
284
+ // Wait for the snapshot changed event. The redirect (models.py is open, so the
285
+ // server reads the virtual content and updates the in-memory buffer) triggers a
286
+ // reanalysis that makes the new `id` field visible.
287
+ await snapshotChangedPromise;
288
+ await context.refreshSnapshot();
289
+ // After redirect: id should be int (from virtual file's `id: int` declaration).
290
+ const typeAfter = await context.sendRequestWithSnapshot(typeServerProtocol_1.TypeServerProtocol.GetComputedTypeRequest.type, {
291
+ arg: idNode,
292
+ });
293
+ (0, assert_1.default)(typeAfter, 'id_val should have a computed type after redirect');
294
+ assert_1.default.strictEqual(getClassTypeName(typeAfter), 'int', 'id_val should be int after redirect');
295
+ });
296
+ });
297
+ });
298
+ //# sourceMappingURL=typeServer.virtualFileRedirect.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typeServer.virtualFileRedirect.test.js","sourceRoot":"","sources":["../../../../../../src/tests/typeServer/typeServer.virtualFileRedirect.test.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;GASG;AACH,oDAA4B;AAE5B,+EAA4E;AAC5E,qFAAkF;AAClF,2EAAyG;AAEzG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAExB,mGAAmG;AACnG,SAAS,gBAAgB,CAAC,IAAyC;IAC/D,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,I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G,OAAO,CAAC,sBAAsB,EAAE,CAAC;YAChE,OAAO,CAAC,gBAAgB,CAAC,iCAAe,CAAC,kCAAkC,CAAC,IAAI,EAAE;gBAC9E,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACtC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE;aAC7C,CAAC,CAAC;YAEH,+EAA+E;YAC/E,gFAAgF;YAChF,oDAAoD;YACpD,MAAM,sBAAsB,CAAC;YAE7B,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC;YAEhC,gFAAgF;YAChF,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,uBAAuB,CAAC,uCAAkB,CAAC,sBAAsB,CAAC,IAAI,EAAE;gBACpG,GAAG,EAAE,MAAM;aACd,CAAC,CAAC;YACH,IAAA,gBAAM,EAAC,SAAS,EAAE,mDAAmD,CAAC,CAAC;YACvE,gBAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,qCAAqC,CAAC,CAAC;QAClG,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ResponseError } from 'vscode-languageserver';
2
+ export declare class ServerCanceledException extends ResponseError<void> {
3
+ constructor(message?: string | undefined);
4
+ static is(e: any): e is ServerCanceledException;
5
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ServerCanceledException = void 0;
4
+ const vscode_languageserver_1 = require("vscode-languageserver");
5
+ class ServerCanceledException extends vscode_languageserver_1.ResponseError {
6
+ constructor(message) {
7
+ super(vscode_languageserver_1.LSPErrorCodes.ServerCancelled, message || 'server cancelled');
8
+ }
9
+ static is(e) {
10
+ return e.code === vscode_languageserver_1.LSPErrorCodes.ServerCancelled;
11
+ }
12
+ }
13
+ exports.ServerCanceledException = ServerCanceledException;
14
+ //# sourceMappingURL=cancellation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancellation.js","sourceRoot":"","sources":["../../../../../src/typeServer/cancellation.ts"],"names":[],"mappings":";;;AAAA,iEAAqE;AAErE,MAAa,uBAAwB,SAAQ,qCAAmB;IAC5D,YAAY,OAA4B;QACpC,KAAK,CAAC,qCAAa,CAAC,eAAe,EAAE,OAAO,IAAI,kBAAkB,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,CAAM;QACZ,OAAO,CAAC,CAAC,IAAI,KAAK,qCAAa,CAAC,eAAe,CAAC;IACpD,CAAC;CACJ;AARD,0DAQC"}
@@ -0,0 +1,4 @@
1
+ import { Diagnostic } from 'vscode-languageserver';
2
+ import { Diagnostic as PyrightDiagnostic } from '../common/diagnostic';
3
+ import { ReadOnlyFileSystem } from '../common/fileSystem';
4
+ export declare function convertFromPyrightDiagnostic(diag: PyrightDiagnostic, fs: ReadOnlyFileSystem, supportsUnnecessaryDiagnosticTag: boolean, supportsTaskItemDiagnosticTag: boolean): Diagnostic | undefined;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /*
3
+ * diagnosticUtils.ts
4
+ * Copyright (c) Microsoft Corporation.
5
+ * Licensed under the MIT license.
6
+ *
7
+ * Converts Pyright's internal diagnostics into LSP diagnostics for the type server.
8
+ * This mirrors `LanguageServerBase._convertDiagnostics`; the Pylance-only VS "task item"
9
+ * ranking is omitted (task-item diagnostics are dropped, matching Pyright's own server).
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.convertFromPyrightDiagnostic = convertFromPyrightDiagnostic;
13
+ const vscode_languageserver_1 = require("vscode-languageserver");
14
+ const uriUtils_1 = require("../common/uri/uriUtils");
15
+ const navigationUtils_1 = require("../languageService/navigationUtils");
16
+ function convertCategoryToSeverity(category) {
17
+ switch (category) {
18
+ case 0 /* DiagnosticCategory.Error */:
19
+ return vscode_languageserver_1.DiagnosticSeverity.Error;
20
+ case 1 /* DiagnosticCategory.Warning */:
21
+ return vscode_languageserver_1.DiagnosticSeverity.Warning;
22
+ case 2 /* DiagnosticCategory.Information */:
23
+ case 6 /* DiagnosticCategory.TaskItem */:
24
+ return vscode_languageserver_1.DiagnosticSeverity.Information;
25
+ case 3 /* DiagnosticCategory.UnusedCode */:
26
+ case 4 /* DiagnosticCategory.UnreachableCode */:
27
+ case 5 /* DiagnosticCategory.Deprecated */:
28
+ return vscode_languageserver_1.DiagnosticSeverity.Hint;
29
+ }
30
+ }
31
+ function convertFromPyrightDiagnostic(diag, fs, supportsUnnecessaryDiagnosticTag, supportsTaskItemDiagnosticTag) {
32
+ const severity = convertCategoryToSeverity(diag.category);
33
+ const rule = diag.getRule();
34
+ const vsDiag = vscode_languageserver_1.Diagnostic.create(diag.range, diag.message, severity, rule, 'pyright');
35
+ // Save all of the actions in the data.
36
+ const actions = diag.getActions();
37
+ if (actions?.length) {
38
+ vsDiag.data = { ...vsDiag.data, actions: actions };
39
+ }
40
+ if (diag.category === 3 /* DiagnosticCategory.UnusedCode */ || diag.category === 4 /* DiagnosticCategory.UnreachableCode */) {
41
+ vsDiag.tags = [vscode_languageserver_1.DiagnosticTag.Unnecessary];
42
+ vsDiag.severity = vscode_languageserver_1.DiagnosticSeverity.Hint;
43
+ vsDiag.data = { ...vsDiag.data, category: diag.category, rule: rule };
44
+ // If the client doesn't support "unnecessary" tags, don't report unused code.
45
+ if (!supportsUnnecessaryDiagnosticTag) {
46
+ return undefined;
47
+ }
48
+ }
49
+ else if (diag.category === 5 /* DiagnosticCategory.Deprecated */) {
50
+ vsDiag.tags = [vscode_languageserver_1.DiagnosticTag.Deprecated];
51
+ vsDiag.severity = vscode_languageserver_1.DiagnosticSeverity.Hint;
52
+ // If the client doesn't support "deprecated" tags, don't report.
53
+ if (!supportsUnnecessaryDiagnosticTag) {
54
+ return undefined;
55
+ }
56
+ }
57
+ else if (diag.category === 6 /* DiagnosticCategory.TaskItem */) {
58
+ // Task items are a Pylance/VS-only concept; drop them unless the client opted in.
59
+ if (!supportsTaskItemDiagnosticTag) {
60
+ return undefined;
61
+ }
62
+ }
63
+ const relatedInfo = diag.getRelatedInfo();
64
+ if (relatedInfo.length > 0) {
65
+ vsDiag.relatedInformation = relatedInfo
66
+ .filter((info) => (0, navigationUtils_1.canNavigateToFile)(fs, info.uri))
67
+ .map((info) => vscode_languageserver_1.DiagnosticRelatedInformation.create(vscode_languageserver_1.Location.create((0, uriUtils_1.convertUriToLspUriString)(fs, info.uri), info.range), info.message));
68
+ }
69
+ return vsDiag;
70
+ }
71
+ //# sourceMappingURL=diagnosticUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnosticUtils.js","sourceRoot":"","sources":["../../../../../src/typeServer/diagnosticUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAkCH,oEAqDC;AArFD,iEAM+B;AAI/B,qDAAkE;AAClE,wEAAuE;AAEvE,SAAS,yBAAyB,CAAC,QAA4B;IAC3D,QAAQ,QAAQ,EAAE,CAAC;QACf;YACI,OAAO,0CAAkB,CAAC,KAAK,CAAC;QAEpC;YACI,OAAO,0CAAkB,CAAC,OAAO,CAAC;QAEtC,4CAAoC;QACpC;YACI,OAAO,0CAAkB,CAAC,WAAW,CAAC;QAE1C,2CAAmC;QACnC,gDAAwC;QACxC;YACI,OAAO,0CAAkB,CAAC,IAAI,CAAC;IACvC,CAAC;AACL,CAAC;AAED,SAAgB,4BAA4B,CACxC,IAAuB,EACvB,EAAsB,EACtB,gCAAyC,EACzC,6BAAsC;IAEtC,MAAM,QAAQ,GAAG,yBAAyB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,kCAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAEtF,u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WAAW;aAClC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mCAAiB,EAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;aACjD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACV,oDAA4B,CAAC,MAAM,CAC/B,gCAAQ,CAAC,MAAM,CAAC,IAAA,mCAAwB,EAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EACnE,IAAI,CAAC,OAAO,CACf,CACJ,CAAC;IACV,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { VariableDeclaration } from '../analyzer/declaration';
2
+ import { Arg, TypeResult } from '../analyzer/typeEvaluatorTypes';
3
+ import { ClassType, Type } from '../analyzer/types';
4
+ import { ExpressionNode, ParseNode } from '../parser/parseNodes';
5
+ import { ITypeServerEvaluator } from './typeServerEvaluator';
6
+ export declare function isEnumMetaclass(classType: ClassType): boolean;
7
+ export declare function isEnumClassWithMembers(evaluator: ITypeServerEvaluator, classType: ClassType): boolean;
8
+ export declare function createEnumType(evaluator: ITypeServerEvaluator, errorNode: ExpressionNode, enumClass: ClassType, argList: Arg[]): ClassType | undefined;
9
+ export declare function transformTypeForEnumMember(evaluator: ITypeServerEvaluator, classType: ClassType, memberName: string, ignoreAnnotation?: boolean, recursionCount?: number): Type | undefined;
10
+ export declare function isDeclInEnumClass(evaluator: ITypeServerEvaluator, decl: VariableDeclaration): boolean;
11
+ export declare function getEnumDeclaredValueType(evaluator: ITypeServerEvaluator, classType: ClassType, declaredTypesOnly?: boolean): Type | undefined;
12
+ export declare function getTypeOfEnumMember(evaluator: ITypeServerEvaluator, errorNode: ParseNode, classType: ClassType, memberName: string, isIncomplete: boolean): TypeResult | undefined;
13
+ export declare function getEnumAutoValueType(evaluator: ITypeServerEvaluator, node: ExpressionNode): Type;
14
+ export declare function isReprEnumClass(enumClass: ClassType): boolean;