@zzzen/pyright-internal 1.2.0-dev.20221016 → 1.2.0-dev.20221127

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 (332) hide show
  1. package/dist/analyzer/backgroundAnalysisProgram.d.ts +7 -9
  2. package/dist/analyzer/backgroundAnalysisProgram.js +14 -52
  3. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  4. package/dist/analyzer/binder.js +43 -32
  5. package/dist/analyzer/binder.js.map +1 -1
  6. package/dist/analyzer/checker.d.ts +15 -3
  7. package/dist/analyzer/checker.js +260 -143
  8. package/dist/analyzer/checker.js.map +1 -1
  9. package/dist/analyzer/codeFlowEngine.d.ts +2 -2
  10. package/dist/analyzer/codeFlowEngine.js +85 -88
  11. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  12. package/dist/analyzer/codeFlowTypes.d.ts +1 -0
  13. package/dist/analyzer/codeFlowTypes.js +3 -1
  14. package/dist/analyzer/codeFlowTypes.js.map +1 -1
  15. package/dist/analyzer/constraintSolver.js +1 -1
  16. package/dist/analyzer/constraintSolver.js.map +1 -1
  17. package/dist/analyzer/dataClasses.d.ts +3 -3
  18. package/dist/analyzer/dataClasses.js +77 -57
  19. package/dist/analyzer/dataClasses.js.map +1 -1
  20. package/dist/analyzer/declaration.js.map +1 -1
  21. package/dist/analyzer/declarationUtils.d.ts +1 -1
  22. package/dist/analyzer/declarationUtils.js +6 -4
  23. package/dist/analyzer/declarationUtils.js.map +1 -1
  24. package/dist/analyzer/docStringConversion.js +4 -3
  25. package/dist/analyzer/docStringConversion.js.map +1 -1
  26. package/dist/analyzer/importResolver.d.ts +3 -0
  27. package/dist/analyzer/importResolver.js +50 -8
  28. package/dist/analyzer/importResolver.js.map +1 -1
  29. package/dist/analyzer/importResult.d.ts +1 -0
  30. package/dist/analyzer/namedTuples.js +1 -1
  31. package/dist/analyzer/namedTuples.js.map +1 -1
  32. package/dist/analyzer/packageTypeVerifier.d.ts +2 -1
  33. package/dist/analyzer/packageTypeVerifier.js +16 -10
  34. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  35. package/dist/analyzer/parseTreeUtils.d.ts +2 -1
  36. package/dist/analyzer/parseTreeUtils.js +38 -3
  37. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  38. package/dist/analyzer/parseTreeWalker.d.ts +86 -79
  39. package/dist/analyzer/parseTreeWalker.js +384 -201
  40. package/dist/analyzer/parseTreeWalker.js.map +1 -1
  41. package/dist/analyzer/program.d.ts +4 -7
  42. package/dist/analyzer/program.js +76 -77
  43. package/dist/analyzer/program.js.map +1 -1
  44. package/dist/analyzer/properties.js +10 -3
  45. package/dist/analyzer/properties.js.map +1 -1
  46. package/dist/analyzer/protocols.js +1 -1
  47. package/dist/analyzer/protocols.js.map +1 -1
  48. package/dist/analyzer/regions.d.ts +11 -0
  49. package/dist/analyzer/regions.js +57 -0
  50. package/dist/analyzer/regions.js.map +1 -0
  51. package/dist/analyzer/service.d.ts +9 -6
  52. package/dist/analyzer/service.js +58 -27
  53. package/dist/analyzer/service.js.map +1 -1
  54. package/dist/analyzer/sourceFile.d.ts +5 -2
  55. package/dist/analyzer/sourceFile.js +21 -8
  56. package/dist/analyzer/sourceFile.js.map +1 -1
  57. package/dist/analyzer/sourceFileInfoUtils.d.ts +1 -1
  58. package/dist/analyzer/sourceFileInfoUtils.js +1 -1
  59. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  60. package/dist/analyzer/sourceMapper.d.ts +6 -1
  61. package/dist/analyzer/sourceMapper.js +28 -5
  62. package/dist/analyzer/sourceMapper.js.map +1 -1
  63. package/dist/analyzer/sourceMapperUtils.d.ts +2 -1
  64. package/dist/analyzer/sourceMapperUtils.js +17 -5
  65. package/dist/analyzer/sourceMapperUtils.js.map +1 -1
  66. package/dist/analyzer/staticExpressions.js +19 -9
  67. package/dist/analyzer/staticExpressions.js.map +1 -1
  68. package/dist/analyzer/symbolUtils.d.ts +1 -0
  69. package/dist/analyzer/symbolUtils.js +5 -1
  70. package/dist/analyzer/symbolUtils.js.map +1 -1
  71. package/dist/analyzer/typeEvaluator.js +643 -254
  72. package/dist/analyzer/typeEvaluator.js.map +1 -1
  73. package/dist/analyzer/typeEvaluatorTypes.d.ts +15 -4
  74. package/dist/analyzer/typeGuards.js +9 -0
  75. package/dist/analyzer/typeGuards.js.map +1 -1
  76. package/dist/analyzer/typePrinter.d.ts +3 -1
  77. package/dist/analyzer/typePrinter.js +135 -26
  78. package/dist/analyzer/typePrinter.js.map +1 -1
  79. package/dist/analyzer/typeStubWriter.js +5 -1
  80. package/dist/analyzer/typeStubWriter.js.map +1 -1
  81. package/dist/analyzer/typeUtils.d.ts +4 -2
  82. package/dist/analyzer/typeUtils.js +112 -20
  83. package/dist/analyzer/typeUtils.js.map +1 -1
  84. package/dist/analyzer/typedDicts.js +8 -6
  85. package/dist/analyzer/typedDicts.js.map +1 -1
  86. package/dist/analyzer/types.d.ts +5 -4
  87. package/dist/analyzer/types.js +43 -20
  88. package/dist/analyzer/types.js.map +1 -1
  89. package/dist/backgroundAnalysisBase.d.ts +6 -4
  90. package/dist/backgroundAnalysisBase.js +30 -9
  91. package/dist/backgroundAnalysisBase.js.map +1 -1
  92. package/dist/backgroundThreadBase.d.ts +2 -1
  93. package/dist/backgroundThreadBase.js +4 -0
  94. package/dist/backgroundThreadBase.js.map +1 -1
  95. package/dist/commands/createTypeStub.js +3 -1
  96. package/dist/commands/createTypeStub.js.map +1 -1
  97. package/dist/common/configOptions.d.ts +1 -0
  98. package/dist/common/configOptions.js +4 -0
  99. package/dist/common/configOptions.js.map +1 -1
  100. package/dist/common/core.d.ts +2 -0
  101. package/dist/common/core.js +24 -3
  102. package/dist/common/core.js.map +1 -1
  103. package/dist/common/diagnostic.d.ts +8 -0
  104. package/dist/common/diagnostic.js +5 -1
  105. package/dist/common/diagnostic.js.map +1 -1
  106. package/dist/common/diagnosticRules.d.ts +2 -1
  107. package/dist/common/diagnosticRules.js +1 -0
  108. package/dist/common/diagnosticRules.js.map +1 -1
  109. package/dist/common/fileSystem.d.ts +1 -0
  110. package/dist/common/fileSystem.js.map +1 -1
  111. package/dist/common/pathUtils.d.ts +1 -0
  112. package/dist/common/pathUtils.js +13 -3
  113. package/dist/common/pathUtils.js.map +1 -1
  114. package/dist/common/pythonVersion.d.ts +1 -1
  115. package/dist/common/pythonVersion.js +1 -1
  116. package/dist/common/realFileSystem.js +12 -3
  117. package/dist/common/realFileSystem.js.map +1 -1
  118. package/dist/common/workspaceEditUtils.d.ts +6 -1
  119. package/dist/common/workspaceEditUtils.js +72 -1
  120. package/dist/common/workspaceEditUtils.js.map +1 -1
  121. package/dist/languageServerBase.d.ts +7 -5
  122. package/dist/languageServerBase.js +30 -20
  123. package/dist/languageServerBase.js.map +1 -1
  124. package/dist/languageService/analyzerServiceExecutor.d.ts +6 -2
  125. package/dist/languageService/analyzerServiceExecutor.js +7 -4
  126. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  127. package/dist/languageService/autoImporter.js +2 -1
  128. package/dist/languageService/autoImporter.js.map +1 -1
  129. package/dist/languageService/codeActionProvider.js +30 -0
  130. package/dist/languageService/codeActionProvider.js.map +1 -1
  131. package/dist/languageService/completionProvider.d.ts +1 -0
  132. package/dist/languageService/completionProvider.js +66 -28
  133. package/dist/languageService/completionProvider.js.map +1 -1
  134. package/dist/languageService/definitionProvider.d.ts +2 -0
  135. package/dist/languageService/definitionProvider.js +3 -0
  136. package/dist/languageService/definitionProvider.js.map +1 -1
  137. package/dist/languageService/documentSymbolCollector.js +7 -3
  138. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  139. package/dist/languageService/documentSymbolProvider.js +1 -1
  140. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  141. package/dist/languageService/hoverProvider.d.ts +1 -1
  142. package/dist/languageService/hoverProvider.js +73 -38
  143. package/dist/languageService/hoverProvider.js.map +1 -1
  144. package/dist/languageService/referencesProvider.js +2 -1
  145. package/dist/languageService/referencesProvider.js.map +1 -1
  146. package/dist/languageService/signatureHelpProvider.js +1 -2
  147. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  148. package/dist/languageService/tooltipUtils.js +30 -19
  149. package/dist/languageService/tooltipUtils.js.map +1 -1
  150. package/dist/localization/localize.d.ts +29 -4
  151. package/dist/localization/localize.js +20 -5
  152. package/dist/localization/localize.js.map +1 -1
  153. package/dist/localization/package.nls.en-us.json +18 -3
  154. package/dist/parser/parseNodes.d.ts +2 -1
  155. package/dist/parser/parseNodes.js +6 -1
  156. package/dist/parser/parseNodes.js.map +1 -1
  157. package/dist/parser/parser.js +19 -13
  158. package/dist/parser/parser.js.map +1 -1
  159. package/dist/parser/tokenizer.js +2 -1
  160. package/dist/parser/tokenizer.js.map +1 -1
  161. package/dist/pyright.js +4 -4
  162. package/dist/pyright.js.map +1 -1
  163. package/dist/pyrightFileSystem.d.ts +1 -0
  164. package/dist/pyrightFileSystem.js +3 -0
  165. package/dist/pyrightFileSystem.js.map +1 -1
  166. package/dist/readonlyAugmentedFileSystem.d.ts +1 -0
  167. package/dist/readonlyAugmentedFileSystem.js +3 -0
  168. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  169. package/dist/server.d.ts +1 -1
  170. package/dist/server.js +1 -1
  171. package/dist/server.js.map +1 -1
  172. package/dist/tests/checker.test.js +25 -2
  173. package/dist/tests/checker.test.js.map +1 -1
  174. package/dist/tests/config.test.js +11 -0
  175. package/dist/tests/config.test.js.map +1 -1
  176. package/dist/tests/diagnostics.test.d.ts +1 -0
  177. package/dist/tests/diagnostics.test.js +37 -0
  178. package/dist/tests/diagnostics.test.js.map +1 -0
  179. package/dist/tests/docStringConversion.test.js +25 -0
  180. package/dist/tests/docStringConversion.test.js.map +1 -1
  181. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js +1 -1
  182. package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
  183. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js +5 -5
  184. package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
  185. package/dist/tests/fourslash/completions.classVariable.fourslash.js +28 -6
  186. package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -1
  187. package/dist/tests/fourslash/{signature.paramspec.fourslash.d.ts → completions.dunderNew.Inheritance.fourslash.d.ts} +0 -0
  188. package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js +29 -0
  189. package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js.map +1 -0
  190. package/dist/tests/fourslash/completions.dunderNew.fourslash.d.ts +1 -0
  191. package/dist/tests/fourslash/completions.dunderNew.fourslash.js +20 -0
  192. package/dist/tests/fourslash/completions.dunderNew.fourslash.js.map +1 -0
  193. package/dist/tests/fourslash/completions.fourslash.js +2 -2
  194. package/dist/tests/fourslash/completions.fourslash.js.map +1 -1
  195. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js +1 -1
  196. package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -1
  197. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js +1 -1
  198. package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -1
  199. package/dist/tests/fourslash/completions.libStub.fourslash.js +1 -1
  200. package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -1
  201. package/dist/tests/fourslash/completions.localCode.fourslash.js +2 -2
  202. package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -1
  203. package/dist/tests/fourslash/completions.plainText.fourslash.js +2 -2
  204. package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -1
  205. package/dist/tests/fourslash/completions.self.fourslash.js +2 -2
  206. package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -1
  207. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js +1 -1
  208. package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -1
  209. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js +2 -2
  210. package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
  211. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.d.ts +1 -0
  212. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js +32 -0
  213. package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js.map +1 -0
  214. package/dist/tests/fourslash/fourslash.d.ts +2 -1
  215. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js +2 -2
  216. package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
  217. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js +4 -4
  218. package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -1
  219. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js +1 -1
  220. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -1
  221. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js +1 -1
  222. package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -1
  223. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js +1 -1
  224. package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -1
  225. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js +1 -1
  226. package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -1
  227. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js +1 -1
  228. package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -1
  229. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js +2 -2
  230. package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
  231. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js +1 -1
  232. package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -1
  233. package/dist/tests/fourslash/hover.docstring.alias.fourslash.d.ts +1 -0
  234. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js +24 -0
  235. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -0
  236. package/dist/tests/fourslash/hover.docstring.links.fourslash.js +1 -1
  237. package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
  238. package/dist/tests/fourslash/hover.docstring.split.fourslash.js +3 -3
  239. package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
  240. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.d.ts +1 -0
  241. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js +13 -0
  242. package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js.map +1 -0
  243. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.d.ts +1 -0
  244. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js +15 -0
  245. package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js.map +1 -0
  246. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.d.ts +1 -0
  247. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js +21 -0
  248. package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js.map +1 -0
  249. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.d.ts +1 -0
  250. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js +17 -0
  251. package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js.map +1 -0
  252. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.d.ts +1 -0
  253. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js +15 -0
  254. package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js.map +1 -0
  255. package/dist/tests/fourslash/hover.fourslash.js +1 -1
  256. package/dist/tests/fourslash/hover.fourslash.js.map +1 -1
  257. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js +3 -3
  258. package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
  259. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js +2 -2
  260. package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -1
  261. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js +2 -2
  262. package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
  263. package/dist/tests/fourslash/hover.init.fourslash.js +1 -1
  264. package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
  265. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js +1 -1
  266. package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -1
  267. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js +1 -1
  268. package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -1
  269. package/dist/tests/fourslash/hover.libStub.fourslash.js +1 -1
  270. package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -1
  271. package/dist/tests/fourslash/hover.plainText.fourslash.js +1 -1
  272. package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -1
  273. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js +1 -1
  274. package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -1
  275. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js +1 -1
  276. package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -1
  277. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js +1 -1
  278. package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -1
  279. package/dist/tests/fourslash/shadowedImports.fourslash.d.ts +1 -0
  280. package/dist/tests/fourslash/shadowedImports.fourslash.js +75 -0
  281. package/dist/tests/fourslash/shadowedImports.fourslash.js.map +1 -0
  282. package/dist/tests/fourslash/signature.dunderNew.fourslash.d.ts +1 -0
  283. package/dist/tests/fourslash/signature.dunderNew.fourslash.js +24 -0
  284. package/dist/tests/fourslash/signature.dunderNew.fourslash.js.map +1 -0
  285. package/dist/tests/harness/fourslash/runner.js +1 -1
  286. package/dist/tests/harness/fourslash/runner.js.map +1 -1
  287. package/dist/tests/harness/fourslash/testLanguageService.d.ts +3 -1
  288. package/dist/tests/harness/fourslash/testLanguageService.js +4 -2
  289. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  290. package/dist/tests/harness/fourslash/testState.d.ts +7 -7
  291. package/dist/tests/harness/fourslash/testState.js +77 -161
  292. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  293. package/dist/tests/harness/fourslash/workspaceEditTestUtils.d.ts +16 -0
  294. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +159 -0
  295. package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -0
  296. package/dist/tests/harness/vfs/filesystem.d.ts +1 -0
  297. package/dist/tests/harness/vfs/filesystem.js +3 -0
  298. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  299. package/dist/tests/ipythonMode.test.js +39 -0
  300. package/dist/tests/ipythonMode.test.js.map +1 -1
  301. package/dist/tests/logger.test.js +3 -1
  302. package/dist/tests/logger.test.js.map +1 -1
  303. package/dist/tests/pathUtils.test.js +7 -0
  304. package/dist/tests/pathUtils.test.js.map +1 -1
  305. package/dist/tests/sourceFile.test.js +34 -1
  306. package/dist/tests/sourceFile.test.js.map +1 -1
  307. package/dist/tests/sourceMapperUtils.test.js +39 -4
  308. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  309. package/dist/tests/tokenizer.test.js +6 -2
  310. package/dist/tests/tokenizer.test.js.map +1 -1
  311. package/dist/tests/typeEvaluator1.test.js +16 -6
  312. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  313. package/dist/tests/typeEvaluator2.test.js +15 -3
  314. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  315. package/dist/tests/typeEvaluator3.test.js +40 -10
  316. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  317. package/dist/tests/typeEvaluator4.test.js +11 -7
  318. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  319. package/dist/tests/typeEvaluator5.test.js +48 -0
  320. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  321. package/dist/tests/typePrinter.test.d.ts +1 -0
  322. package/dist/tests/typePrinter.test.js +148 -0
  323. package/dist/tests/typePrinter.test.js.map +1 -0
  324. package/dist/tests/workspaceEditUtils.test.d.ts +1 -0
  325. package/dist/tests/workspaceEditUtils.test.js +167 -0
  326. package/dist/tests/workspaceEditUtils.test.js.map +1 -0
  327. package/dist/workspaceMap.d.ts +2 -0
  328. package/dist/workspaceMap.js +45 -12
  329. package/dist/workspaceMap.js.map +1 -1
  330. package/package.json +3 -3
  331. package/dist/tests/fourslash/signature.paramspec.fourslash.js +0 -30
  332. package/dist/tests/fourslash/signature.paramspec.fourslash.js.map +0 -1
@@ -78,7 +78,7 @@ class Program {
78
78
  var _a;
79
79
  let sourceFileInfo;
80
80
  if (typeof filePathOrModule === 'string') {
81
- sourceFileInfo = this._getSourceFileInfoFromPath(filePathOrModule);
81
+ sourceFileInfo = this.getSourceFileInfo(filePathOrModule);
82
82
  }
83
83
  else {
84
84
  // Resolve the import.
@@ -91,12 +91,12 @@ class Program {
91
91
  let resolvedPath = importResult.resolvedPaths[importResult.resolvedPaths.length - 1];
92
92
  if (resolvedPath) {
93
93
  // See if the source file already exists in the program.
94
- sourceFileInfo = this._getSourceFileInfoFromPath(resolvedPath);
94
+ sourceFileInfo = this.getSourceFileInfo(resolvedPath);
95
95
  if (!sourceFileInfo) {
96
96
  resolvedPath = (0, pathUtils_1.normalizePathCase)(this._fs, resolvedPath);
97
97
  // Start tracking the source file.
98
98
  this.addTrackedFile(resolvedPath);
99
- sourceFileInfo = this._getSourceFileInfoFromPath(resolvedPath);
99
+ sourceFileInfo = this.getSourceFileInfo(resolvedPath);
100
100
  }
101
101
  }
102
102
  }
@@ -193,7 +193,7 @@ class Program {
193
193
  });
194
194
  }
195
195
  addTrackedFile(filePath, isThirdPartyImport = false, isInPyTypedPackage = false) {
196
- let sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
196
+ let sourceFileInfo = this.getSourceFileInfo(filePath);
197
197
  const importName = this._getImportNameForFile(filePath);
198
198
  if (sourceFileInfo) {
199
199
  // The module name may have changed based on updates to the
@@ -221,7 +221,7 @@ class Program {
221
221
  }
222
222
  setFileOpened(filePath, version, contents, options) {
223
223
  var _a, _b;
224
- let sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
224
+ let sourceFileInfo = this.getSourceFileInfo(filePath);
225
225
  if (!sourceFileInfo) {
226
226
  const importName = this._getImportNameForFile(filePath);
227
227
  const sourceFile = new sourceFile_1.SourceFile(this._fs, filePath, importName,
@@ -231,7 +231,7 @@ class Program {
231
231
  sourceFileInfo = {
232
232
  sourceFile,
233
233
  isTracked: (_b = options === null || options === void 0 ? void 0 : options.isTracked) !== null && _b !== void 0 ? _b : false,
234
- chainedSourceFile: chainedFilePath ? this._getSourceFileInfoFromPath(chainedFilePath) : undefined,
234
+ chainedSourceFile: chainedFilePath ? this.getSourceFileInfo(chainedFilePath) : undefined,
235
235
  isOpenByClient: true,
236
236
  isTypeshedFile: false,
237
237
  isThirdPartyImport: false,
@@ -256,23 +256,22 @@ class Program {
256
256
  }
257
257
  getChainedFilePath(filePath) {
258
258
  var _a;
259
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
259
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
260
260
  return (_a = sourceFileInfo === null || sourceFileInfo === void 0 ? void 0 : sourceFileInfo.chainedSourceFile) === null || _a === void 0 ? void 0 : _a.sourceFile.getFilePath();
261
261
  }
262
262
  updateChainedFilePath(filePath, chainedFilePath) {
263
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
263
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
264
264
  if (sourceFileInfo) {
265
- sourceFileInfo.chainedSourceFile = chainedFilePath
266
- ? this._getSourceFileInfoFromPath(chainedFilePath)
267
- : undefined;
265
+ sourceFileInfo.chainedSourceFile = chainedFilePath ? this.getSourceFileInfo(chainedFilePath) : undefined;
268
266
  sourceFileInfo.sourceFile.markDirty();
269
267
  this._markFileDirtyRecursive(sourceFileInfo, new Set());
270
268
  }
271
269
  }
272
- setFileClosed(filePath) {
273
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
270
+ setFileClosed(filePath, isTracked) {
271
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
274
272
  if (sourceFileInfo) {
275
273
  sourceFileInfo.isOpenByClient = false;
274
+ sourceFileInfo.isTracked = isTracked !== null && isTracked !== void 0 ? isTracked : sourceFileInfo.isTracked;
276
275
  sourceFileInfo.sourceFile.setClientVersion(null, []);
277
276
  // There is no guarantee that content is saved before the file is closed.
278
277
  // We need to mark the file dirty so we can re-analyze next time.
@@ -285,9 +284,6 @@ class Program {
285
284
  }
286
285
  return this._removeUnneededFiles();
287
286
  }
288
- isFileOpen(filePath) {
289
- return this._getSourceFileInfoFromPath(filePath) !== undefined;
290
- }
291
287
  markAllFilesDirty(evenIfContentsAreSame, indexingNeeded = true) {
292
288
  const markDirtySet = new Set();
293
289
  this._sourceFileList.forEach((sourceFileInfo) => {
@@ -308,7 +304,7 @@ class Program {
308
304
  markFilesDirty(filePaths, evenIfContentsAreSame, indexingNeeded = true) {
309
305
  const markDirtySet = new Set();
310
306
  filePaths.forEach((filePath) => {
311
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
307
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
312
308
  if (sourceFileInfo) {
313
309
  const fileName = (0, pathUtils_1.getFileName)(filePath);
314
310
  // Handle builtins and __builtins__ specially. They are implicitly
@@ -369,7 +365,7 @@ class Program {
369
365
  return this._sourceFileList.some((i) => i.sourceFile.getFilePath().startsWith(normalized));
370
366
  }
371
367
  getSourceFile(filePath) {
372
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
368
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
373
369
  if (!sourceFileInfo) {
374
370
  return undefined;
375
371
  }
@@ -379,8 +375,11 @@ class Program {
379
375
  var _a;
380
376
  return (_a = this.getBoundSourceFileInfo(filePath)) === null || _a === void 0 ? void 0 : _a.sourceFile;
381
377
  }
378
+ getSourceFileInfo(filePath) {
379
+ return this._sourceFileMap.get((0, pathUtils_1.normalizePathCase)(this._fs, filePath));
380
+ }
382
381
  getBoundSourceFileInfo(filePath) {
383
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
382
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
384
383
  if (!sourceFileInfo) {
385
384
  return undefined;
386
385
  }
@@ -401,7 +400,7 @@ class Program {
401
400
  const effectiveMaxTime = maxTime ? maxTime.openFilesTimeInMs : Number.MAX_VALUE;
402
401
  // Check the open files.
403
402
  for (const sourceFileInfo of openFiles) {
404
- if (this._checkTypes(sourceFileInfo)) {
403
+ if (this._checkTypes(sourceFileInfo, token)) {
405
404
  if (elapsedTime.getDurationInMilliseconds() > effectiveMaxTime) {
406
405
  return true;
407
406
  }
@@ -421,7 +420,7 @@ class Program {
421
420
  if (!(0, sourceFileInfoUtils_1.isUserCode)(sourceFileInfo)) {
422
421
  continue;
423
422
  }
424
- if (this._checkTypes(sourceFileInfo)) {
423
+ if (this._checkTypes(sourceFileInfo, token)) {
425
424
  if (elapsedTime.getDurationInMilliseconds() > effectiveMaxTime) {
426
425
  return true;
427
426
  }
@@ -579,10 +578,10 @@ class Program {
579
578
  const evaluator = this._evaluator || this._createNewEvaluator();
580
579
  return evaluator.getEffectiveTypeOfSymbol(symbol);
581
580
  }
582
- printType(type, expandTypeAlias) {
581
+ printType(type, options) {
583
582
  this._handleMemoryHighUsage();
584
583
  const evaluator = this._evaluator || this._createNewEvaluator();
585
- return evaluator.printType(type, expandTypeAlias);
584
+ return evaluator.printType(type, options);
586
585
  }
587
586
  static _getPrintTypeFlags(configOptions) {
588
587
  let flags = 0 /* None */;
@@ -622,7 +621,7 @@ class Program {
622
621
  // We need to track the relationship so if the original type stub is removed from the
623
622
  // program, we can remove the corresponding shadowed file and any files it imports.
624
623
  _addShadowedFile(stubFile, shadowImplPath) {
625
- let shadowFileInfo = this._getSourceFileInfoFromPath(shadowImplPath);
624
+ let shadowFileInfo = this.getSourceFileInfo(shadowImplPath);
626
625
  if (!shadowFileInfo) {
627
626
  const importName = this._getImportNameForFile(shadowImplPath);
628
627
  const sourceFile = new sourceFile_1.SourceFile(this._fs, shadowImplPath, importName,
@@ -752,7 +751,7 @@ class Program {
752
751
  }
753
752
  return false;
754
753
  }
755
- _checkTypes(fileToCheck) {
754
+ _checkTypes(fileToCheck, token) {
756
755
  return this._logTracker.log(`analyzing: ${fileToCheck.sourceFile.getFilePath()}`, (logState) => {
757
756
  // If the file isn't needed because it was eliminated from the
758
757
  // transitive closure or deleted, skip the file rather than wasting
@@ -777,7 +776,8 @@ class Program {
777
776
  }
778
777
  }
779
778
  if (!this._disableChecker) {
780
- fileToCheck.sourceFile.check(this._importResolver, this._evaluator);
779
+ const execEnv = this._configOptions.findExecEnvironment(fileToCheck.sourceFile.getFilePath());
780
+ fileToCheck.sourceFile.check(this._importResolver, this._evaluator, execEnv, this._createSourceMapper(execEnv, token, fileToCheck), (p) => (0, sourceFileInfoUtils_1.isUserCode)(this.getSourceFileInfo(p)));
781
781
  }
782
782
  // For very large programs, we may need to discard the evaluator and
783
783
  // its cached types to avoid running out of heap space.
@@ -892,7 +892,7 @@ class Program {
892
892
  });
893
893
  circDep.normalizeOrder();
894
894
  const firstFilePath = circDep.getPaths()[0];
895
- const firstSourceFile = this._getSourceFileInfoFromPath(firstFilePath);
895
+ const firstSourceFile = this.getSourceFileInfo(firstFilePath);
896
896
  (0, debug_1.assert)(firstSourceFile !== undefined);
897
897
  firstSourceFile.sourceFile.addCircularDependency(circDep);
898
898
  }
@@ -911,7 +911,7 @@ class Program {
911
911
  }
912
912
  }
913
913
  getTextOnRange(filePath, range, token) {
914
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
914
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
915
915
  if (!sourceFileInfo) {
916
916
  return undefined;
917
917
  }
@@ -932,7 +932,7 @@ class Program {
932
932
  });
933
933
  }
934
934
  getAutoImports(filePath, range, similarityLimit, nameMap, options, token) {
935
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
935
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
936
936
  if (!sourceFileInfo) {
937
937
  return [];
938
938
  }
@@ -1022,36 +1022,38 @@ class Program {
1022
1022
  }
1023
1023
  getDefinitionsForPosition(filePath, position, filter, token) {
1024
1024
  return this._runEvaluatorWithCancellationToken(token, () => {
1025
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1025
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1026
1026
  if (!sourceFileInfo) {
1027
1027
  return undefined;
1028
1028
  }
1029
1029
  this._bindFile(sourceFileInfo);
1030
1030
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1031
- return sourceFileInfo.sourceFile.getDefinitionsForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, filter, this._evaluator, token);
1031
+ return sourceFileInfo.sourceFile.getDefinitionsForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, filter, this._evaluator, token);
1032
1032
  });
1033
1033
  }
1034
1034
  getTypeDefinitionsForPosition(filePath, position, token) {
1035
1035
  return this._runEvaluatorWithCancellationToken(token, () => {
1036
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1036
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1037
1037
  if (!sourceFileInfo) {
1038
1038
  return undefined;
1039
1039
  }
1040
1040
  this._bindFile(sourceFileInfo);
1041
1041
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1042
- return sourceFileInfo.sourceFile.getTypeDefinitionsForPosition(this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ false, /* preferStubs */ true), position, this._evaluator, filePath, token);
1042
+ return sourceFileInfo.sourceFile.getTypeDefinitionsForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo,
1043
+ /* mapCompiled */ false,
1044
+ /* preferStubs */ true), position, this._evaluator, filePath, token);
1043
1045
  });
1044
1046
  }
1045
1047
  reportReferencesForPosition(filePath, position, includeDeclaration, reporter, token) {
1046
1048
  this._runEvaluatorWithCancellationToken(token, () => {
1047
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1049
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1048
1050
  if (!sourceFileInfo) {
1049
1051
  return;
1050
1052
  }
1051
1053
  const invokedFromUserFile = (0, sourceFileInfoUtils_1.isUserCode)(sourceFileInfo);
1052
1054
  this._bindFile(sourceFileInfo);
1053
1055
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1054
- const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, reporter, token);
1056
+ const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, reporter, token);
1055
1057
  if (!referencesResult) {
1056
1058
  return;
1057
1059
  }
@@ -1083,7 +1085,7 @@ class Program {
1083
1085
  // Already included.
1084
1086
  continue;
1085
1087
  }
1086
- const declFileInfo = this._getSourceFileInfoFromPath(decl.path);
1088
+ const declFileInfo = this.getSourceFileInfo(decl.path);
1087
1089
  if (!declFileInfo) {
1088
1090
  // The file the declaration belongs to doesn't belong to the program.
1089
1091
  continue;
@@ -1116,7 +1118,7 @@ class Program {
1116
1118
  this._handleMemoryHighUsage();
1117
1119
  return this._runEvaluatorWithCancellationToken(token, () => {
1118
1120
  var _a;
1119
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1121
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1120
1122
  if (!sourceFileInfo) {
1121
1123
  return undefined;
1122
1124
  }
@@ -1137,7 +1139,7 @@ class Program {
1137
1139
  }
1138
1140
  addSymbolsForDocument(filePath, symbolList, token) {
1139
1141
  return this._runEvaluatorWithCancellationToken(token, () => {
1140
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1142
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1141
1143
  if (sourceFileInfo) {
1142
1144
  if (!sourceFileInfo.sourceFile.getCachedIndexResults()) {
1143
1145
  // If we already have cached index for this file, no need to bind this file.
@@ -1175,40 +1177,40 @@ class Program {
1175
1177
  }
1176
1178
  getHoverForPosition(filePath, position, format, token) {
1177
1179
  return this._runEvaluatorWithCancellationToken(token, () => {
1178
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1180
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1179
1181
  if (!sourceFileInfo) {
1180
1182
  return undefined;
1181
1183
  }
1182
1184
  this._bindFile(sourceFileInfo);
1183
1185
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1184
- return sourceFileInfo.sourceFile.getHoverForPosition(this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ true), position, format, this._evaluator, token);
1186
+ return sourceFileInfo.sourceFile.getHoverForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo, /* mapCompiled */ true), position, format, this._evaluator, token);
1185
1187
  });
1186
1188
  }
1187
1189
  getDocumentHighlight(filePath, position, token) {
1188
1190
  return this._runEvaluatorWithCancellationToken(token, () => {
1189
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1191
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1190
1192
  if (!sourceFileInfo) {
1191
1193
  return undefined;
1192
1194
  }
1193
1195
  this._bindFile(sourceFileInfo);
1194
1196
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1195
- return sourceFileInfo.sourceFile.getDocumentHighlight(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, token);
1197
+ return sourceFileInfo.sourceFile.getDocumentHighlight(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, token);
1196
1198
  });
1197
1199
  }
1198
1200
  getSignatureHelpForPosition(filePath, position, format, token) {
1199
1201
  return this._runEvaluatorWithCancellationToken(token, () => {
1200
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1202
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1201
1203
  if (!sourceFileInfo) {
1202
1204
  return undefined;
1203
1205
  }
1204
1206
  this._bindFile(sourceFileInfo);
1205
1207
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1206
- return sourceFileInfo.sourceFile.getSignatureHelpForPosition(position, this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ true), this._evaluator, format, token);
1208
+ return sourceFileInfo.sourceFile.getSignatureHelpForPosition(position, this._createSourceMapper(execEnv, token, sourceFileInfo, /* mapCompiled */ true), this._evaluator, format, token);
1207
1209
  });
1208
1210
  }
1209
1211
  async getCompletionsForPosition(filePath, position, workspacePath, options, nameMap, libraryMap, token) {
1210
1212
  var _a;
1211
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1213
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1212
1214
  if (!sourceFileInfo) {
1213
1215
  return undefined;
1214
1216
  }
@@ -1217,7 +1219,7 @@ class Program {
1217
1219
  const result = this._runEvaluatorWithCancellationToken(token, () => {
1218
1220
  this._bindFile(sourceFileInfo);
1219
1221
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1220
- return sourceFileInfo.sourceFile.getCompletionsForPosition(position, workspacePath, this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
1222
+ return sourceFileInfo.sourceFile.getCompletionsForPosition(position, workspacePath, this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, token, sourceFileInfo, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
1221
1223
  /* includeIndexUserSymbols */ false, token), token);
1222
1224
  });
1223
1225
  ls.add(`found ${(_a = result === null || result === void 0 ? void 0 : result.completionMap.size) !== null && _a !== void 0 ? _a : 'null'} items`);
@@ -1243,20 +1245,20 @@ class Program {
1243
1245
  }
1244
1246
  resolveCompletionItem(filePath, completionItem, options, nameMap, libraryMap, token) {
1245
1247
  return this._runEvaluatorWithCancellationToken(token, () => {
1246
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1248
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1247
1249
  if (!sourceFileInfo) {
1248
1250
  return;
1249
1251
  }
1250
1252
  this._bindFile(sourceFileInfo);
1251
1253
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1252
- sourceFileInfo.sourceFile.resolveCompletionItem(this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
1254
+ sourceFileInfo.sourceFile.resolveCompletionItem(this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, token, sourceFileInfo, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
1253
1255
  /* includeIndexUserSymbols */ false, token), completionItem, token);
1254
1256
  });
1255
1257
  }
1256
1258
  renameModule(path, newPath, token) {
1257
1259
  return this._runEvaluatorWithCancellationToken(token, () => {
1258
1260
  if ((0, pathUtils_1.isFile)(this._fs, path)) {
1259
- const fileInfo = this._getSourceFileInfoFromPath(path);
1261
+ const fileInfo = this.getSourceFileInfo(path);
1260
1262
  if (!fileInfo) {
1261
1263
  return undefined;
1262
1264
  }
@@ -1271,7 +1273,7 @@ class Program {
1271
1273
  }
1272
1274
  moveSymbolAtPosition(filePath, newFilePath, position, token) {
1273
1275
  return this._runEvaluatorWithCancellationToken(token, () => {
1274
- const fileInfo = this._getSourceFileInfoFromPath(filePath);
1276
+ const fileInfo = this.getSourceFileInfo(filePath);
1275
1277
  if (!fileInfo) {
1276
1278
  return undefined;
1277
1279
  }
@@ -1294,7 +1296,7 @@ class Program {
1294
1296
  }
1295
1297
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1296
1298
  const declarations = documentSymbolCollector_1.DocumentSymbolCollector.getDeclarationsForNode(node, this._evaluator,
1297
- /* resolveLocalNames */ false, token, this._createSourceMapper(execEnv, fileInfo));
1299
+ /* resolveLocalNames */ false, token, this._createSourceMapper(execEnv, token, fileInfo));
1298
1300
  const renameModuleProvider = renameModuleProvider_1.RenameModuleProvider.createForSymbol(this._importResolver, this._configOptions, this._evaluator, filePath, newFilePath, declarations, token);
1299
1301
  if (!renameModuleProvider) {
1300
1302
  return undefined;
@@ -1305,7 +1307,7 @@ class Program {
1305
1307
  }
1306
1308
  canRenameSymbolAtPosition(filePath, position, isDefaultWorkspace, allowModuleRename, token) {
1307
1309
  return this._runEvaluatorWithCancellationToken(token, () => {
1308
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1310
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1309
1311
  if (!sourceFileInfo) {
1310
1312
  return undefined;
1311
1313
  }
@@ -1333,7 +1335,7 @@ class Program {
1333
1335
  renameSymbolAtPosition(filePath, position, newName, isDefaultWorkspace, allowModuleRename, token) {
1334
1336
  return this._runEvaluatorWithCancellationToken(token, () => {
1335
1337
  var _a;
1336
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1338
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1337
1339
  if (!sourceFileInfo) {
1338
1340
  return undefined;
1339
1341
  }
@@ -1418,13 +1420,13 @@ class Program {
1418
1420
  });
1419
1421
  }
1420
1422
  getCallForPosition(filePath, position, token) {
1421
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1423
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1422
1424
  if (!sourceFileInfo) {
1423
1425
  return undefined;
1424
1426
  }
1425
1427
  this._bindFile(sourceFileInfo);
1426
1428
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1427
- const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, undefined, token);
1429
+ const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, undefined, token);
1428
1430
  if (!referencesResult || referencesResult.declarations.length === 0) {
1429
1431
  return undefined;
1430
1432
  }
@@ -1432,13 +1434,13 @@ class Program {
1432
1434
  return callHierarchyProvider_1.CallHierarchyProvider.getCallForDeclaration(referencesResult.symbolName, targetDecl, this._evaluator, token);
1433
1435
  }
1434
1436
  getIncomingCallsForPosition(filePath, position, token) {
1435
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1437
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1436
1438
  if (!sourceFileInfo) {
1437
1439
  return undefined;
1438
1440
  }
1439
1441
  this._bindFile(sourceFileInfo);
1440
1442
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1441
- const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, undefined, token);
1443
+ const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, undefined, token);
1442
1444
  if (!referencesResult || referencesResult.declarations.length === 0) {
1443
1445
  return undefined;
1444
1446
  }
@@ -1459,13 +1461,13 @@ class Program {
1459
1461
  return items;
1460
1462
  }
1461
1463
  getOutgoingCallsForPosition(filePath, position, token) {
1462
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1464
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1463
1465
  if (!sourceFileInfo) {
1464
1466
  return undefined;
1465
1467
  }
1466
1468
  this._bindFile(sourceFileInfo);
1467
1469
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1468
- const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, undefined, token);
1470
+ const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, undefined, token);
1469
1471
  if (!referencesResult || referencesResult.declarations.length === 0) {
1470
1472
  return undefined;
1471
1473
  }
@@ -1473,7 +1475,7 @@ class Program {
1473
1475
  return callHierarchyProvider_1.CallHierarchyProvider.getOutgoingCallsForDeclaration(targetDecl, sourceFileInfo.sourceFile.getParseResults(), this._evaluator, token);
1474
1476
  }
1475
1477
  performQuickAction(filePath, command, args, token) {
1476
- const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
1478
+ const sourceFileInfo = this.getSourceFileInfo(filePath);
1477
1479
  if (!sourceFileInfo) {
1478
1480
  return undefined;
1479
1481
  }
@@ -1497,7 +1499,7 @@ class Program {
1497
1499
  this._parsedFileCount = 0;
1498
1500
  }
1499
1501
  test_createSourceMapper(execEnv, from) {
1500
- return this._createSourceMapper(execEnv, /*from*/ from, /* mapCompiled */ false);
1502
+ return this._createSourceMapper(execEnv, vscode_languageserver_1.CancellationToken.None, /*from*/ from, /* mapCompiled */ false);
1501
1503
  }
1502
1504
  _getRenameSymbolMode(sourceFileInfo, referencesResult, isDefaultWorkspace) {
1503
1505
  // We have 2 different cases
@@ -1513,10 +1515,10 @@ class Program {
1513
1515
  (userFile && !referencesResult.requiresGlobalSearch) ||
1514
1516
  (!userFile &&
1515
1517
  sourceFileInfo.isOpenByClient &&
1516
- referencesResult.declarations.every((d) => this._getSourceFileInfoFromPath(d.path) === sourceFileInfo))) {
1518
+ referencesResult.declarations.every((d) => this.getSourceFileInfo(d.path) === sourceFileInfo))) {
1517
1519
  return 'singleFileMode';
1518
1520
  }
1519
- if (referencesResult.declarations.every((d) => (0, sourceFileInfoUtils_1.isUserCode)(this._getSourceFileInfoFromPath(d.path)))) {
1521
+ if (referencesResult.declarations.every((d) => (0, sourceFileInfoUtils_1.isUserCode)(this.getSourceFileInfo(d.path)))) {
1520
1522
  return 'multiFileMode';
1521
1523
  }
1522
1524
  // Rename is not allowed.
@@ -1525,11 +1527,11 @@ class Program {
1525
1527
  }
1526
1528
  _supportRenameModule(declarations, isDefaultWorkspace) {
1527
1529
  // Rename module is not supported for standalone file and all decls must be on a user file.
1528
- return !isDefaultWorkspace && declarations.every((d) => (0, sourceFileInfoUtils_1.isUserCode)(this._getSourceFileInfoFromPath(d.path)));
1530
+ return !isDefaultWorkspace && declarations.every((d) => (0, sourceFileInfoUtils_1.isUserCode)(this.getSourceFileInfo(d.path)));
1529
1531
  }
1530
1532
  _getReferenceResult(sourceFileInfo, filePath, position, allowModuleRename, token) {
1531
1533
  const execEnv = this._configOptions.findExecEnvironment(filePath);
1532
- const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv), position, this._evaluator, undefined, token);
1534
+ const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token), position, this._evaluator, undefined, token);
1533
1535
  if (!referencesResult) {
1534
1536
  return undefined;
1535
1537
  }
@@ -1718,15 +1720,15 @@ class Program {
1718
1720
  }
1719
1721
  return false;
1720
1722
  }
1721
- _createSourceMapper(execEnv, from, mapCompiled, preferStubs) {
1723
+ _createSourceMapper(execEnv, token, from, mapCompiled, preferStubs) {
1722
1724
  const sourceMapper = new sourceMapper_1.SourceMapper(this._importResolver, execEnv, this._evaluator, (stubFilePath, implFilePath) => {
1723
- const stubFileInfo = this._getSourceFileInfoFromPath(stubFilePath);
1725
+ const stubFileInfo = this.getSourceFileInfo(stubFilePath);
1724
1726
  if (!stubFileInfo) {
1725
1727
  return undefined;
1726
1728
  }
1727
1729
  this._addShadowedFile(stubFileInfo, implFilePath);
1728
1730
  return this.getBoundSourceFile(implFilePath);
1729
- }, (f) => this.getBoundSourceFileInfo(f), mapCompiled !== null && mapCompiled !== void 0 ? mapCompiled : false, preferStubs !== null && preferStubs !== void 0 ? preferStubs : false, from);
1731
+ }, (f) => this.getBoundSourceFileInfo(f), (f) => this.getSourceFileInfo(f), mapCompiled !== null && mapCompiled !== void 0 ? mapCompiled : false, preferStubs !== null && preferStubs !== void 0 ? preferStubs : false, from, token);
1730
1732
  return sourceMapper;
1731
1733
  }
1732
1734
  _isImportAllowed(importer, importResult, isImportStubFile) {
@@ -1894,8 +1896,8 @@ class Program {
1894
1896
  // We found a new import to add. See if it's already part
1895
1897
  // of the program.
1896
1898
  let importedFileInfo;
1897
- if (this._getSourceFileInfoFromPath(importInfo.path)) {
1898
- importedFileInfo = this._getSourceFileInfoFromPath(importInfo.path);
1899
+ if (this.getSourceFileInfo(importInfo.path)) {
1900
+ importedFileInfo = this.getSourceFileInfo(importInfo.path);
1899
1901
  }
1900
1902
  else {
1901
1903
  const importName = this._getImportNameForFile(importInfo.path);
@@ -1924,8 +1926,8 @@ class Program {
1924
1926
  // specified by the source file.
1925
1927
  sourceFileInfo.imports = [];
1926
1928
  newImportPathMap.forEach((_, path) => {
1927
- if (this._getSourceFileInfoFromPath(path)) {
1928
- sourceFileInfo.imports.push(this._getSourceFileInfoFromPath(path));
1929
+ if (this.getSourceFileInfo(path)) {
1930
+ sourceFileInfo.imports.push(this.getSourceFileInfo(path));
1929
1931
  }
1930
1932
  });
1931
1933
  // Resolve the builtins import for the file. This needs to be
@@ -1934,7 +1936,7 @@ class Program {
1934
1936
  const builtinsImport = sourceFileInfo.sourceFile.getBuiltinsImport();
1935
1937
  if (builtinsImport && builtinsImport.isImportFound) {
1936
1938
  const resolvedBuiltinsPath = builtinsImport.resolvedPaths[builtinsImport.resolvedPaths.length - 1];
1937
- sourceFileInfo.builtinsImport = this._getSourceFileInfoFromPath(resolvedBuiltinsPath);
1939
+ sourceFileInfo.builtinsImport = this.getSourceFileInfo(resolvedBuiltinsPath);
1938
1940
  }
1939
1941
  // Resolve the ipython display import for the file. This needs to be
1940
1942
  // analyzed before the file can be analyzed.
@@ -1942,13 +1944,10 @@ class Program {
1942
1944
  const ipythonDisplayImport = sourceFileInfo.sourceFile.getIPythonDisplayImport();
1943
1945
  if (ipythonDisplayImport && ipythonDisplayImport.isImportFound) {
1944
1946
  const resolvedIPythonDisplayPath = ipythonDisplayImport.resolvedPaths[ipythonDisplayImport.resolvedPaths.length - 1];
1945
- sourceFileInfo.ipythonDisplayImport = this._getSourceFileInfoFromPath(resolvedIPythonDisplayPath);
1947
+ sourceFileInfo.ipythonDisplayImport = this.getSourceFileInfo(resolvedIPythonDisplayPath);
1946
1948
  }
1947
1949
  return filesAdded;
1948
1950
  }
1949
- _getSourceFileInfoFromPath(filePath) {
1950
- return this._sourceFileMap.get((0, pathUtils_1.normalizePathCase)(this._fs, filePath));
1951
- }
1952
1951
  _removeSourceFileFromListAndMap(filePath, indexToRemove) {
1953
1952
  this._sourceFileMap.delete((0, pathUtils_1.normalizePathCase)(this._fs, filePath));
1954
1953
  this._sourceFileList.splice(indexToRemove, 1);