@zzzen/pyright-internal 1.2.0-dev.20241208 → 1.2.0-dev.20241222

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 (285) hide show
  1. package/dist/analyzer/analysis.js +1 -1
  2. package/dist/analyzer/analysis.js.map +1 -1
  3. package/dist/analyzer/analyzerNodeInfo.js +17 -18
  4. package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
  5. package/dist/analyzer/backgroundAnalysisProgram.js +18 -35
  6. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  7. package/dist/analyzer/binder.js +38 -55
  8. package/dist/analyzer/binder.js.map +1 -1
  9. package/dist/analyzer/checker.js +146 -185
  10. package/dist/analyzer/checker.js.map +1 -1
  11. package/dist/analyzer/codeFlowEngine.js +24 -31
  12. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  13. package/dist/analyzer/constraintSolver.js +23 -24
  14. package/dist/analyzer/constraintSolver.js.map +1 -1
  15. package/dist/analyzer/constraintTracker.js +1 -2
  16. package/dist/analyzer/constraintTracker.js.map +1 -1
  17. package/dist/analyzer/constructorTransform.js +10 -12
  18. package/dist/analyzer/constructorTransform.js.map +1 -1
  19. package/dist/analyzer/constructors.js +14 -19
  20. package/dist/analyzer/constructors.js.map +1 -1
  21. package/dist/analyzer/dataClasses.js +32 -27
  22. package/dist/analyzer/dataClasses.js.map +1 -1
  23. package/dist/analyzer/declarationUtils.js +8 -11
  24. package/dist/analyzer/declarationUtils.js.map +1 -1
  25. package/dist/analyzer/decorators.js +2 -3
  26. package/dist/analyzer/decorators.js.map +1 -1
  27. package/dist/analyzer/docStringConversion.js +6 -8
  28. package/dist/analyzer/docStringConversion.js.map +1 -1
  29. package/dist/analyzer/enums.js +12 -13
  30. package/dist/analyzer/enums.js.map +1 -1
  31. package/dist/analyzer/functionTransform.js +1 -2
  32. package/dist/analyzer/functionTransform.js.map +1 -1
  33. package/dist/analyzer/importResolver.js +18 -27
  34. package/dist/analyzer/importResolver.js.map +1 -1
  35. package/dist/analyzer/importStatementUtils.js +4 -5
  36. package/dist/analyzer/importStatementUtils.js.map +1 -1
  37. package/dist/analyzer/namedTuples.js +6 -7
  38. package/dist/analyzer/namedTuples.js.map +1 -1
  39. package/dist/analyzer/operations.js +14 -17
  40. package/dist/analyzer/operations.js.map +1 -1
  41. package/dist/analyzer/packageTypeVerifier.js +48 -50
  42. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  43. package/dist/analyzer/parameterUtils.js +5 -7
  44. package/dist/analyzer/parameterUtils.js.map +1 -1
  45. package/dist/analyzer/parentDirectoryCache.js +8 -9
  46. package/dist/analyzer/parentDirectoryCache.js.map +1 -1
  47. package/dist/analyzer/parseTreeUtils.js +30 -44
  48. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  49. package/dist/analyzer/parseTreeWalker.js +2 -3
  50. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  51. package/dist/analyzer/patternMatching.js +18 -20
  52. package/dist/analyzer/patternMatching.js.map +1 -1
  53. package/dist/analyzer/program.js +29 -40
  54. package/dist/analyzer/program.js.map +1 -1
  55. package/dist/analyzer/properties.js +7 -8
  56. package/dist/analyzer/properties.js.map +1 -1
  57. package/dist/analyzer/protocols.js +21 -23
  58. package/dist/analyzer/protocols.js.map +1 -1
  59. package/dist/analyzer/pythonPathUtils.js +1 -1
  60. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  61. package/dist/analyzer/scope.js +10 -10
  62. package/dist/analyzer/scope.js.map +1 -1
  63. package/dist/analyzer/service.js +32 -47
  64. package/dist/analyzer/service.js.map +1 -1
  65. package/dist/analyzer/sourceFile.js +21 -26
  66. package/dist/analyzer/sourceFile.js.map +1 -1
  67. package/dist/analyzer/sourceFileInfo.js +2 -3
  68. package/dist/analyzer/sourceFileInfo.js.map +1 -1
  69. package/dist/analyzer/sourceFileInfoUtils.js +5 -5
  70. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  71. package/dist/analyzer/sourceMapper.js +19 -30
  72. package/dist/analyzer/sourceMapper.js.map +1 -1
  73. package/dist/analyzer/testWalker.js +1 -2
  74. package/dist/analyzer/testWalker.js.map +1 -1
  75. package/dist/analyzer/tracePrinter.js +7 -9
  76. package/dist/analyzer/tracePrinter.js.map +1 -1
  77. package/dist/analyzer/tuples.js +11 -13
  78. package/dist/analyzer/tuples.js.map +1 -1
  79. package/dist/analyzer/typeCacheUtils.js +5 -6
  80. package/dist/analyzer/typeCacheUtils.js.map +1 -1
  81. package/dist/analyzer/typeDocStringUtils.js +7 -11
  82. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  83. package/dist/analyzer/typeEvaluator.js +619 -776
  84. package/dist/analyzer/typeEvaluator.js.map +1 -1
  85. package/dist/analyzer/typeEvaluatorTypes.d.ts +1 -1
  86. package/dist/analyzer/typeEvaluatorWithTracker.js +2 -2
  87. package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -1
  88. package/dist/analyzer/typeGuards.js +26 -36
  89. package/dist/analyzer/typeGuards.js.map +1 -1
  90. package/dist/analyzer/typePrinter.js +15 -24
  91. package/dist/analyzer/typePrinter.js.map +1 -1
  92. package/dist/analyzer/typeStubWriter.js +1 -2
  93. package/dist/analyzer/typeStubWriter.js.map +1 -1
  94. package/dist/analyzer/typeUtils.js +65 -94
  95. package/dist/analyzer/typeUtils.js.map +1 -1
  96. package/dist/analyzer/typeWalker.js +4 -8
  97. package/dist/analyzer/typeWalker.js.map +1 -1
  98. package/dist/analyzer/typedDicts.js +39 -46
  99. package/dist/analyzer/typedDicts.js.map +1 -1
  100. package/dist/analyzer/types.d.ts +1 -0
  101. package/dist/analyzer/types.js +64 -103
  102. package/dist/analyzer/types.js.map +1 -1
  103. package/dist/backgroundAnalysis.js +2 -3
  104. package/dist/backgroundAnalysis.js.map +1 -1
  105. package/dist/backgroundAnalysisBase.js +9 -10
  106. package/dist/backgroundAnalysisBase.js.map +1 -1
  107. package/dist/backgroundThreadBase.js +6 -7
  108. package/dist/backgroundThreadBase.js.map +1 -1
  109. package/dist/commands/createTypeStub.js +1 -1
  110. package/dist/commands/createTypeStub.js.map +1 -1
  111. package/dist/commands/dumpFileDebugInfoCommand.js +3 -3
  112. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  113. package/dist/commands/quickActionCommand.js +1 -1
  114. package/dist/commands/quickActionCommand.js.map +1 -1
  115. package/dist/common/asyncInitialization.js +1 -1
  116. package/dist/common/chokidarFileWatcherProvider.js +2 -4
  117. package/dist/common/chokidarFileWatcherProvider.js.map +1 -1
  118. package/dist/common/configOptions.js +6 -9
  119. package/dist/common/configOptions.js.map +1 -1
  120. package/dist/common/console.js +1 -2
  121. package/dist/common/console.js.map +1 -1
  122. package/dist/common/core.js +2 -2
  123. package/dist/common/core.js.map +1 -1
  124. package/dist/common/crypto.js +1 -1
  125. package/dist/common/crypto.js.map +1 -1
  126. package/dist/common/diagnostic.js +3 -5
  127. package/dist/common/diagnostic.js.map +1 -1
  128. package/dist/common/envVarUtils.js +1 -1
  129. package/dist/common/envVarUtils.js.map +1 -1
  130. package/dist/common/extensibility.d.ts +1 -0
  131. package/dist/common/extensibility.js.map +1 -1
  132. package/dist/common/fileSystem.d.ts +1 -0
  133. package/dist/common/fileSystem.js.map +1 -1
  134. package/dist/common/fullAccessHost.js +5 -5
  135. package/dist/common/fullAccessHost.js.map +1 -1
  136. package/dist/common/host.js +1 -1
  137. package/dist/common/host.js.map +1 -1
  138. package/dist/common/logTracker.js +1 -1
  139. package/dist/common/logTracker.js.map +1 -1
  140. package/dist/common/lspUtils.js +1 -2
  141. package/dist/common/lspUtils.js.map +1 -1
  142. package/dist/common/progressReporter.js +1 -2
  143. package/dist/common/progressReporter.js.map +1 -1
  144. package/dist/common/realFileSystem.js +2 -3
  145. package/dist/common/realFileSystem.js.map +1 -1
  146. package/dist/common/serviceProvider.js +1 -1
  147. package/dist/common/serviceProvider.js.map +1 -1
  148. package/dist/common/streamUtils.d.ts +2 -0
  149. package/dist/common/streamUtils.js +29 -0
  150. package/dist/common/streamUtils.js.map +1 -0
  151. package/dist/common/textEditTracker.js +4 -6
  152. package/dist/common/textEditTracker.js.map +1 -1
  153. package/dist/common/tomlUtils.js +3 -1
  154. package/dist/common/tomlUtils.js.map +1 -1
  155. package/dist/common/uri/baseUri.js +1 -1
  156. package/dist/common/uri/baseUri.js.map +1 -1
  157. package/dist/common/uri/emptyUri.js +1 -1
  158. package/dist/common/uri/emptyUri.js.map +1 -1
  159. package/dist/common/uri/fileUri.js +2 -2
  160. package/dist/common/uri/fileUri.js.map +1 -1
  161. package/dist/common/uri/memoization.js +1 -1
  162. package/dist/common/uri/memoization.js.map +1 -1
  163. package/dist/common/uri/uri.js +2 -3
  164. package/dist/common/uri/uri.js.map +1 -1
  165. package/dist/common/uri/uriUtils.js +6 -8
  166. package/dist/common/uri/uriUtils.js.map +1 -1
  167. package/dist/common/uri/webUri.js +2 -2
  168. package/dist/common/uri/webUri.js.map +1 -1
  169. package/dist/common/workspaceEditUtils.js +10 -15
  170. package/dist/common/workspaceEditUtils.js.map +1 -1
  171. package/dist/languageServerBase.js +34 -42
  172. package/dist/languageServerBase.js.map +1 -1
  173. package/dist/languageService/analyzerServiceExecutor.js +8 -10
  174. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  175. package/dist/languageService/autoImporter.js +16 -19
  176. package/dist/languageService/autoImporter.js.map +1 -1
  177. package/dist/languageService/callHierarchyProvider.js +6 -11
  178. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  179. package/dist/languageService/completionProvider.js +81 -106
  180. package/dist/languageService/completionProvider.js.map +1 -1
  181. package/dist/languageService/completionProviderUtils.js +3 -3
  182. package/dist/languageService/completionProviderUtils.js.map +1 -1
  183. package/dist/languageService/definitionProvider.js +6 -9
  184. package/dist/languageService/definitionProvider.js.map +1 -1
  185. package/dist/languageService/documentSymbolCollector.js +32 -32
  186. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  187. package/dist/languageService/dynamicFeature.js +1 -2
  188. package/dist/languageService/dynamicFeature.js.map +1 -1
  189. package/dist/languageService/hoverProvider.js +17 -23
  190. package/dist/languageService/hoverProvider.js.map +1 -1
  191. package/dist/languageService/referencesProvider.js +4 -9
  192. package/dist/languageService/referencesProvider.js.map +1 -1
  193. package/dist/languageService/renameProvider.js +2 -4
  194. package/dist/languageService/renameProvider.js.map +1 -1
  195. package/dist/languageService/signatureHelpProvider.js +11 -15
  196. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  197. package/dist/languageService/tooltipUtils.js +15 -17
  198. package/dist/languageService/tooltipUtils.js.map +1 -1
  199. package/dist/localization/localize.js +3 -3
  200. package/dist/localization/localize.js.map +1 -1
  201. package/dist/localization/package.nls.cs.json +6 -0
  202. package/dist/localization/package.nls.de.json +6 -0
  203. package/dist/localization/package.nls.en-us.json +8 -8
  204. package/dist/localization/package.nls.es.json +6 -0
  205. package/dist/localization/package.nls.fr.json +7 -1
  206. package/dist/localization/package.nls.it.json +6 -0
  207. package/dist/localization/package.nls.ja.json +6 -0
  208. package/dist/localization/package.nls.ko.json +6 -0
  209. package/dist/localization/package.nls.pl.json +6 -0
  210. package/dist/localization/package.nls.pt-br.json +6 -0
  211. package/dist/localization/package.nls.qps-ploc.json +6 -0
  212. package/dist/localization/package.nls.ru.json +6 -0
  213. package/dist/localization/package.nls.tr.json +6 -0
  214. package/dist/localization/package.nls.zh-cn.json +6 -0
  215. package/dist/localization/package.nls.zh-tw.json +6 -0
  216. package/dist/parser/parser.js +30 -38
  217. package/dist/parser/parser.js.map +1 -1
  218. package/dist/parser/tokenizer.js +8 -13
  219. package/dist/parser/tokenizer.js.map +1 -1
  220. package/dist/pprof/profiler.js +3 -3
  221. package/dist/pprof/profiler.js.map +1 -1
  222. package/dist/pyright.js +9 -11
  223. package/dist/pyright.js.map +1 -1
  224. package/dist/pyrightFileSystem.js +4 -5
  225. package/dist/pyrightFileSystem.js.map +1 -1
  226. package/dist/readonlyAugmentedFileSystem.js +3 -5
  227. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  228. package/dist/server.js +1 -1
  229. package/dist/server.js.map +1 -1
  230. package/dist/tests/chainedSourceFiles.test.js +3 -3
  231. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  232. package/dist/tests/classDeclaration.test.js +7 -10
  233. package/dist/tests/classDeclaration.test.js.map +1 -1
  234. package/dist/tests/completions.test.js +3 -3
  235. package/dist/tests/completions.test.js.map +1 -1
  236. package/dist/tests/config.test.js +10 -15
  237. package/dist/tests/config.test.js.map +1 -1
  238. package/dist/tests/diagnosticOverrides.test.js +4 -6
  239. package/dist/tests/diagnosticOverrides.test.js.map +1 -1
  240. package/dist/tests/envVarUtils.test.js +9 -12
  241. package/dist/tests/envVarUtils.test.js.map +1 -1
  242. package/dist/tests/harness/fourslash/testLanguageService.js +1 -1
  243. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  244. package/dist/tests/harness/fourslash/testState.js +45 -60
  245. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  246. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +6 -7
  247. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -1
  248. package/dist/tests/harness/vfs/filesystem.js +3 -3
  249. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  250. package/dist/tests/importResolver.test.js +6 -7
  251. package/dist/tests/importResolver.test.js.map +1 -1
  252. package/dist/tests/importStatementUtils.test.js +2 -2
  253. package/dist/tests/importStatementUtils.test.js.map +1 -1
  254. package/dist/tests/ipythonMode.test.js +11 -12
  255. package/dist/tests/ipythonMode.test.js.map +1 -1
  256. package/dist/tests/languageServer.test.js +1 -2
  257. package/dist/tests/languageServer.test.js.map +1 -1
  258. package/dist/tests/lsp/languageServer.js +10 -14
  259. package/dist/tests/lsp/languageServer.js.map +1 -1
  260. package/dist/tests/lsp/languageServerTestUtils.js +10 -14
  261. package/dist/tests/lsp/languageServerTestUtils.js.map +1 -1
  262. package/dist/tests/parseTreeUtils.test.js +7 -7
  263. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  264. package/dist/tests/parser.test.js +2 -2
  265. package/dist/tests/parser.test.js.map +1 -1
  266. package/dist/tests/service.test.js +2 -3
  267. package/dist/tests/service.test.js.map +1 -1
  268. package/dist/tests/sourceFile.test.js +2 -3
  269. package/dist/tests/sourceFile.test.js.map +1 -1
  270. package/dist/tests/sourceMapperUtils.test.js +3 -4
  271. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  272. package/dist/tests/testState.test.js +3 -6
  273. package/dist/tests/testState.test.js.map +1 -1
  274. package/dist/tests/testStateUtils.js +3 -4
  275. package/dist/tests/testStateUtils.js.map +1 -1
  276. package/dist/tests/textEditUtil.test.js +2 -2
  277. package/dist/tests/textEditUtil.test.js.map +1 -1
  278. package/dist/tests/typeEvaluator1.test.js +1 -1
  279. package/dist/tests/typePrinter.test.js +1 -2
  280. package/dist/tests/typePrinter.test.js.map +1 -1
  281. package/dist/tests/workspaceEditUtils.test.js +3 -5
  282. package/dist/tests/workspaceEditUtils.test.js.map +1 -1
  283. package/dist/workspaceFactory.js +2 -3
  284. package/dist/workspaceFactory.js.map +1 -1
  285. package/package.json +1 -1
@@ -100,12 +100,13 @@ class TestState {
100
100
  const vfsInfo = (0, testStateUtils_1.createVfsInfoFromFourSlashData)(projectRoot, testData);
101
101
  this._vfsFiles = vfsInfo.files;
102
102
  this.testFS =
103
- testFS !== null && testFS !== void 0 ? testFS : (0, factory_1.createFromFileSystem)(host.HOST, vfsInfo.ignoreCase, { cwd: vfsInfo.projectRoot, files: vfsInfo.files, meta: testData.globalOptions }, mountPaths);
103
+ testFS ??
104
+ (0, factory_1.createFromFileSystem)(host.HOST, vfsInfo.ignoreCase, { cwd: vfsInfo.projectRoot, files: vfsInfo.files, meta: testData.globalOptions }, mountPaths);
104
105
  this.fs = new pyrightFileSystem_1.PyrightFileSystem(this.testFS);
105
106
  this.console = new console_1.ConsoleWithLogLevel(new console_1.NullConsole(), 'test');
106
107
  this.serviceProvider = (0, serviceProviderExtensions_1.createServiceProvider)(this.testFS, this.fs, this.console);
107
108
  this._cancellationToken = new fourSlashTypes_1.TestCancellationToken();
108
- this._hostSpecificFeatures = hostSpecificFeatures !== null && hostSpecificFeatures !== void 0 ? hostSpecificFeatures : new testLanguageService_1.TestFeatures();
109
+ this._hostSpecificFeatures = hostSpecificFeatures ?? new testLanguageService_1.TestFeatures();
109
110
  this.files = vfsInfo.sourceFileNames;
110
111
  this.rawConfigJson = vfsInfo.rawConfigJson;
111
112
  const configOptions = this._convertGlobalOptionsToConfigOptions(vfsInfo.projectRoot, mountPaths);
@@ -151,15 +152,14 @@ class TestState {
151
152
  return this.getFileContent(this.activeFile.fileName).length;
152
153
  }
153
154
  initializeFiles() {
154
- var _a, _b;
155
155
  if (this.files.length > 0) {
156
156
  // Open the first file by default
157
157
  this.openFile(this.files[0]);
158
158
  }
159
159
  for (const filePath of this.files) {
160
160
  const file = this._vfsFiles[filePath];
161
- if ((_a = file.meta) === null || _a === void 0 ? void 0 : _a["ipythonmode" /* MetadataOptionNames.ipythonMode */]) {
162
- (_b = this.program.getSourceFile(uri_1.Uri.file(filePath, this.serviceProvider))) === null || _b === void 0 ? void 0 : _b.test_enableIPythonMode(true);
161
+ if (file.meta?.["ipythonmode" /* MetadataOptionNames.ipythonMode */]) {
162
+ this.program.getSourceFile(uri_1.Uri.file(filePath, this.serviceProvider))?.test_enableIPythonMode(true);
163
163
  }
164
164
  }
165
165
  }
@@ -300,7 +300,7 @@ class TestState {
300
300
  return result;
301
301
  }
302
302
  getFilteredRanges(predicate) {
303
- return this.getRanges().filter((r) => { var _a; return predicate(r.marker, (_a = r.marker) === null || _a === void 0 ? void 0 : _a.data, this.rangeText(r)); });
303
+ return this.getRanges().filter((r) => predicate(r.marker, r.marker?.data, this.rangeText(r)));
304
304
  }
305
305
  getRangeByMarkerName(markerName) {
306
306
  return (0, testStateUtils_1.getRangeByMarkerName)(this.testData, markerName);
@@ -486,7 +486,6 @@ class TestState {
486
486
  }
487
487
  }
488
488
  async verifyCodeActions(verifyMode, map) {
489
- var _a, _b;
490
489
  // make sure we don't use cache built from other tests
491
490
  this.workspace.service.invalidateAndForceReanalysis(backgroundAnalysisProgram_1.InvalidatedReason.Reanalyzed);
492
491
  this.analyze();
@@ -540,7 +539,7 @@ class TestState {
540
539
  const sourceFile = this.program.getSourceFile(uri);
541
540
  const symbolsInTest2 = sourceFile
542
541
  ? ', symbols in test2.py: ' +
543
- Array.from((_b = (_a = sourceFile.getModuleSymbolTable()) === null || _a === void 0 ? void 0 : _a.keys()) !== null && _b !== void 0 ? _b : []).join(',')
542
+ Array.from(sourceFile.getModuleSymbolTable()?.keys() ?? []).join(',')
544
543
  : '';
545
544
  this.raiseError(`doesn't contain expected result: ${(0, utils_1.stringify)(expected)}, actual: ${(0, utils_1.stringify)(codeActions)}, diagnostics: ${(0, utils_1.stringify)(diagnostics)}${symbolsInTest2}`);
546
545
  }
@@ -558,7 +557,7 @@ class TestState {
558
557
  }
559
558
  }
560
559
  }
561
- return args === null || args === void 0 ? void 0 : args.map((a) => {
560
+ return args?.map((a) => {
562
561
  if ((0, core_1.isString)(a)) {
563
562
  // Might be a URI. For comparison purposes in a test, convert it into a
564
563
  // file path.
@@ -572,10 +571,9 @@ class TestState {
572
571
  }
573
572
  }
574
573
  async verifyCommand(command, files) {
575
- var _a;
576
574
  this.analyze();
577
575
  // Convert command arguments to file Uri strings. That's the expected input for command arguments.
578
- const convertedArgs = (_a = command.arguments) === null || _a === void 0 ? void 0 : _a.map((arg) => {
576
+ const convertedArgs = command.arguments?.map((arg) => {
579
577
  if (typeof arg === 'string' && (arg.endsWith('.py') || arg.endsWith('.pyi'))) {
580
578
  return uri_1.Uri.file(arg, this.serviceProvider).toString();
581
579
  }
@@ -604,7 +602,6 @@ class TestState {
604
602
  return (0, workspaceEditTestUtils_1.verifyWorkspaceEdit)(expected, actual, marker);
605
603
  }
606
604
  async verifyInvokeCodeAction(map, verifyCodeActionCount) {
607
- var _a;
608
605
  this.analyze();
609
606
  for (const range of this.getRanges()) {
610
607
  const name = this.getMarkerName(range.marker);
@@ -625,7 +622,7 @@ class TestState {
625
622
  for (const codeAction of matches) {
626
623
  const results = await this._hostSpecificFeatures.execute(ls, {
627
624
  command: codeAction.command.command,
628
- arguments: ((_a = codeAction.command) === null || _a === void 0 ? void 0 : _a.arguments) || [],
625
+ arguments: codeAction.command?.arguments || [],
629
626
  }, vscode_languageserver_1.CancellationToken.None);
630
627
  if (map[name].edits) {
631
628
  const workspaceEdits = commandResult_1.CommandResult.is(results) ? results.edits : results;
@@ -770,7 +767,6 @@ class TestState {
770
767
  }
771
768
  }
772
769
  verifySignature(docFormat, map) {
773
- var _a, _b;
774
770
  this.analyze();
775
771
  for (const marker of this.getMarkers()) {
776
772
  const fileName = marker.fileName;
@@ -813,14 +809,13 @@ class TestState {
813
809
  });
814
810
  assert_1.default.deepEqual(actual.signatures.map((sig) => sig.activeParameter), expected.activeParameters);
815
811
  if (expected.callHasParameters !== undefined) {
816
- const isActive = (sig) => { var _a; return !expected.callHasParameters && !((_a = sig.parameters) === null || _a === void 0 ? void 0 : _a.length); };
817
- const activeSignature = (_b = (_a = expected.signatures) === null || _a === void 0 ? void 0 : _a.findIndex(isActive)) !== null && _b !== void 0 ? _b : undefined;
812
+ const isActive = (sig) => !expected.callHasParameters && !sig.parameters?.length;
813
+ const activeSignature = expected.signatures?.findIndex(isActive) ?? undefined;
818
814
  assert_1.default.equal(actual.activeSignature, activeSignature);
819
815
  }
820
816
  }
821
817
  }
822
818
  verifyFindAllReferences(map, createDocumentRange, convertToLocation) {
823
- var _a;
824
819
  this.analyze();
825
820
  for (const name of this.getMarkerNames()) {
826
821
  const marker = this.getMarkerByName(name);
@@ -830,22 +825,20 @@ class TestState {
830
825
  }
831
826
  let expected = map[name].references;
832
827
  expected = expected.map((c) => {
833
- var _a;
834
828
  return {
835
829
  ...c,
836
- uri: (_a = c.uri) !== null && _a !== void 0 ? _a : uri_1.Uri.file(c.path, this.serviceProvider),
830
+ uri: c.uri ?? uri_1.Uri.file(c.path, this.serviceProvider),
837
831
  };
838
832
  });
839
833
  const position = this.convertOffsetToPosition(fileName, marker.position);
840
834
  const actual = new referencesProvider_1.ReferencesProvider(this.program, vscode_languageserver_1.CancellationToken.None, createDocumentRange, convertToLocation).reportReferences(uri_1.Uri.file(fileName, this.serviceProvider), position, /* includeDeclaration */ true);
841
- assert_1.default.strictEqual((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expected.length, `${name} has failed`);
835
+ assert_1.default.strictEqual(actual?.length ?? 0, expected.length, `${name} has failed`);
842
836
  for (const r of (0, navigationUtils_1.convertDocumentRangesToLocation)(this.program.fileSystem, expected, convertToLocation)) {
843
- assert_1.default.equal(actual === null || actual === void 0 ? void 0 : actual.filter((d) => this._deepEqual(d, r)).length, 1);
837
+ assert_1.default.equal(actual?.filter((d) => this._deepEqual(d, r)).length, 1);
844
838
  }
845
839
  }
846
840
  }
847
841
  verifyShowCallHierarchyGetIncomingCalls(map) {
848
- var _a, _b, _c;
849
842
  this.analyze();
850
843
  for (const marker of this.getMarkers()) {
851
844
  const fileName = marker.fileName;
@@ -858,20 +851,19 @@ class TestState {
858
851
  const expectedName = map[name].items.map((x) => x.name);
859
852
  const position = this.convertOffsetToPosition(fileName, marker.position);
860
853
  const actual = new callHierarchyProvider_1.CallHierarchyProvider(this.program, uri_1.Uri.file(fileName, this.serviceProvider), position, vscode_languageserver_1.CancellationToken.None).getIncomingCalls();
861
- assert_1.default.strictEqual((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expectedFilePath.length, `${name} has failed`);
862
- assert_1.default.strictEqual((_b = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _b !== void 0 ? _b : 0, expectedRange.length, `${name} has failed`);
863
- assert_1.default.strictEqual((_c = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _c !== void 0 ? _c : 0, expectedName.length, `${name} has failed`);
854
+ assert_1.default.strictEqual(actual?.length ?? 0, expectedFilePath.length, `${name} has failed`);
855
+ assert_1.default.strictEqual(actual?.length ?? 0, expectedRange.length, `${name} has failed`);
856
+ assert_1.default.strictEqual(actual?.length ?? 0, expectedName.length, `${name} has failed`);
864
857
  if (actual) {
865
858
  for (const a of actual) {
866
- assert_1.default.strictEqual(expectedRange === null || expectedRange === void 0 ? void 0 : expectedRange.filter((e) => this._deepEqual(a.from.range, e)).length, 1);
867
- assert_1.default.strictEqual(expectedName === null || expectedName === void 0 ? void 0 : expectedName.filter((e) => this._deepEqual(a.from.name, e)).length, 1);
868
- assert_1.default.ok((expectedFilePath === null || expectedFilePath === void 0 ? void 0 : expectedFilePath.filter((e) => this._deepEqual(a.from.uri, uri_1.Uri.file(e, this.serviceProvider).toString())).length) >= 1);
859
+ assert_1.default.strictEqual(expectedRange?.filter((e) => this._deepEqual(a.from.range, e)).length, 1);
860
+ assert_1.default.strictEqual(expectedName?.filter((e) => this._deepEqual(a.from.name, e)).length, 1);
861
+ assert_1.default.ok(expectedFilePath?.filter((e) => this._deepEqual(a.from.uri, uri_1.Uri.file(e, this.serviceProvider).toString())).length >= 1);
869
862
  }
870
863
  }
871
864
  }
872
865
  }
873
866
  verifyShowCallHierarchyGetOutgoingCalls(map) {
874
- var _a, _b, _c;
875
867
  this.analyze();
876
868
  for (const marker of this.getMarkers()) {
877
869
  const fileName = marker.fileName;
@@ -884,20 +876,20 @@ class TestState {
884
876
  const expectedName = map[name].items.map((x) => x.name);
885
877
  const position = this.convertOffsetToPosition(fileName, marker.position);
886
878
  const actual = new callHierarchyProvider_1.CallHierarchyProvider(this.program, uri_1.Uri.file(fileName, this.serviceProvider), position, vscode_languageserver_1.CancellationToken.None).getOutgoingCalls();
887
- assert_1.default.strictEqual((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expectedFilePath.length, `${name} has failed`);
888
- assert_1.default.strictEqual((_b = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _b !== void 0 ? _b : 0, expectedRange.length, `${name} has failed`);
889
- assert_1.default.strictEqual((_c = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _c !== void 0 ? _c : 0, expectedName.length, `${name} has failed`);
879
+ assert_1.default.strictEqual(actual?.length ?? 0, expectedFilePath.length, `${name} has failed`);
880
+ assert_1.default.strictEqual(actual?.length ?? 0, expectedRange.length, `${name} has failed`);
881
+ assert_1.default.strictEqual(actual?.length ?? 0, expectedName.length, `${name} has failed`);
890
882
  if (actual) {
891
883
  for (const a of actual) {
892
- assert_1.default.strictEqual(expectedRange === null || expectedRange === void 0 ? void 0 : expectedRange.filter((e) => this._deepEqual(a.to.range, e)).length, 1);
893
- assert_1.default.strictEqual(expectedName === null || expectedName === void 0 ? void 0 : expectedName.filter((e) => this._deepEqual(a.to.name, e)).length, 1);
894
- assert_1.default.ok((expectedFilePath === null || expectedFilePath === void 0 ? void 0 : expectedFilePath.filter((e) => this._deepEqual(a.to.uri, uri_1.Uri.file(e, this.serviceProvider).toString())).length) >= 1);
884
+ assert_1.default.strictEqual(expectedRange?.filter((e) => this._deepEqual(a.to.range, e)).length, 1);
885
+ assert_1.default.strictEqual(expectedName?.filter((e) => this._deepEqual(a.to.name, e)).length, 1);
886
+ assert_1.default.ok(expectedFilePath?.filter((e) => this._deepEqual(a.to.uri, uri_1.Uri.file(e, this.serviceProvider).toString())).length >= 1);
895
887
  }
896
888
  }
897
889
  }
898
890
  }
899
891
  getDocumentHighlightKind(m) {
900
- const kind = (m === null || m === void 0 ? void 0 : m.data) ? m.data.kind : undefined;
892
+ const kind = m?.data ? m.data.kind : undefined;
901
893
  switch (kind) {
902
894
  case 'text':
903
895
  return vscode_languageserver_1.DocumentHighlightKind.Text;
@@ -910,7 +902,6 @@ class TestState {
910
902
  }
911
903
  }
912
904
  verifyHighlightReferences(map) {
913
- var _a;
914
905
  this.analyze();
915
906
  for (const name of Object.keys(map)) {
916
907
  const marker = this.getMarkerByName(name);
@@ -918,10 +909,10 @@ class TestState {
918
909
  const expected = map[name].references;
919
910
  const position = this.convertOffsetToPosition(fileName, marker.position);
920
911
  const actual = new documentHighlightProvider_1.DocumentHighlightProvider(this.program, uri_1.Uri.file(fileName, this.serviceProvider), position, vscode_languageserver_1.CancellationToken.None).getDocumentHighlight();
921
- assert_1.default.equal((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expected.length);
912
+ assert_1.default.equal(actual?.length ?? 0, expected.length);
922
913
  for (const r of expected) {
923
- const match = actual === null || actual === void 0 ? void 0 : actual.filter((h) => this._deepEqual(h.range, r.range));
924
- assert_1.default.equal(match === null || match === void 0 ? void 0 : match.length, 1);
914
+ const match = actual?.filter((h) => this._deepEqual(h.range, r.range));
915
+ assert_1.default.equal(match?.length, 1);
925
916
  if (r.kind) {
926
917
  assert_1.default.equal(match[0].kind, r.kind);
927
918
  }
@@ -929,7 +920,7 @@ class TestState {
929
920
  }
930
921
  }
931
922
  fixupDefinitionsToMatchExpected(actual) {
932
- return actual === null || actual === void 0 ? void 0 : actual.map((a) => {
923
+ return actual?.map((a) => {
933
924
  const { uri, ...restOfActual } = a;
934
925
  return {
935
926
  ...restOfActual,
@@ -938,7 +929,6 @@ class TestState {
938
929
  });
939
930
  }
940
931
  verifyFindDefinitions(map, filter = definitionProvider_1.DefinitionFilter.All) {
941
- var _a;
942
932
  this.analyze();
943
933
  for (const marker of this.getMarkers()) {
944
934
  const fileName = marker.fileName;
@@ -957,15 +947,14 @@ class TestState {
957
947
  }
958
948
  const position = this.convertOffsetToPosition(fileName, marker.position);
959
949
  let actual = new definitionProvider_1.DefinitionProvider(this.program, uri, position, filter, vscode_languageserver_1.CancellationToken.None).getDefinitions();
960
- assert_1.default.equal((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expected.length, `No definitions found for marker "${name}"`);
950
+ assert_1.default.equal(actual?.length ?? 0, expected.length, `No definitions found for marker "${name}"`);
961
951
  actual = this.fixupDefinitionsToMatchExpected(actual);
962
952
  for (const r of expected) {
963
- assert_1.default.equal(actual === null || actual === void 0 ? void 0 : actual.filter((d) => this._deepEqual(d, r)).length, 1, `No match found for ${JSON.stringify(r)} from marker ${name}`);
953
+ assert_1.default.equal(actual?.filter((d) => this._deepEqual(d, r)).length, 1, `No match found for ${JSON.stringify(r)} from marker ${name}`);
964
954
  }
965
955
  }
966
956
  }
967
957
  verifyFindTypeDefinitions(map) {
968
- var _a;
969
958
  this.analyze();
970
959
  for (const marker of this.getMarkers()) {
971
960
  const fileName = marker.fileName;
@@ -977,9 +966,9 @@ class TestState {
977
966
  const position = this.convertOffsetToPosition(fileName, marker.position);
978
967
  let actual = new definitionProvider_1.TypeDefinitionProvider(this.program, uri_1.Uri.file(fileName, this.serviceProvider), position, vscode_languageserver_1.CancellationToken.None).getDefinitions();
979
968
  actual = this.fixupDefinitionsToMatchExpected(actual);
980
- assert_1.default.strictEqual((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expected.length, name);
969
+ assert_1.default.strictEqual(actual?.length ?? 0, expected.length, name);
981
970
  for (const r of expected) {
982
- assert_1.default.strictEqual(actual === null || actual === void 0 ? void 0 : actual.filter((d) => this._deepEqual(d, r)).length, 1, name);
971
+ assert_1.default.strictEqual(actual?.filter((d) => this._deepEqual(d, r)).length, 1, name);
983
972
  }
984
973
  }
985
974
  }
@@ -993,17 +982,16 @@ class TestState {
993
982
  }
994
983
  const expected = map[name];
995
984
  expected.changes = expected.changes.map((c) => {
996
- var _a;
997
985
  return {
998
986
  ...c,
999
- fileUri: (_a = c.fileUri) !== null && _a !== void 0 ? _a : uri_1.Uri.file(c.filePath, this.serviceProvider),
987
+ fileUri: c.fileUri ?? uri_1.Uri.file(c.filePath, this.serviceProvider),
1000
988
  };
1001
989
  });
1002
990
  const position = this.convertOffsetToPosition(fileName, marker.position);
1003
991
  const actual = new renameProvider_1.RenameProvider(this.program, isUntitled
1004
992
  ? uri_1.Uri.parse(`untitled:${fileName.replace(/\\/g, '/')}`, this.serviceProvider)
1005
993
  : uri_1.Uri.file(fileName, this.serviceProvider), position, vscode_languageserver_1.CancellationToken.None).renameSymbol(expected.newName, /* isDefaultWorkspace */ false, isUntitled);
1006
- (0, workspaceEditTestUtils_1.verifyWorkspaceEdit)((0, workspaceEditUtils_1.convertToWorkspaceEdit)(this.program.fileSystem, { edits: expected.changes, fileOperations: [] }), actual !== null && actual !== void 0 ? actual : { documentChanges: [] });
994
+ (0, workspaceEditTestUtils_1.verifyWorkspaceEdit)((0, workspaceEditUtils_1.convertToWorkspaceEdit)(this.program.fileSystem, { edits: expected.changes, fileOperations: [] }), actual ?? { documentChanges: [] });
1007
995
  }
1008
996
  }
1009
997
  verifyTypeVerifierResults(packageName, ignoreUnknownTypesFromImports, verboseOutput, expected) {
@@ -1129,7 +1117,6 @@ class TestState {
1129
1117
  return this.getFileContent(fileName).slice(pos, end);
1130
1118
  }
1131
1119
  verifyCompletionItem(expected, actual) {
1132
- var _a, _b, _c;
1133
1120
  assert_1.default.strictEqual(actual.label, expected.label);
1134
1121
  assert_1.default.strictEqual(actual.detail, expected.detail);
1135
1122
  assert_1.default.strictEqual(actual.kind, expected.kind);
@@ -1137,10 +1124,10 @@ class TestState {
1137
1124
  this._verifyEdit(actual.textEdit, expected.textEdit);
1138
1125
  this._verifyEdits(actual.additionalTextEdits, expected.additionalTextEdits);
1139
1126
  if (expected.detailDescription !== undefined) {
1140
- assert_1.default.strictEqual((_a = actual.labelDetails) === null || _a === void 0 ? void 0 : _a.description, expected.detailDescription);
1127
+ assert_1.default.strictEqual(actual.labelDetails?.description, expected.detailDescription);
1141
1128
  }
1142
1129
  if (expected.commitCharacters !== undefined) {
1143
- expect(expected.commitCharacters.sort()).toEqual((_c = (_b = actual.commitCharacters) === null || _b === void 0 ? void 0 : _b.sort()) !== null && _c !== void 0 ? _c : []);
1130
+ expect(expected.commitCharacters.sort()).toEqual(actual.commitCharacters?.sort() ?? []);
1144
1131
  }
1145
1132
  }
1146
1133
  _convertGlobalOptionsToConfigOptions(projectRoot, mountPaths) {
@@ -1176,12 +1163,11 @@ class TestState {
1176
1163
  }
1177
1164
  _getParserOutput(fileName) {
1178
1165
  const file = this.program.getBoundSourceFile(uri_1.Uri.file(fileName, this.serviceProvider));
1179
- return file === null || file === void 0 ? void 0 : file.getParseResults();
1166
+ return file?.getParseResults();
1180
1167
  }
1181
1168
  _getTextRangeCollection(fileName) {
1182
- var _a;
1183
1169
  if (this.files.includes(fileName)) {
1184
- const tokenizerOutput = (_a = this._getParserOutput(fileName)) === null || _a === void 0 ? void 0 : _a.tokenizerOutput;
1170
+ const tokenizerOutput = this._getParserOutput(fileName)?.tokenizerOutput;
1185
1171
  if (tokenizerOutput) {
1186
1172
  return tokenizerOutput.lines;
1187
1173
  }
@@ -1201,12 +1187,11 @@ class TestState {
1201
1187
  // blank for now
1202
1188
  }
1203
1189
  _editScriptAndUpdateMarkers(fileName, editStart, editEnd, newText) {
1204
- var _a, _b;
1205
1190
  let fileContent = this.getFileContent(fileName);
1206
1191
  fileContent = fileContent.slice(0, editStart) + newText + fileContent.slice(editEnd);
1207
1192
  const uri = uri_1.Uri.file(fileName, this.serviceProvider);
1208
1193
  this.testFS.writeFileSync(uri, fileContent, 'utf8');
1209
- const newVersion = ((_b = (_a = this.program.getSourceFile(uri)) === null || _a === void 0 ? void 0 : _a.getClientVersion()) !== null && _b !== void 0 ? _b : -1) + 1;
1194
+ const newVersion = (this.program.getSourceFile(uri)?.getClientVersion() ?? -1) + 1;
1210
1195
  this.program.setFileOpened(uri, newVersion, fileContent);
1211
1196
  for (const marker of this.testData.markers) {
1212
1197
  if (marker.fileName === fileName) {
@@ -1419,8 +1404,8 @@ class TestState {
1419
1404
  }
1420
1405
  }
1421
1406
  _verifyEdits(actual, expected) {
1422
- actual = actual !== null && actual !== void 0 ? actual : [];
1423
- expected = expected !== null && expected !== void 0 ? expected : [];
1407
+ actual = actual ?? [];
1408
+ expected = expected ?? [];
1424
1409
  let extra = expected.slice(0);
1425
1410
  let left = actual.slice(0);
1426
1411
  for (const item of actual) {