@zzzen/pyright-internal 1.2.0-dev.20231203 → 1.2.0-dev.20231210

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 (345) hide show
  1. package/dist/analyzer/analyzerFileInfo.d.ts +4 -3
  2. package/dist/analyzer/analyzerFileInfo.js.map +1 -1
  3. package/dist/analyzer/backgroundAnalysisProgram.d.ts +15 -14
  4. package/dist/analyzer/backgroundAnalysisProgram.js +38 -38
  5. package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
  6. package/dist/analyzer/binder.js +56 -52
  7. package/dist/analyzer/binder.js.map +1 -1
  8. package/dist/analyzer/checker.js +43 -33
  9. package/dist/analyzer/checker.js.map +1 -1
  10. package/dist/analyzer/circularDependency.d.ts +3 -2
  11. package/dist/analyzer/circularDependency.js.map +1 -1
  12. package/dist/analyzer/codeFlowEngine.js +29 -36
  13. package/dist/analyzer/codeFlowEngine.js.map +1 -1
  14. package/dist/analyzer/constraintSolver.js +3 -5
  15. package/dist/analyzer/constraintSolver.js.map +1 -1
  16. package/dist/analyzer/dataClasses.js +1 -1
  17. package/dist/analyzer/dataClasses.js.map +1 -1
  18. package/dist/analyzer/declaration.d.ts +5 -3
  19. package/dist/analyzer/declaration.js +3 -2
  20. package/dist/analyzer/declaration.js.map +1 -1
  21. package/dist/analyzer/declarationUtils.d.ts +3 -2
  22. package/dist/analyzer/declarationUtils.js +14 -12
  23. package/dist/analyzer/declarationUtils.js.map +1 -1
  24. package/dist/analyzer/enums.js +1 -1
  25. package/dist/analyzer/enums.js.map +1 -1
  26. package/dist/analyzer/importResolver.d.ts +29 -25
  27. package/dist/analyzer/importResolver.js +300 -301
  28. package/dist/analyzer/importResolver.js.map +1 -1
  29. package/dist/analyzer/importResult.d.ts +5 -4
  30. package/dist/analyzer/importResult.js.map +1 -1
  31. package/dist/analyzer/importStatementUtils.d.ts +5 -4
  32. package/dist/analyzer/importStatementUtils.js +23 -22
  33. package/dist/analyzer/importStatementUtils.js.map +1 -1
  34. package/dist/analyzer/namedTuples.js +3 -3
  35. package/dist/analyzer/namedTuples.js.map +1 -1
  36. package/dist/analyzer/packageTypeReport.d.ts +7 -6
  37. package/dist/analyzer/packageTypeReport.js +4 -4
  38. package/dist/analyzer/packageTypeReport.js.map +1 -1
  39. package/dist/analyzer/packageTypeVerifier.js +68 -64
  40. package/dist/analyzer/packageTypeVerifier.js.map +1 -1
  41. package/dist/analyzer/parentDirectoryCache.d.ts +7 -6
  42. package/dist/analyzer/parentDirectoryCache.js +9 -10
  43. package/dist/analyzer/parentDirectoryCache.js.map +1 -1
  44. package/dist/analyzer/parseTreeUtils.d.ts +1 -1
  45. package/dist/analyzer/parseTreeUtils.js +6 -3
  46. package/dist/analyzer/parseTreeUtils.js.map +1 -1
  47. package/dist/analyzer/patternMatching.js +79 -14
  48. package/dist/analyzer/patternMatching.js.map +1 -1
  49. package/dist/analyzer/program.d.ts +27 -26
  50. package/dist/analyzer/program.js +162 -156
  51. package/dist/analyzer/program.js.map +1 -1
  52. package/dist/analyzer/properties.js +3 -3
  53. package/dist/analyzer/properties.js.map +1 -1
  54. package/dist/analyzer/pyTypedUtils.d.ts +3 -2
  55. package/dist/analyzer/pyTypedUtils.js +4 -5
  56. package/dist/analyzer/pyTypedUtils.js.map +1 -1
  57. package/dist/analyzer/pythonPathUtils.d.ts +7 -6
  58. package/dist/analyzer/pythonPathUtils.js +21 -23
  59. package/dist/analyzer/pythonPathUtils.js.map +1 -1
  60. package/dist/analyzer/service.d.ts +24 -23
  61. package/dist/analyzer/service.js +187 -183
  62. package/dist/analyzer/service.js.map +1 -1
  63. package/dist/analyzer/sourceFile.d.ts +4 -5
  64. package/dist/analyzer/sourceFile.js +68 -56
  65. package/dist/analyzer/sourceFile.js.map +1 -1
  66. package/dist/analyzer/sourceFileInfoUtils.js +3 -3
  67. package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
  68. package/dist/analyzer/sourceMapper.d.ts +11 -10
  69. package/dist/analyzer/sourceMapper.js +59 -62
  70. package/dist/analyzer/sourceMapper.js.map +1 -1
  71. package/dist/analyzer/sourceMapperUtils.d.ts +2 -1
  72. package/dist/analyzer/sourceMapperUtils.js +2 -2
  73. package/dist/analyzer/sourceMapperUtils.js.map +1 -1
  74. package/dist/analyzer/tracePrinter.d.ts +3 -2
  75. package/dist/analyzer/tracePrinter.js +21 -23
  76. package/dist/analyzer/tracePrinter.js.map +1 -1
  77. package/dist/analyzer/typeDocStringUtils.d.ts +2 -1
  78. package/dist/analyzer/typeDocStringUtils.js +14 -17
  79. package/dist/analyzer/typeDocStringUtils.js.map +1 -1
  80. package/dist/analyzer/typeEvaluator.js +172 -102
  81. package/dist/analyzer/typeEvaluator.js.map +1 -1
  82. package/dist/analyzer/typeGuards.js +3 -3
  83. package/dist/analyzer/typeGuards.js.map +1 -1
  84. package/dist/analyzer/typePrinter.d.ts +2 -0
  85. package/dist/analyzer/typePrinter.js +48 -8
  86. package/dist/analyzer/typePrinter.js.map +1 -1
  87. package/dist/analyzer/typeStubWriter.d.ts +2 -1
  88. package/dist/analyzer/typeStubWriter.js +2 -2
  89. package/dist/analyzer/typeStubWriter.js.map +1 -1
  90. package/dist/analyzer/typeUtils.d.ts +4 -2
  91. package/dist/analyzer/typeUtils.js +16 -5
  92. package/dist/analyzer/typeUtils.js.map +1 -1
  93. package/dist/analyzer/typedDicts.js +4 -4
  94. package/dist/analyzer/typedDicts.js.map +1 -1
  95. package/dist/analyzer/types.d.ts +5 -4
  96. package/dist/analyzer/types.js +4 -4
  97. package/dist/analyzer/types.js.map +1 -1
  98. package/dist/backgroundAnalysis.d.ts +1 -2
  99. package/dist/backgroundAnalysis.js +6 -4
  100. package/dist/backgroundAnalysis.js.map +1 -1
  101. package/dist/backgroundAnalysisBase.d.ts +22 -20
  102. package/dist/backgroundAnalysisBase.js +76 -55
  103. package/dist/backgroundAnalysisBase.js.map +1 -1
  104. package/dist/backgroundThreadBase.d.ts +1 -1
  105. package/dist/backgroundThreadBase.js +20 -11
  106. package/dist/backgroundThreadBase.js.map +1 -1
  107. package/dist/commands/createTypeStub.js +3 -2
  108. package/dist/commands/createTypeStub.js.map +1 -1
  109. package/dist/commands/dumpFileDebugInfoCommand.js +21 -20
  110. package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
  111. package/dist/commands/quickActionCommand.js +5 -5
  112. package/dist/commands/quickActionCommand.js.map +1 -1
  113. package/dist/common/configOptions.d.ts +14 -13
  114. package/dist/common/configOptions.js +29 -27
  115. package/dist/common/configOptions.js.map +1 -1
  116. package/dist/common/diagnostic.d.ts +6 -5
  117. package/dist/common/diagnostic.js +2 -2
  118. package/dist/common/diagnostic.js.map +1 -1
  119. package/dist/common/diagnosticSink.d.ts +2 -1
  120. package/dist/common/diagnosticSink.js.map +1 -1
  121. package/dist/common/editAction.d.ts +6 -5
  122. package/dist/common/editAction.js +2 -2
  123. package/dist/common/editAction.js.map +1 -1
  124. package/dist/common/envVarUtils.d.ts +2 -1
  125. package/dist/common/envVarUtils.js +20 -28
  126. package/dist/common/envVarUtils.js.map +1 -1
  127. package/dist/common/extensibility.d.ts +19 -19
  128. package/dist/common/extensibility.js.map +1 -1
  129. package/dist/common/fileSystem.d.ts +29 -28
  130. package/dist/common/fileWatcher.d.ts +3 -2
  131. package/dist/common/fileWatcher.js.map +1 -1
  132. package/dist/common/fullAccessHost.d.ts +8 -7
  133. package/dist/common/fullAccessHost.js +21 -16
  134. package/dist/common/fullAccessHost.js.map +1 -1
  135. package/dist/common/host.d.ts +7 -6
  136. package/dist/common/host.js +1 -1
  137. package/dist/common/host.js.map +1 -1
  138. package/dist/common/logTracker.d.ts +2 -1
  139. package/dist/common/logTracker.js +4 -4
  140. package/dist/common/logTracker.js.map +1 -1
  141. package/dist/common/pathUtils.d.ts +1 -28
  142. package/dist/common/pathUtils.js +17 -366
  143. package/dist/common/pathUtils.js.map +1 -1
  144. package/dist/common/realFileSystem.d.ts +7 -3
  145. package/dist/common/realFileSystem.js +78 -60
  146. package/dist/common/realFileSystem.js.map +1 -1
  147. package/dist/common/serviceProviderExtensions.d.ts +2 -1
  148. package/dist/common/serviceProviderExtensions.js +5 -2
  149. package/dist/common/serviceProviderExtensions.js.map +1 -1
  150. package/dist/common/textEditTracker.d.ts +2 -1
  151. package/dist/common/textEditTracker.js +28 -28
  152. package/dist/common/textEditTracker.js.map +1 -1
  153. package/dist/common/textRange.d.ts +2 -1
  154. package/dist/common/textRange.js.map +1 -1
  155. package/dist/common/uri/baseUri.d.ts +51 -0
  156. package/dist/common/uri/baseUri.js +194 -0
  157. package/dist/common/uri/baseUri.js.map +1 -0
  158. package/dist/common/uri/emptyUri.d.ts +32 -0
  159. package/dist/common/uri/emptyUri.js +122 -0
  160. package/dist/common/uri/emptyUri.js.map +1 -0
  161. package/dist/common/uri/fileUri.d.ts +36 -0
  162. package/dist/common/uri/fileUri.js +180 -0
  163. package/dist/common/uri/fileUri.js.map +1 -0
  164. package/dist/common/uri/memoization.d.ts +3 -0
  165. package/dist/common/uri/memoization.js +72 -0
  166. package/dist/common/uri/memoization.js.map +1 -0
  167. package/dist/common/uri/uri.d.ts +50 -0
  168. package/dist/common/uri/uri.js +104 -0
  169. package/dist/common/uri/uri.js.map +1 -0
  170. package/dist/common/uri/uriUtils.d.ts +39 -0
  171. package/dist/common/uri/uriUtils.js +362 -0
  172. package/dist/common/uri/uriUtils.js.map +1 -0
  173. package/dist/common/uri/webUri.d.ts +36 -0
  174. package/dist/common/uri/webUri.js +207 -0
  175. package/dist/common/uri/webUri.js.map +1 -0
  176. package/dist/common/workspaceEditUtils.d.ts +8 -8
  177. package/dist/common/workspaceEditUtils.js +34 -37
  178. package/dist/common/workspaceEditUtils.js.map +1 -1
  179. package/dist/languageServerBase.d.ts +19 -22
  180. package/dist/languageServerBase.js +91 -95
  181. package/dist/languageServerBase.js.map +1 -1
  182. package/dist/languageService/analyzerServiceExecutor.d.ts +2 -1
  183. package/dist/languageService/analyzerServiceExecutor.js +14 -16
  184. package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
  185. package/dist/languageService/autoImporter.d.ts +11 -9
  186. package/dist/languageService/autoImporter.js +45 -44
  187. package/dist/languageService/autoImporter.js.map +1 -1
  188. package/dist/languageService/callHierarchyProvider.d.ts +3 -2
  189. package/dist/languageService/callHierarchyProvider.js +23 -35
  190. package/dist/languageService/callHierarchyProvider.js.map +1 -1
  191. package/dist/languageService/codeActionProvider.d.ts +2 -1
  192. package/dist/languageService/codeActionProvider.js +8 -10
  193. package/dist/languageService/codeActionProvider.js.map +1 -1
  194. package/dist/languageService/completionProvider.d.ts +7 -6
  195. package/dist/languageService/completionProvider.js +32 -30
  196. package/dist/languageService/completionProvider.js.map +1 -1
  197. package/dist/languageService/completionProviderUtils.d.ts +2 -1
  198. package/dist/languageService/completionProviderUtils.js +1 -1
  199. package/dist/languageService/completionProviderUtils.js.map +1 -1
  200. package/dist/languageService/definitionProvider.d.ts +4 -3
  201. package/dist/languageService/definitionProvider.js +26 -24
  202. package/dist/languageService/definitionProvider.js.map +1 -1
  203. package/dist/languageService/documentHighlightProvider.d.ts +3 -2
  204. package/dist/languageService/documentHighlightProvider.js +3 -3
  205. package/dist/languageService/documentHighlightProvider.js.map +1 -1
  206. package/dist/languageService/documentSymbolCollector.js +8 -7
  207. package/dist/languageService/documentSymbolCollector.js.map +1 -1
  208. package/dist/languageService/documentSymbolProvider.d.ts +5 -4
  209. package/dist/languageService/documentSymbolProvider.js +9 -11
  210. package/dist/languageService/documentSymbolProvider.js.map +1 -1
  211. package/dist/languageService/hoverProvider.d.ts +4 -3
  212. package/dist/languageService/hoverProvider.js +6 -5
  213. package/dist/languageService/hoverProvider.js.map +1 -1
  214. package/dist/languageService/navigationUtils.d.ts +2 -1
  215. package/dist/languageService/navigationUtils.js +2 -3
  216. package/dist/languageService/navigationUtils.js.map +1 -1
  217. package/dist/languageService/quickActions.d.ts +2 -1
  218. package/dist/languageService/quickActions.js +3 -3
  219. package/dist/languageService/quickActions.js.map +1 -1
  220. package/dist/languageService/referencesProvider.d.ts +10 -9
  221. package/dist/languageService/referencesProvider.js +28 -28
  222. package/dist/languageService/referencesProvider.js.map +1 -1
  223. package/dist/languageService/renameProvider.d.ts +4 -3
  224. package/dist/languageService/renameProvider.js +17 -18
  225. package/dist/languageService/renameProvider.js.map +1 -1
  226. package/dist/languageService/signatureHelpProvider.d.ts +3 -2
  227. package/dist/languageService/signatureHelpProvider.js +4 -4
  228. package/dist/languageService/signatureHelpProvider.js.map +1 -1
  229. package/dist/languageService/symbolIndexer.d.ts +2 -1
  230. package/dist/languageService/symbolIndexer.js +1 -1
  231. package/dist/languageService/symbolIndexer.js.map +1 -1
  232. package/dist/languageService/tooltipUtils.js +10 -4
  233. package/dist/languageService/tooltipUtils.js.map +1 -1
  234. package/dist/languageService/workspaceSymbolProvider.d.ts +4 -3
  235. package/dist/languageService/workspaceSymbolProvider.js +10 -11
  236. package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
  237. package/dist/localization/localize.d.ts +1 -0
  238. package/dist/localization/localize.js +1 -0
  239. package/dist/localization/localize.js.map +1 -1
  240. package/dist/localization/package.nls.en-us.json +2 -1
  241. package/dist/pyright.js +18 -17
  242. package/dist/pyright.js.map +1 -1
  243. package/dist/pyrightFileSystem.d.ts +13 -13
  244. package/dist/pyrightFileSystem.js +38 -43
  245. package/dist/pyrightFileSystem.js.map +1 -1
  246. package/dist/readonlyAugmentedFileSystem.d.ts +29 -28
  247. package/dist/readonlyAugmentedFileSystem.js +62 -65
  248. package/dist/readonlyAugmentedFileSystem.js.map +1 -1
  249. package/dist/server.js +21 -20
  250. package/dist/server.js.map +1 -1
  251. package/dist/tests/chainedSourceFiles.test.js +39 -30
  252. package/dist/tests/chainedSourceFiles.test.js.map +1 -1
  253. package/dist/tests/checker.test.js +31 -30
  254. package/dist/tests/checker.test.js.map +1 -1
  255. package/dist/tests/completions.test.js +7 -3
  256. package/dist/tests/completions.test.js.map +1 -1
  257. package/dist/tests/config.test.js +24 -22
  258. package/dist/tests/config.test.js.map +1 -1
  259. package/dist/tests/documentSymbolCollector.test.js +3 -2
  260. package/dist/tests/documentSymbolCollector.test.js.map +1 -1
  261. package/dist/tests/filesystem.test.js +37 -35
  262. package/dist/tests/filesystem.test.js.map +1 -1
  263. package/dist/tests/fourSlashParser.test.js +4 -4
  264. package/dist/tests/fourSlashParser.test.js.map +1 -1
  265. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js +27 -11
  266. package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -1
  267. package/dist/tests/harness/fourslash/fourSlashParser.js +2 -2
  268. package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
  269. package/dist/tests/harness/fourslash/testLanguageService.d.ts +4 -5
  270. package/dist/tests/harness/fourslash/testLanguageService.js +9 -15
  271. package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
  272. package/dist/tests/harness/fourslash/testState.d.ts +4 -4
  273. package/dist/tests/harness/fourslash/testState.js +91 -51
  274. package/dist/tests/harness/fourslash/testState.js.map +1 -1
  275. package/dist/tests/harness/testAccessHost.d.ts +3 -2
  276. package/dist/tests/harness/testAccessHost.js +2 -1
  277. package/dist/tests/harness/testAccessHost.js.map +1 -1
  278. package/dist/tests/harness/testHost.js +13 -11
  279. package/dist/tests/harness/testHost.js.map +1 -1
  280. package/dist/tests/harness/vfs/factory.d.ts +3 -2
  281. package/dist/tests/harness/vfs/factory.js +5 -4
  282. package/dist/tests/harness/vfs/factory.js.map +1 -1
  283. package/dist/tests/harness/vfs/filesystem.d.ts +32 -31
  284. package/dist/tests/harness/vfs/filesystem.js +47 -49
  285. package/dist/tests/harness/vfs/filesystem.js.map +1 -1
  286. package/dist/tests/harness/vfs/pathValidation.js +1 -10
  287. package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
  288. package/dist/tests/importResolver.test.js +81 -58
  289. package/dist/tests/importResolver.test.js.map +1 -1
  290. package/dist/tests/importStatementUtils.test.js +10 -9
  291. package/dist/tests/importStatementUtils.test.js.map +1 -1
  292. package/dist/tests/ipythonMode.test.js +12 -11
  293. package/dist/tests/ipythonMode.test.js.map +1 -1
  294. package/dist/tests/logger.test.js +2 -1
  295. package/dist/tests/logger.test.js.map +1 -1
  296. package/dist/tests/parseTreeUtils.test.js +2 -1
  297. package/dist/tests/parseTreeUtils.test.js.map +1 -1
  298. package/dist/tests/pathUtils.test.js +3 -138
  299. package/dist/tests/pathUtils.test.js.map +1 -1
  300. package/dist/tests/pyrightFileSystem.test.js +38 -34
  301. package/dist/tests/pyrightFileSystem.test.js.map +1 -1
  302. package/dist/tests/service.test.js +37 -42
  303. package/dist/tests/service.test.js.map +1 -1
  304. package/dist/tests/signatureHelp.test.js +3 -2
  305. package/dist/tests/signatureHelp.test.js.map +1 -1
  306. package/dist/tests/sourceFile.test.js +8 -7
  307. package/dist/tests/sourceFile.test.js.map +1 -1
  308. package/dist/tests/sourceMapperUtils.test.js +13 -6
  309. package/dist/tests/sourceMapperUtils.test.js.map +1 -1
  310. package/dist/tests/testState.test.js +13 -9
  311. package/dist/tests/testState.test.js.map +1 -1
  312. package/dist/tests/testStateUtils.d.ts +2 -5
  313. package/dist/tests/testStateUtils.js +27 -64
  314. package/dist/tests/testStateUtils.js.map +1 -1
  315. package/dist/tests/testUtils.d.ts +3 -5
  316. package/dist/tests/testUtils.js +15 -64
  317. package/dist/tests/testUtils.js.map +1 -1
  318. package/dist/tests/textEditUtil.test.js +4 -3
  319. package/dist/tests/textEditUtil.test.js.map +1 -1
  320. package/dist/tests/typeEvaluator1.test.js +16 -15
  321. package/dist/tests/typeEvaluator1.test.js.map +1 -1
  322. package/dist/tests/typeEvaluator2.test.js +18 -9
  323. package/dist/tests/typeEvaluator2.test.js.map +1 -1
  324. package/dist/tests/typeEvaluator3.test.js +73 -62
  325. package/dist/tests/typeEvaluator3.test.js.map +1 -1
  326. package/dist/tests/typeEvaluator4.test.js +20 -19
  327. package/dist/tests/typeEvaluator4.test.js.map +1 -1
  328. package/dist/tests/typeEvaluator5.test.js +28 -27
  329. package/dist/tests/typeEvaluator5.test.js.map +1 -1
  330. package/dist/tests/typePrinter.test.js +4 -3
  331. package/dist/tests/typePrinter.test.js.map +1 -1
  332. package/dist/tests/uri.test.d.ts +1 -0
  333. package/dist/tests/uri.test.js +695 -0
  334. package/dist/tests/uri.test.js.map +1 -0
  335. package/dist/tests/workspaceEditUtils.test.js +28 -28
  336. package/dist/tests/workspaceEditUtils.test.js.map +1 -1
  337. package/dist/tests/zipfs.test.js +11 -11
  338. package/dist/tests/zipfs.test.js.map +1 -1
  339. package/dist/workspaceFactory.d.ts +13 -14
  340. package/dist/workspaceFactory.js +54 -55
  341. package/dist/workspaceFactory.js.map +1 -1
  342. package/package.json +2 -2
  343. package/dist/common/uriParser.d.ts +0 -24
  344. package/dist/common/uriParser.js +0 -45
  345. package/dist/common/uriParser.js.map +0 -1
@@ -41,12 +41,13 @@ const console_1 = require("../common/console");
41
41
  const debug = __importStar(require("../common/debug"));
42
42
  const debug_1 = require("../common/debug");
43
43
  const logTracker_1 = require("../common/logTracker");
44
- const pathUtils_1 = require("../common/pathUtils");
45
44
  const positionUtils_1 = require("../common/positionUtils");
46
45
  require("../common/serviceProviderExtensions");
47
46
  const serviceProviderExtensions_1 = require("../common/serviceProviderExtensions");
48
47
  const textRange_1 = require("../common/textRange");
49
48
  const timing_1 = require("../common/timing");
49
+ const uri_1 = require("../common/uri/uri");
50
+ const uriUtils_1 = require("../common/uri/uriUtils");
50
51
  const AnalyzerNodeInfo = __importStar(require("./analyzerNodeInfo"));
51
52
  const cacheManager_1 = require("./cacheManager");
52
53
  const circularDependency_1 = require("./circularDependency");
@@ -104,21 +105,21 @@ class Program {
104
105
  this._sourceFileMap = new Map();
105
106
  this._parsedFileCount = 0;
106
107
  this._editModeTracker = new EditModeTracker();
107
- this._lookUpImport = (filePathOrModule, options) => {
108
+ this._lookUpImport = (fileUriOrModule, options) => {
108
109
  var _a;
109
110
  let sourceFileInfo;
110
- if (typeof filePathOrModule === 'string') {
111
- sourceFileInfo = this.getSourceFileInfo(filePathOrModule);
111
+ if (uri_1.Uri.isUri(fileUriOrModule)) {
112
+ sourceFileInfo = this.getSourceFileInfo(fileUriOrModule);
112
113
  }
113
114
  else {
114
115
  // Resolve the import.
115
- const importResult = this._importResolver.resolveImport(filePathOrModule.importingFilePath, this._configOptions.findExecEnvironment(filePathOrModule.importingFilePath), {
116
+ const importResult = this._importResolver.resolveImport(fileUriOrModule.importingFileUri, this._configOptions.findExecEnvironment(fileUriOrModule.importingFileUri), {
116
117
  leadingDots: 0,
117
- nameParts: filePathOrModule.nameParts,
118
+ nameParts: fileUriOrModule.nameParts,
118
119
  importedSymbols: undefined,
119
120
  });
120
- if (importResult.isImportFound && !importResult.isNativeLib && importResult.resolvedPaths.length > 0) {
121
- const resolvedPath = importResult.resolvedPaths[importResult.resolvedPaths.length - 1];
121
+ if (importResult.isImportFound && !importResult.isNativeLib && importResult.resolvedUris.length > 0) {
122
+ const resolvedPath = importResult.resolvedUris[importResult.resolvedUris.length - 1];
122
123
  if (resolvedPath) {
123
124
  // See if the source file already exists in the program.
124
125
  sourceFileInfo = this.getSourceFileInfo(resolvedPath);
@@ -224,10 +225,10 @@ class Program {
224
225
  const newContents = fileInfo.restore();
225
226
  if (newContents) {
226
227
  // Create a text document so we can compute the edits.
227
- const textDocument = vscode_languageserver_textdocument_1.TextDocument.create(fileInfo.sourceFile.getFilePath(), 'python', 1, fileInfo.sourceFile.getFileContent() || '');
228
+ const textDocument = vscode_languageserver_textdocument_1.TextDocument.create(fileInfo.sourceFile.getUri().toString(), 'python', 1, fileInfo.sourceFile.getFileContent() || '');
228
229
  // Add an edit action to the list.
229
230
  edits.push({
230
- filePath: fileInfo.sourceFile.getFilePath(),
231
+ fileUri: fileInfo.sourceFile.getUri(),
231
232
  range: {
232
233
  start: { line: 0, character: 0 },
233
234
  end: { line: textDocument.lineCount, character: 0 },
@@ -245,7 +246,7 @@ class Program {
245
246
  // We don't need to care about file diagnostics since in edit mode
246
247
  // checker won't run.
247
248
  v.sourceFile.prepareForClose();
248
- this._removeSourceFileFromListAndMap(v.sourceFile.getFilePath(), i);
249
+ this._removeSourceFileFromListAndMap(v.sourceFile.getUri(), i);
249
250
  }
250
251
  }
251
252
  }
@@ -269,24 +270,24 @@ class Program {
269
270
  this._createNewEvaluator();
270
271
  }
271
272
  // Sets the list of tracked files that make up the program.
272
- setTrackedFiles(filePaths) {
273
+ setTrackedFiles(fileUris) {
273
274
  if (this._sourceFileList.length > 0) {
274
275
  // We need to determine which files to remove from the existing file list.
275
276
  const newFileMap = new Map();
276
- filePaths.forEach((path) => {
277
- newFileMap.set(path, path);
277
+ fileUris.forEach((path) => {
278
+ newFileMap.set(path.key, path);
278
279
  });
279
280
  // Files that are not in the tracked file list are
280
281
  // marked as no longer tracked.
281
282
  this._sourceFileList.forEach((oldFile) => {
282
- const filePath = oldFile.sourceFile.getFilePath();
283
- if (!newFileMap.has(filePath)) {
283
+ const fileUri = oldFile.sourceFile.getUri();
284
+ if (!newFileMap.has(fileUri.key)) {
284
285
  oldFile.isTracked = false;
285
286
  }
286
287
  });
287
288
  }
288
289
  // Add the new files. Only the new items will be added.
289
- this.addTrackedFiles(filePaths);
290
+ this.addTrackedFiles(fileUris);
290
291
  return this._removeUnneededFiles();
291
292
  }
292
293
  // Allows a caller to set a callback that is called right before
@@ -302,23 +303,23 @@ class Program {
302
303
  setAllowedThirdPartyImports(importNames) {
303
304
  this._allowedThirdPartyImports = importNames;
304
305
  }
305
- addTrackedFiles(filePaths, isThirdPartyImport = false, isInPyTypedPackage = false) {
306
- filePaths.forEach((filePath) => {
307
- this.addTrackedFile(filePath, isThirdPartyImport, isInPyTypedPackage);
306
+ addTrackedFiles(fileUris, isThirdPartyImport = false, isInPyTypedPackage = false) {
307
+ fileUris.forEach((fileUri) => {
308
+ this.addTrackedFile(fileUri, isThirdPartyImport, isInPyTypedPackage);
308
309
  });
309
310
  }
310
- addInterimFile(filePath) {
311
+ addInterimFile(fileUri) {
311
312
  // Double check not already there.
312
- let fileInfo = this.getSourceFileInfo(filePath);
313
+ let fileInfo = this.getSourceFileInfo(fileUri);
313
314
  if (!fileInfo) {
314
- fileInfo = this._createInterimFileInfo(filePath);
315
+ fileInfo = this._createInterimFileInfo(fileUri);
315
316
  this._addToSourceFileListAndMap(fileInfo);
316
317
  }
317
318
  return fileInfo;
318
319
  }
319
- addTrackedFile(filePath, isThirdPartyImport = false, isInPyTypedPackage = false) {
320
- let sourceFileInfo = this.getSourceFileInfo(filePath);
321
- const moduleImportInfo = this._getModuleImportInfoForFile(filePath);
320
+ addTrackedFile(fileUri, isThirdPartyImport = false, isInPyTypedPackage = false) {
321
+ let sourceFileInfo = this.getSourceFileInfo(fileUri);
322
+ const moduleImportInfo = this._getModuleImportInfoForFile(fileUri);
322
323
  const importName = moduleImportInfo.moduleName;
323
324
  if (sourceFileInfo) {
324
325
  // The module name may have changed based on updates to the
@@ -327,7 +328,7 @@ class Program {
327
328
  sourceFileInfo.isTracked = true;
328
329
  return sourceFileInfo.sourceFile;
329
330
  }
330
- const sourceFile = this._sourceFileFactory.createSourceFile(this.serviceProvider, filePath, importName, isThirdPartyImport, isInPyTypedPackage, this._editModeTracker, this._console, this._logTracker);
331
+ const sourceFile = this._sourceFileFactory.createSourceFile(this.serviceProvider, fileUri, importName, isThirdPartyImport, isInPyTypedPackage, this._editModeTracker, this._console, this._logTracker);
331
332
  sourceFileInfo = new sourceFileInfo_1.SourceFileInfo(sourceFile,
332
333
  /* isTypeshedFile */ false, isThirdPartyImport, isInPyTypedPackage, this._editModeTracker, {
333
334
  isTracked: true,
@@ -335,14 +336,14 @@ class Program {
335
336
  this._addToSourceFileListAndMap(sourceFileInfo);
336
337
  return sourceFile;
337
338
  }
338
- setFileOpened(filePath, version, contents, options) {
339
+ setFileOpened(fileUri, version, contents, options) {
339
340
  var _a, _b;
340
- let sourceFileInfo = this.getSourceFileInfo(filePath);
341
+ let sourceFileInfo = this.getSourceFileInfo(fileUri);
341
342
  if (!sourceFileInfo) {
342
- const moduleImportInfo = this._getModuleImportInfoForFile(filePath);
343
- const sourceFile = this._sourceFileFactory.createSourceFile(this.serviceProvider, filePath, moduleImportInfo.moduleName,
344
- /* isThirdPartyImport */ false, moduleImportInfo.isThirdPartyPyTypedPresent, this._editModeTracker, this._console, this._logTracker, options === null || options === void 0 ? void 0 : options.realFilePath, (_a = options === null || options === void 0 ? void 0 : options.ipythonMode) !== null && _a !== void 0 ? _a : sourceFile_1.IPythonMode.None);
345
- const chainedFilePath = options === null || options === void 0 ? void 0 : options.chainedFilePath;
343
+ const moduleImportInfo = this._getModuleImportInfoForFile(fileUri);
344
+ const sourceFile = this._sourceFileFactory.createSourceFile(this.serviceProvider, fileUri, moduleImportInfo.moduleName,
345
+ /* isThirdPartyImport */ false, moduleImportInfo.isThirdPartyPyTypedPresent, this._editModeTracker, this._console, this._logTracker, (_a = options === null || options === void 0 ? void 0 : options.ipythonMode) !== null && _a !== void 0 ? _a : sourceFile_1.IPythonMode.None);
346
+ const chainedFilePath = options === null || options === void 0 ? void 0 : options.chainedFileUri;
346
347
  sourceFileInfo = new sourceFileInfo_1.SourceFileInfo(sourceFile,
347
348
  /* isTypeshedFile */ false,
348
349
  /* isThirdPartyImport */ false,
@@ -364,23 +365,23 @@ class Program {
364
365
  (0, sourceFileInfoUtils_1.verifyNoCyclesInChainedFiles)(this, sourceFileInfo);
365
366
  sourceFileInfo.sourceFile.setClientVersion(version, contents);
366
367
  }
367
- getChainedFilePath(filePath) {
368
+ getChainedUri(fileUri) {
368
369
  var _a;
369
- const sourceFileInfo = this.getSourceFileInfo(filePath);
370
- return (_a = sourceFileInfo === null || sourceFileInfo === void 0 ? void 0 : sourceFileInfo.chainedSourceFile) === null || _a === void 0 ? void 0 : _a.sourceFile.getFilePath();
370
+ const sourceFileInfo = this.getSourceFileInfo(fileUri);
371
+ return (_a = sourceFileInfo === null || sourceFileInfo === void 0 ? void 0 : sourceFileInfo.chainedSourceFile) === null || _a === void 0 ? void 0 : _a.sourceFile.getUri();
371
372
  }
372
- updateChainedFilePath(filePath, chainedFilePath) {
373
- const sourceFileInfo = this.getSourceFileInfo(filePath);
373
+ updateChainedUri(fileUri, chainedFileUri) {
374
+ const sourceFileInfo = this.getSourceFileInfo(fileUri);
374
375
  if (!sourceFileInfo) {
375
376
  return;
376
377
  }
377
- sourceFileInfo.chainedSourceFile = chainedFilePath ? this.getSourceFileInfo(chainedFilePath) : undefined;
378
+ sourceFileInfo.chainedSourceFile = chainedFileUri ? this.getSourceFileInfo(chainedFileUri) : undefined;
378
379
  sourceFileInfo.sourceFile.markDirty();
379
380
  this._markFileDirtyRecursive(sourceFileInfo, new Set());
380
381
  (0, sourceFileInfoUtils_1.verifyNoCyclesInChainedFiles)(this, sourceFileInfo);
381
382
  }
382
- setFileClosed(filePath, isTracked) {
383
- const sourceFileInfo = this.getSourceFileInfo(filePath);
383
+ setFileClosed(fileUri, isTracked) {
384
+ const sourceFileInfo = this.getSourceFileInfo(fileUri);
384
385
  if (sourceFileInfo) {
385
386
  sourceFileInfo.isOpenByClient = false;
386
387
  sourceFileInfo.isTracked = isTracked !== null && isTracked !== void 0 ? isTracked : sourceFileInfo.isTracked;
@@ -413,12 +414,12 @@ class Program {
413
414
  this._createNewEvaluator();
414
415
  }
415
416
  }
416
- markFilesDirty(filePaths, evenIfContentsAreSame) {
417
+ markFilesDirty(fileUris, evenIfContentsAreSame) {
417
418
  const markDirtySet = new Set();
418
- filePaths.forEach((filePath) => {
419
- const sourceFileInfo = this.getSourceFileInfo(filePath);
419
+ fileUris.forEach((fileUri) => {
420
+ const sourceFileInfo = this.getSourceFileInfo(fileUri);
420
421
  if (sourceFileInfo) {
421
- const fileName = (0, pathUtils_1.getFileName)(filePath);
422
+ const fileName = fileUri.fileName;
422
423
  // Handle builtins and __builtins__ specially. They are implicitly
423
424
  // included by all source files.
424
425
  if (fileName === 'builtins.pyi' || fileName === '__builtins__.pyi') {
@@ -479,41 +480,44 @@ class Program {
479
480
  return this._configOptions.functionSignatureDisplay;
480
481
  }
481
482
  containsSourceFileIn(folder) {
482
- for (const normalizedSourceFilePath of this._sourceFileMap.keys()) {
483
- if (normalizedSourceFilePath.startsWith(folder)) {
483
+ for (const normalizedSourceFilePath of this._sourceFileMap.values()) {
484
+ if (normalizedSourceFilePath.sourceFile.getUri().startsWith(folder)) {
484
485
  return true;
485
486
  }
486
487
  }
487
488
  return false;
488
489
  }
489
- owns(filePath) {
490
- const fileInfo = this.getSourceFileInfo(filePath);
490
+ owns(uri) {
491
+ const fileInfo = this.getSourceFileInfo(uri);
491
492
  if (fileInfo) {
492
493
  // If we already determined whether the file is tracked or not, don't do it again.
493
494
  // This will make sure we have consistent look at the state once it is loaded to the memory.
494
495
  return fileInfo.isTracked;
495
496
  }
496
- return (0, configOptions_1.matchFileSpecs)(this._configOptions, filePath);
497
+ return (0, configOptions_1.matchFileSpecs)(this._configOptions, uri);
497
498
  }
498
- getSourceFile(filePath) {
499
- const sourceFileInfo = this.getSourceFileInfo(filePath);
499
+ getSourceFile(uri) {
500
+ const sourceFileInfo = this.getSourceFileInfo(uri);
500
501
  if (!sourceFileInfo) {
501
502
  return undefined;
502
503
  }
503
504
  return sourceFileInfo.sourceFile;
504
505
  }
505
- getBoundSourceFile(filePath) {
506
+ getBoundSourceFile(uri) {
506
507
  var _a;
507
- return (_a = this.getBoundSourceFileInfo(filePath)) === null || _a === void 0 ? void 0 : _a.sourceFile;
508
+ return (_a = this.getBoundSourceFileInfo(uri)) === null || _a === void 0 ? void 0 : _a.sourceFile;
508
509
  }
509
510
  getSourceFileInfoList() {
510
511
  return this._sourceFileList;
511
512
  }
512
- getSourceFileInfo(filePath) {
513
- return this._sourceFileMap.get(filePath);
513
+ getSourceFileInfo(uri) {
514
+ if (!uri.isEmpty()) {
515
+ return this._sourceFileMap.get(uri.key);
516
+ }
517
+ return undefined;
514
518
  }
515
- getBoundSourceFileInfo(filePath, content, force) {
516
- const sourceFileInfo = this.getSourceFileInfo(filePath);
519
+ getBoundSourceFileInfo(uri, content, force) {
520
+ const sourceFileInfo = this.getSourceFileInfo(uri);
517
521
  if (!sourceFileInfo) {
518
522
  return undefined;
519
523
  }
@@ -566,9 +570,9 @@ class Program {
566
570
  }
567
571
  // Performs parsing and analysis of a single file in the program. If the file is not part of
568
572
  // the program returns false to indicate analysis was not performed.
569
- analyzeFile(filePath, token = vscode_languageserver_1.CancellationToken.None) {
573
+ analyzeFile(fileUri, token = vscode_languageserver_1.CancellationToken.None) {
570
574
  return this._runEvaluatorWithCancellationToken(token, () => {
571
- const sourceFileInfo = this.getSourceFileInfo(filePath);
575
+ const sourceFileInfo = this.getSourceFileInfo(fileUri);
572
576
  if (sourceFileInfo && this._checkTypes(sourceFileInfo, token)) {
573
577
  return true;
574
578
  }
@@ -587,14 +591,14 @@ class Program {
587
591
  return this._runEvaluatorWithCancellationToken(token, () => callback(this));
588
592
  }
589
593
  }
590
- getSourceMapper(filePath, token, mapCompiled, preferStubs) {
591
- const sourceFileInfo = this.getSourceFileInfo(filePath);
592
- const execEnv = this._configOptions.findExecEnvironment(filePath);
594
+ getSourceMapper(fileUri, token, mapCompiled, preferStubs) {
595
+ const sourceFileInfo = this.getSourceFileInfo(fileUri);
596
+ const execEnv = this._configOptions.findExecEnvironment(fileUri);
593
597
  return this._createSourceMapper(execEnv, token, sourceFileInfo, mapCompiled, preferStubs);
594
598
  }
595
- getParseResults(filePath) {
599
+ getParseResults(fileUri) {
596
600
  var _a;
597
- return (_a = this.getBoundSourceFileInfo(filePath,
601
+ return (_a = this.getBoundSourceFileInfo(fileUri,
598
602
  /* content */ undefined,
599
603
  /* force */ true)) === null || _a === void 0 ? void 0 : _a.sourceFile.getParseResults();
600
604
  }
@@ -613,7 +617,7 @@ class Program {
613
617
  this._console.info('Analysis time by file');
614
618
  sortedFiles.forEach((sfInfo) => {
615
619
  const checkTimeInMs = sfInfo.sourceFile.getCheckTime();
616
- this._console.info(`${checkTimeInMs}ms: ${sfInfo.sourceFile.getFilePath()}`);
620
+ this._console.info(`${checkTimeInMs}ms: ${sfInfo.sourceFile.getUri()}`);
617
621
  });
618
622
  }
619
623
  // Prints import dependency information for each of the files in
@@ -623,30 +627,28 @@ class Program {
623
627
  const sortedFiles = this._sourceFileList
624
628
  .filter((s) => !s.isTypeshedFile)
625
629
  .sort((a, b) => {
626
- return fs.getOriginalFilePath(a.sourceFile.getFilePath()) <
627
- fs.getOriginalFilePath(b.sourceFile.getFilePath())
628
- ? 1
629
- : -1;
630
+ return fs.getOriginalUri(a.sourceFile.getUri()) < fs.getOriginalUri(b.sourceFile.getUri()) ? 1 : -1;
630
631
  });
631
632
  const zeroImportFiles = [];
632
633
  sortedFiles.forEach((sfInfo) => {
633
634
  this._console.info('');
634
- let filePath = fs.getOriginalFilePath(sfInfo.sourceFile.getFilePath());
635
- const relPath = (0, pathUtils_1.getRelativePath)(filePath, projectRootDir);
635
+ const fileUri = fs.getOriginalUri(sfInfo.sourceFile.getUri());
636
+ let fileString = fileUri.toString();
637
+ const relPath = projectRootDir.getRelativePathComponents(fileUri);
636
638
  if (relPath) {
637
- filePath = relPath;
639
+ fileString = relPath.join('/');
638
640
  }
639
- this._console.info(`${filePath}`);
641
+ this._console.info(`${fileString}`);
640
642
  this._console.info(` Imports ${sfInfo.imports.length} ` + `file${sfInfo.imports.length === 1 ? '' : 's'}`);
641
643
  if (verbose) {
642
644
  sfInfo.imports.forEach((importInfo) => {
643
- this._console.info(` ${fs.getOriginalFilePath(importInfo.sourceFile.getFilePath())}`);
645
+ this._console.info(` ${fs.getOriginalUri(importInfo.sourceFile.getUri())}`);
644
646
  });
645
647
  }
646
648
  this._console.info(` Imported by ${sfInfo.importedBy.length} ` + `file${sfInfo.importedBy.length === 1 ? '' : 's'}`);
647
649
  if (verbose) {
648
650
  sfInfo.importedBy.forEach((importInfo) => {
649
- this._console.info(` ${fs.getOriginalFilePath(importInfo.sourceFile.getFilePath())}`);
651
+ this._console.info(` ${fs.getOriginalUri(importInfo.sourceFile.getUri())}`);
650
652
  });
651
653
  }
652
654
  if (sfInfo.importedBy.length === 0) {
@@ -657,31 +659,31 @@ class Program {
657
659
  this._console.info('');
658
660
  this._console.info(`${zeroImportFiles.length} file${zeroImportFiles.length === 1 ? '' : 's'}` + ` not explicitly imported`);
659
661
  zeroImportFiles.forEach((importFile) => {
660
- this._console.info(` ${fs.getOriginalFilePath(importFile.getFilePath())}`);
662
+ this._console.info(` ${fs.getOriginalUri(importFile.getUri())}`);
661
663
  });
662
664
  }
663
665
  }
664
666
  writeTypeStub(targetImportPath, targetIsSingleFile, stubPath, token) {
665
667
  for (const sourceFileInfo of this._sourceFileList) {
666
668
  (0, cancellationUtils_1.throwIfCancellationRequested)(token);
667
- const filePath = sourceFileInfo.sourceFile.getFilePath();
669
+ const fileUri = sourceFileInfo.sourceFile.getUri();
668
670
  // Generate type stubs only for the files within the target path,
669
671
  // not any files that the target module happened to import.
670
- const relativePath = (0, pathUtils_1.getRelativePath)(filePath, targetImportPath);
672
+ const relativePath = targetImportPath.getRelativePath(fileUri);
671
673
  if (relativePath !== undefined) {
672
- let typeStubPath = (0, pathUtils_1.normalizePath)((0, pathUtils_1.combinePaths)(stubPath, relativePath));
674
+ let typeStubPath = stubPath.combinePaths(relativePath);
673
675
  // If the target is a single file implementation, as opposed to
674
676
  // a package in a directory, transform the name of the type stub
675
677
  // to __init__.pyi because we're placing it in a directory.
676
678
  if (targetIsSingleFile) {
677
- typeStubPath = (0, pathUtils_1.combinePaths)((0, pathUtils_1.getDirectoryPath)(typeStubPath), '__init__.pyi');
679
+ typeStubPath = typeStubPath.getDirectory().combinePaths('__init__.pyi');
678
680
  }
679
681
  else {
680
- typeStubPath = (0, pathUtils_1.stripFileExtension)(typeStubPath) + '.pyi';
682
+ typeStubPath = typeStubPath.replaceExtension('.pyi');
681
683
  }
682
- const typeStubDir = (0, pathUtils_1.getDirectoryPath)(typeStubPath);
684
+ const typeStubDir = typeStubPath.getDirectory();
683
685
  try {
684
- (0, pathUtils_1.makeDirectories)(this.fileSystem, typeStubDir, stubPath);
686
+ (0, uriUtils_1.makeDirectories)(this.fileSystem, typeStubDir, stubPath);
685
687
  }
686
688
  catch (e) {
687
689
  const errMsg = `Could not create directory for '${typeStubDir}'`;
@@ -708,8 +710,8 @@ class Program {
708
710
  const evaluator = this._evaluator || this._createNewEvaluator();
709
711
  return evaluator.printType(type, options);
710
712
  }
711
- getTextOnRange(filePath, range, token) {
712
- const sourceFileInfo = this.getSourceFileInfo(filePath);
713
+ getTextOnRange(fileUri, range, token) {
714
+ const sourceFileInfo = this.getSourceFileInfo(fileUri);
713
715
  if (!sourceFileInfo) {
714
716
  return undefined;
715
717
  }
@@ -736,7 +738,7 @@ class Program {
736
738
  const diagnostics = sourceFileInfo.sourceFile.getDiagnostics(options, sourceFileInfo.diagnosticsVersion);
737
739
  if (diagnostics !== undefined) {
738
740
  fileDiagnostics.push({
739
- filePath: sourceFileInfo.sourceFile.getFilePath(),
741
+ fileUri: sourceFileInfo.sourceFile.getUri(),
740
742
  version: sourceFileInfo.sourceFile.getClientVersion(),
741
743
  diagnostics,
742
744
  });
@@ -751,7 +753,7 @@ class Program {
751
753
  // This condition occurs when the user switches from workspace to
752
754
  // "open files only" mode. Clear all diagnostics for this file.
753
755
  fileDiagnostics.push({
754
- filePath: sourceFileInfo.sourceFile.getFilePath(),
756
+ fileUri: sourceFileInfo.sourceFile.getUri(),
755
757
  version: sourceFileInfo.sourceFile.getClientVersion(),
756
758
  diagnostics: [],
757
759
  });
@@ -760,8 +762,8 @@ class Program {
760
762
  });
761
763
  return fileDiagnostics;
762
764
  }
763
- getDiagnosticsForRange(filePath, range) {
764
- const sourceFile = this.getSourceFile(filePath);
765
+ getDiagnosticsForRange(fileUri, range) {
766
+ const sourceFile = this.getSourceFile(fileUri);
765
767
  if (!sourceFile) {
766
768
  return [];
767
769
  }
@@ -778,7 +780,7 @@ class Program {
778
780
  const program = new Program(this._importResolver, this._configOptions, this.serviceProvider, new logTracker_1.LogTracker(this._console, 'Cloned'));
779
781
  // Cloned program will use whatever user files the program currently has.
780
782
  const userFiles = this.getUserFiles();
781
- program.setTrackedFiles(userFiles.map((i) => i.sourceFile.getFilePath()));
783
+ program.setTrackedFiles(userFiles.map((i) => i.sourceFile.getUri()));
782
784
  program.markAllFilesDirty(/* evenIfContentsAreSame */ true);
783
785
  // Make sure we keep editor content (open file) which could be different than one in the file system.
784
786
  for (const fileInfo of this.getOpened()) {
@@ -786,11 +788,10 @@ class Program {
786
788
  if (version === undefined) {
787
789
  continue;
788
790
  }
789
- program.setFileOpened(fileInfo.sourceFile.getFilePath(), version, (_a = fileInfo.sourceFile.getOpenFileContents()) !== null && _a !== void 0 ? _a : '', {
790
- chainedFilePath: (_b = fileInfo.chainedSourceFile) === null || _b === void 0 ? void 0 : _b.sourceFile.getFilePath(),
791
+ program.setFileOpened(fileInfo.sourceFile.getUri(), version, (_a = fileInfo.sourceFile.getOpenFileContents()) !== null && _a !== void 0 ? _a : '', {
792
+ chainedFileUri: (_b = fileInfo.chainedSourceFile) === null || _b === void 0 ? void 0 : _b.sourceFile.getUri(),
791
793
  ipythonMode: fileInfo.sourceFile.getIPythonMode(),
792
794
  isTracked: fileInfo.isTracked,
793
- realFilePath: fileInfo.sourceFile.getRealFilePath(),
794
795
  });
795
796
  }
796
797
  return program;
@@ -872,13 +873,13 @@ class Program {
872
873
  // Clear only if there are any errors for this file.
873
874
  if (fileInfo.diagnosticsVersion !== undefined) {
874
875
  fileDiagnostics.push({
875
- filePath: fileInfo.sourceFile.getFilePath(),
876
+ fileUri: fileInfo.sourceFile.getUri(),
876
877
  version: fileInfo.sourceFile.getClientVersion(),
877
878
  diagnostics: [],
878
879
  });
879
880
  }
880
881
  fileInfo.sourceFile.prepareForClose();
881
- this._removeSourceFileFromListAndMap(fileInfo.sourceFile.getFilePath(), i);
882
+ this._removeSourceFileFromListAndMap(fileInfo.sourceFile.getUri(), i);
882
883
  // Unlink any imports and remove them from the list if
883
884
  // they are no longer referenced.
884
885
  fileInfo.imports.forEach((importedFile) => {
@@ -896,13 +897,13 @@ class Program {
896
897
  // Clear if there are any errors for this import.
897
898
  if (importedFile.diagnosticsVersion !== undefined) {
898
899
  fileDiagnostics.push({
899
- filePath: importedFile.sourceFile.getFilePath(),
900
+ fileUri: importedFile.sourceFile.getUri(),
900
901
  version: importedFile.sourceFile.getClientVersion(),
901
902
  diagnostics: [],
902
903
  });
903
904
  }
904
905
  importedFile.sourceFile.prepareForClose();
905
- this._removeSourceFileFromListAndMap(importedFile.sourceFile.getFilePath(), indexToRemove);
906
+ this._removeSourceFileFromListAndMap(importedFile.sourceFile.getUri(), indexToRemove);
906
907
  i--;
907
908
  }
908
909
  }
@@ -918,7 +919,7 @@ class Program {
918
919
  // out the errors for the now-closed file.
919
920
  if (!this._shouldCheckFile(fileInfo) && fileInfo.diagnosticsVersion !== undefined) {
920
921
  fileDiagnostics.push({
921
- filePath: fileInfo.sourceFile.getFilePath(),
922
+ fileUri: fileInfo.sourceFile.getUri(),
922
923
  version: fileInfo.sourceFile.getClientVersion(),
923
924
  diagnostics: [],
924
925
  });
@@ -952,12 +953,12 @@ class Program {
952
953
  if (fileInfo.isTracked || fileInfo.isOpenByClient || fileInfo.shadows.length > 0) {
953
954
  return true;
954
955
  }
955
- const filePath = fileInfo.sourceFile.getFilePath();
956
+ const fileUri = fileInfo.sourceFile.getUri();
956
957
  // Avoid infinite recursion.
957
- if (recursionSet.has(filePath)) {
958
+ if (recursionSet.has(fileUri.key)) {
958
959
  return false;
959
960
  }
960
- recursionSet.add(filePath);
961
+ recursionSet.add(fileUri.key);
961
962
  for (const importerInfo of fileInfo.importedBy) {
962
963
  if (this._isImportNeededRecursive(importerInfo, recursionSet)) {
963
964
  return true;
@@ -966,15 +967,15 @@ class Program {
966
967
  return false;
967
968
  }
968
969
  _createSourceMapper(execEnv, token, from, mapCompiled, preferStubs) {
969
- const sourceMapper = new sourceMapper_1.SourceMapper(this._importResolver, execEnv, this._evaluator, (stubFilePath, implFilePath) => {
970
- let stubFileInfo = this.getSourceFileInfo(stubFilePath);
970
+ const sourceMapper = new sourceMapper_1.SourceMapper(this._importResolver, execEnv, this._evaluator, (stubFileUri, implFileUri) => {
971
+ let stubFileInfo = this.getSourceFileInfo(stubFileUri);
971
972
  if (!stubFileInfo) {
972
973
  // Special case for import statement like "import X.Y". The SourceFile
973
974
  // for X might not be in memory since import `X.Y` only brings in Y.
974
- stubFileInfo = this.addInterimFile(stubFilePath);
975
+ stubFileInfo = this.addInterimFile(stubFileUri);
975
976
  }
976
- this._addShadowedFile(stubFileInfo, implFilePath);
977
- return this.getBoundSourceFile(implFilePath);
977
+ this._addShadowedFile(stubFileInfo, implFileUri);
978
+ return this.getBoundSourceFile(implFileUri);
978
979
  }, (f) => {
979
980
  let fileInfo = this.getBoundSourceFileInfo(f);
980
981
  if (!fileInfo) {
@@ -1045,6 +1046,9 @@ class Program {
1045
1046
  }
1046
1047
  return true;
1047
1048
  }
1049
+ _getSourceFileInfoFromKey(key) {
1050
+ return this._sourceFileMap.get(key);
1051
+ }
1048
1052
  _updateSourceFileImports(sourceFileInfo, options) {
1049
1053
  const filesAdded = [];
1050
1054
  // Get the new list of imports and see if it changed from the last
@@ -1083,9 +1087,9 @@ class Program {
1083
1087
  sourceFileInfo.chainedSourceFile = undefined;
1084
1088
  }
1085
1089
  else {
1086
- const filePath = sourceFileInfo.chainedSourceFile.sourceFile.getFilePath();
1087
- newImportPathMap.set(filePath, {
1088
- path: filePath,
1090
+ const fileUri = sourceFileInfo.chainedSourceFile.sourceFile.getUri();
1091
+ newImportPathMap.set(fileUri.key, {
1092
+ path: fileUri,
1089
1093
  isTypeshedFile: false,
1090
1094
  isThirdPartyImport: false,
1091
1095
  isPyTypedPresent: false,
@@ -1095,12 +1099,12 @@ class Program {
1095
1099
  imports.forEach((importResult) => {
1096
1100
  if (importResult.isImportFound) {
1097
1101
  if (this._isImportAllowed(sourceFileInfo, importResult, importResult.isStubFile)) {
1098
- if (importResult.resolvedPaths.length > 0) {
1099
- const filePath = importResult.resolvedPaths[importResult.resolvedPaths.length - 1];
1100
- if (filePath) {
1102
+ if (importResult.resolvedUris.length > 0) {
1103
+ const fileUri = importResult.resolvedUris[importResult.resolvedUris.length - 1];
1104
+ if (!fileUri.isEmpty()) {
1101
1105
  const thirdPartyTypeInfo = getThirdPartyImportInfo(importResult);
1102
- newImportPathMap.set(filePath, {
1103
- path: filePath,
1106
+ newImportPathMap.set(fileUri.key, {
1107
+ path: fileUri,
1104
1108
  isTypeshedFile: !!importResult.isStdlibTypeshedFile || !!importResult.isThirdPartyTypeshedFile,
1105
1109
  isThirdPartyImport: thirdPartyTypeInfo.isThirdPartyImport,
1106
1110
  isPyTypedPresent: thirdPartyTypeInfo.isPyTypedPresent,
@@ -1112,8 +1116,8 @@ class Program {
1112
1116
  if (this._isImportAllowed(sourceFileInfo, importResult, implicitImport.isStubFile)) {
1113
1117
  if (!implicitImport.isNativeLib) {
1114
1118
  const thirdPartyTypeInfo = getThirdPartyImportInfo(importResult);
1115
- newImportPathMap.set(implicitImport.path, {
1116
- path: implicitImport.path,
1119
+ newImportPathMap.set(implicitImport.uri.key, {
1120
+ path: implicitImport.uri,
1117
1121
  isTypeshedFile: !!importResult.isStdlibTypeshedFile || !!importResult.isThirdPartyTypeshedFile,
1118
1122
  isThirdPartyImport: thirdPartyTypeInfo.isThirdPartyImport,
1119
1123
  isPyTypedPresent: thirdPartyTypeInfo.isPyTypedPresent,
@@ -1130,7 +1134,7 @@ class Program {
1130
1134
  if (!sourceFileInfo.sourceFile.isStubFile() && !importResult.isStdlibTypeshedFile) {
1131
1135
  if (options.verboseOutput) {
1132
1136
  this._console.info(`Could not resolve source for '${importResult.importName}' ` +
1133
- `in file '${sourceFileInfo.sourceFile.getFilePath()}'`);
1137
+ `in file '${sourceFileInfo.sourceFile.getUri().toUserVisibleString()}'`);
1134
1138
  if (importResult.nonStubImportResult.importFailureInfo) {
1135
1139
  importResult.nonStubImportResult.importFailureInfo.forEach((diag) => {
1136
1140
  this._console.info(` ${diag}`);
@@ -1142,7 +1146,7 @@ class Program {
1142
1146
  }
1143
1147
  else if (options.verboseOutput) {
1144
1148
  this._console.info(`Could not import '${importResult.importName}' ` +
1145
- `in file '${sourceFileInfo.sourceFile.getFilePath()}'`);
1149
+ `in file '${sourceFileInfo.sourceFile.getUri().toUserVisibleString()}'`);
1146
1150
  if (importResult.importFailureInfo) {
1147
1151
  importResult.importFailureInfo.forEach((diag) => {
1148
1152
  this._console.info(` ${diag}`);
@@ -1152,15 +1156,15 @@ class Program {
1152
1156
  });
1153
1157
  const updatedImportMap = new Map();
1154
1158
  sourceFileInfo.imports.forEach((importInfo) => {
1155
- const oldFilePath = importInfo.sourceFile.getFilePath();
1159
+ const oldFilePath = importInfo.sourceFile.getUri();
1156
1160
  // A previous import was removed.
1157
- if (!newImportPathMap.has(oldFilePath)) {
1161
+ if (!newImportPathMap.has(oldFilePath.key)) {
1158
1162
  importInfo.mutate((s) => {
1159
- s.importedBy = s.importedBy.filter((fi) => fi.sourceFile.getFilePath() !== sourceFileInfo.sourceFile.getFilePath());
1163
+ s.importedBy = s.importedBy.filter((fi) => !fi.sourceFile.getUri().equals(sourceFileInfo.sourceFile.getUri()));
1160
1164
  });
1161
1165
  }
1162
1166
  else {
1163
- updatedImportMap.set(oldFilePath, importInfo);
1167
+ updatedImportMap.set(oldFilePath.key, importInfo);
1164
1168
  }
1165
1169
  });
1166
1170
  // See if there are any new imports to be added.
@@ -1183,9 +1187,9 @@ class Program {
1183
1187
  // Update the imports list. It should now map the set of imports
1184
1188
  // specified by the source file.
1185
1189
  sourceFileInfo.mutate((s) => (s.imports = []));
1186
- newImportPathMap.forEach((_, path) => {
1187
- if (this.getSourceFileInfo(path)) {
1188
- sourceFileInfo.mutate((s) => s.imports.push(this.getSourceFileInfo(path)));
1190
+ newImportPathMap.forEach((_, key) => {
1191
+ if (this._getSourceFileInfoFromKey(key)) {
1192
+ sourceFileInfo.mutate((s) => s.imports.push(this._getSourceFileInfoFromKey(key)));
1189
1193
  }
1190
1194
  });
1191
1195
  // Resolve the builtins import for the file. This needs to be
@@ -1193,21 +1197,23 @@ class Program {
1193
1197
  sourceFileInfo.builtinsImport = undefined;
1194
1198
  const builtinsImport = sourceFileInfo.sourceFile.getBuiltinsImport();
1195
1199
  if (builtinsImport && builtinsImport.isImportFound) {
1196
- const resolvedBuiltinsPath = builtinsImport.resolvedPaths[builtinsImport.resolvedPaths.length - 1];
1200
+ const resolvedBuiltinsPath = builtinsImport.resolvedUris[builtinsImport.resolvedUris.length - 1];
1197
1201
  sourceFileInfo.builtinsImport = this.getSourceFileInfo(resolvedBuiltinsPath);
1198
1202
  }
1199
1203
  return filesAdded;
1200
1204
  }
1201
- _removeSourceFileFromListAndMap(filePath, indexToRemove) {
1202
- this._sourceFileMap.delete(filePath);
1205
+ _removeSourceFileFromListAndMap(fileUri, indexToRemove) {
1206
+ this._sourceFileMap.delete(fileUri.key);
1203
1207
  this._sourceFileList.splice(indexToRemove, 1);
1204
1208
  }
1205
1209
  _addToSourceFileListAndMap(fileInfo) {
1206
- const filePath = fileInfo.sourceFile.getFilePath();
1210
+ const fileUri = fileInfo.sourceFile.getUri();
1207
1211
  // We should never add a file with the same path twice.
1208
- (0, debug_1.assert)(!this._sourceFileMap.has(filePath));
1212
+ (0, debug_1.assert)(!this._sourceFileMap.has(fileUri.key));
1213
+ // We should never have an empty URI for a source file.
1214
+ (0, debug_1.assert)(!fileInfo.sourceFile.getUri().isEmpty());
1209
1215
  this._sourceFileList.push(fileInfo);
1210
- this._sourceFileMap.set(filePath, fileInfo);
1216
+ this._sourceFileMap.set(fileUri.key, fileInfo);
1211
1217
  }
1212
1218
  static _getPrintTypeFlags(configOptions) {
1213
1219
  let flags = 0 /* PrintTypeFlags.None */;
@@ -1228,14 +1234,14 @@ class Program {
1228
1234
  }
1229
1235
  return flags;
1230
1236
  }
1231
- _getModuleImportInfoForFile(filePath) {
1237
+ _getModuleImportInfoForFile(fileUri) {
1232
1238
  // We allow illegal module names (e.g. names that include "-" in them)
1233
1239
  // because we want a unique name for each module even if it cannot be
1234
1240
  // imported through an "import" statement. It's important to have a
1235
1241
  // unique name in case two modules declare types with the same local
1236
1242
  // name. The type checker uses the fully-qualified (unique) module name
1237
1243
  // to differentiate between such types.
1238
- const moduleNameAndType = this._importResolver.getModuleNameForImport(filePath, this._configOptions.getDefaultExecEnvironment(),
1244
+ const moduleNameAndType = this._importResolver.getModuleNameForImport(fileUri, this._configOptions.getDefaultExecEnvironment(),
1239
1245
  /* allowIllegalModuleName */ true,
1240
1246
  /* detectPyTyped */ true);
1241
1247
  return moduleNameAndType;
@@ -1257,9 +1263,9 @@ class Program {
1257
1263
  }
1258
1264
  return shadowFileInfo.sourceFile;
1259
1265
  }
1260
- _createInterimFileInfo(filePath) {
1261
- const moduleImportInfo = this._getModuleImportInfoForFile(filePath);
1262
- const sourceFile = this._sourceFileFactory.createSourceFile(this.serviceProvider, filePath, moduleImportInfo.moduleName,
1266
+ _createInterimFileInfo(fileUri) {
1267
+ const moduleImportInfo = this._getModuleImportInfoForFile(fileUri);
1268
+ const sourceFile = this._sourceFileFactory.createSourceFile(this.serviceProvider, fileUri, moduleImportInfo.moduleName,
1263
1269
  /* isThirdPartyImport */ false,
1264
1270
  /* isInPyTypedPackage */ false, this._editModeTracker, this._console, this._logTracker);
1265
1271
  const sourceFileInfo = new sourceFileInfo_1.SourceFileInfo(sourceFile,
@@ -1331,13 +1337,13 @@ class Program {
1331
1337
  const implicitSet = new Set();
1332
1338
  let nextImplicitImport = this._getImplicitImports(fileToAnalyze);
1333
1339
  while (nextImplicitImport) {
1334
- const implicitPath = nextImplicitImport.sourceFile.getFilePath();
1335
- if (implicitSet.has(implicitPath)) {
1340
+ const implicitPath = nextImplicitImport.sourceFile.getUri();
1341
+ if (implicitSet.has(implicitPath.key)) {
1336
1342
  // We've found a cycle. Break out of the loop.
1337
1343
  debug.fail((_b = (_a = this.serviceProvider
1338
1344
  .tryGet(serviceProviderExtensions_1.ServiceKeys.debugInfoInspector)) === null || _a === void 0 ? void 0 : _a.getCycleDetail(this, nextImplicitImport)) !== null && _b !== void 0 ? _b : `Found a cycle in implicit imports files`);
1339
1345
  }
1340
- implicitSet.add(implicitPath);
1346
+ implicitSet.add(implicitPath.key);
1341
1347
  implicitImports.push(nextImplicitImport);
1342
1348
  this._parseFile(nextImplicitImport, /* content */ undefined, skipFileNeededCheck);
1343
1349
  nextImplicitImport = this._getImplicitImports(nextImplicitImport);
@@ -1418,7 +1424,7 @@ class Program {
1418
1424
  return false;
1419
1425
  }
1420
1426
  _checkTypes(fileToCheck, token, chainedByList) {
1421
- return this._logTracker.log(`analyzing: ${fileToCheck.sourceFile.getFilePath()}`, (logState) => {
1427
+ return this._logTracker.log(`analyzing: ${fileToCheck.sourceFile.getUri()}`, (logState) => {
1422
1428
  // If the file isn't needed because it was eliminated from the
1423
1429
  // transitive closure or deleted, skip the file rather than wasting
1424
1430
  // time on it.
@@ -1449,7 +1455,7 @@ class Program {
1449
1455
  }
1450
1456
  }
1451
1457
  if (boundFile) {
1452
- const execEnv = this._configOptions.findExecEnvironment(fileToCheck.sourceFile.getFilePath());
1458
+ const execEnv = this._configOptions.findExecEnvironment(fileToCheck.sourceFile.getUri());
1453
1459
  fileToCheck.sourceFile.check(this.configOptions, this._importResolver, this._evaluator, this._createSourceMapper(execEnv, token, fileToCheck), dependentFiles);
1454
1460
  }
1455
1461
  }
@@ -1537,8 +1543,8 @@ class Program {
1537
1543
  _getImportsRecursive(file, closureMap, recursionCount) {
1538
1544
  // If the file is already in the closure map, we found a cyclical
1539
1545
  // dependency. Don't recur further.
1540
- const filePath = file.sourceFile.getFilePath();
1541
- if (closureMap.has(filePath)) {
1546
+ const fileUri = file.sourceFile.getUri();
1547
+ if (closureMap.has(fileUri.key)) {
1542
1548
  return;
1543
1549
  }
1544
1550
  // If the import chain is too long, emit an error. Otherwise we
@@ -1548,7 +1554,7 @@ class Program {
1548
1554
  return;
1549
1555
  }
1550
1556
  // Add the file to the closure map.
1551
- closureMap.set(filePath, file);
1557
+ closureMap.set(fileUri.key, file);
1552
1558
  // If this file hasn't already been parsed, parse it now. This will
1553
1559
  // discover any files it imports. Skip this if the file is part
1554
1560
  // of a library. We'll assume that no cycles will be generated from
@@ -1571,10 +1577,10 @@ class Program {
1571
1577
  if (sourceFileInfo.sourceFile.isNoCircularDependencyConfirmed()) {
1572
1578
  return false;
1573
1579
  }
1574
- const filePath = sourceFileInfo.sourceFile.getFilePath();
1575
- filesVisited.set(filePath, sourceFileInfo);
1580
+ const fileUri = sourceFileInfo.sourceFile.getUri();
1581
+ filesVisited.set(fileUri.key, sourceFileInfo);
1576
1582
  let detectedCycle = false;
1577
- if (dependencyMap.has(filePath)) {
1583
+ if (dependencyMap.has(fileUri.key)) {
1578
1584
  // We detect a cycle (partial or full). A full cycle is one that is
1579
1585
  // rooted in the file at the start of our dependency chain. A partial
1580
1586
  // cycle loops back on some other file in the dependency chain. We
@@ -1591,14 +1597,14 @@ class Program {
1591
1597
  else {
1592
1598
  // If we've already checked this dependency along
1593
1599
  // some other path, we can skip it.
1594
- if (dependencyMap.has(filePath)) {
1600
+ if (dependencyMap.has(fileUri.key)) {
1595
1601
  return false;
1596
1602
  }
1597
1603
  // We use both a map (for fast lookups) and a list
1598
1604
  // (for ordering information). Set the dependency map
1599
1605
  // entry to true to indicate that we're actively exploring
1600
1606
  // that dependency.
1601
- dependencyMap.set(filePath, true);
1607
+ dependencyMap.set(fileUri.key, true);
1602
1608
  dependencyChain.push(sourceFileInfo);
1603
1609
  for (const imp of sourceFileInfo.imports) {
1604
1610
  if (this._detectAndReportImportCycles(imp, filesVisited, dependencyChain, dependencyMap)) {
@@ -1607,7 +1613,7 @@ class Program {
1607
1613
  }
1608
1614
  // Set the dependencyMap entry to false to indicate that we have
1609
1615
  // already explored this file and don't need to explore it again.
1610
- dependencyMap.set(filePath, false);
1616
+ dependencyMap.set(fileUri.key, false);
1611
1617
  dependencyChain.pop();
1612
1618
  }
1613
1619
  return detectedCycle;
@@ -1615,7 +1621,7 @@ class Program {
1615
1621
  _logImportCycle(dependencyChain) {
1616
1622
  const circDep = new circularDependency_1.CircularDependency();
1617
1623
  dependencyChain.forEach((sourceFileInfo) => {
1618
- circDep.appendPath(sourceFileInfo.sourceFile.getFilePath());
1624
+ circDep.appendPath(sourceFileInfo.sourceFile.getUri());
1619
1625
  });
1620
1626
  circDep.normalizeOrder();
1621
1627
  const firstFilePath = circDep.getPaths()[0];
@@ -1624,13 +1630,13 @@ class Program {
1624
1630
  firstSourceFile.sourceFile.addCircularDependency(this.configOptions, circDep);
1625
1631
  }
1626
1632
  _markFileDirtyRecursive(sourceFileInfo, markSet, forceRebinding = false) {
1627
- const filePath = sourceFileInfo.sourceFile.getFilePath();
1633
+ const fileUri = sourceFileInfo.sourceFile.getUri();
1628
1634
  // Don't mark it again if it's already been visited.
1629
- if (markSet.has(filePath)) {
1635
+ if (markSet.has(fileUri.key)) {
1630
1636
  return;
1631
1637
  }
1632
1638
  sourceFileInfo.sourceFile.markReanalysisRequired(forceRebinding);
1633
- markSet.add(filePath);
1639
+ markSet.add(fileUri.key);
1634
1640
  sourceFileInfo.importedBy.forEach((dep) => {
1635
1641
  // Changes on chained source file can change symbols in the symbol table and
1636
1642
  // dependencies on the dependent file. Force rebinding.
@@ -1650,7 +1656,7 @@ class Program {
1650
1656
  chainedSourceFile.sourceFile.markReanalysisRequired(/* forceRebinding */ false);
1651
1657
  chainedSourceFile = chainedSourceFile.chainedSourceFile;
1652
1658
  }
1653
- // If the checker is going to run again, we have to recreate the type evaulator so
1659
+ // If the checker is going to run again, we have to recreate the type evaluator so
1654
1660
  // that it actually reevaluates all the nodes (instead of using the cache).
1655
1661
  // This is necessary because the original file change may not recreate the TypeEvaluator.
1656
1662
  // For example, it might be a file delete.