@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
@@ -44,6 +44,8 @@ const pathConsts_1 = require("../common/pathConsts");
44
44
  const pathUtils_1 = require("../common/pathUtils");
45
45
  const serviceProviderExtensions_1 = require("../common/serviceProviderExtensions");
46
46
  const timing_1 = require("../common/timing");
47
+ const uri_1 = require("../common/uri/uri");
48
+ const uriUtils_1 = require("../common/uri/uriUtils");
47
49
  const backgroundAnalysisProgram_1 = require("./backgroundAnalysisProgram");
48
50
  const importResolver_1 = require("./importResolver");
49
51
  const pythonPathUtils_1 = require("./pythonPathUtils");
@@ -53,7 +55,7 @@ exports.pyprojectTomlName = 'pyproject.toml';
53
55
  // How long since the last user activity should we wait until running
54
56
  // the analyzer on any files that have not yet been analyzed?
55
57
  const _userActivityBackoffTimeInMs = 250;
56
- const _gitDirectory = (0, pathUtils_1.normalizeSlashes)('/.git/');
58
+ const _gitDirectory = '/.git/';
57
59
  // Hold uniqueId for this service. It can be used to distinguish each service later.
58
60
  let _nextServiceId = 1;
59
61
  function getNextServiceId(name) {
@@ -69,7 +71,7 @@ class AnalyzerService {
69
71
  this._disposed = false;
70
72
  this._pendingLibraryChanges = { changesOnly: true };
71
73
  this._instanceName = instanceName;
72
- this._executionRootPath = '';
74
+ this._executionRootUri = uri_1.Uri.empty();
73
75
  this._options = options;
74
76
  this._options.serviceId = (_a = this._options.serviceId) !== null && _a !== void 0 ? _a : getNextServiceId(instanceName);
75
77
  this._options.console = options.console || new console_1.StandardConsole();
@@ -85,7 +87,8 @@ class AnalyzerService {
85
87
  this._options.importResolverFactory = (_b = options.importResolverFactory) !== null && _b !== void 0 ? _b : AnalyzerService.createImportResolver;
86
88
  this._options.cancellationProvider = (_c = options.cancellationProvider) !== null && _c !== void 0 ? _c : new cancellationUtils_1.DefaultCancellationProvider();
87
89
  this._options.hostFactory = (_d = options.hostFactory) !== null && _d !== void 0 ? _d : (() => new host_1.NoAccessHost());
88
- this._options.configOptions = (_e = options.configOptions) !== null && _e !== void 0 ? _e : new configOptions_1.ConfigOptions(process.cwd());
90
+ this._options.configOptions =
91
+ (_e = options.configOptions) !== null && _e !== void 0 ? _e : new configOptions_1.ConfigOptions(uri_1.Uri.file(process.cwd(), this._serviceProvider.fs().isCaseSensitive));
89
92
  const importResolver = this._options.importResolverFactory(this._serviceProvider, this._options.configOptions, this._options.hostFactory());
90
93
  this._backgroundAnalysisProgram =
91
94
  this._options.backgroundAnalysisProgramFactory !== undefined
@@ -102,8 +105,8 @@ class AnalyzerService {
102
105
  get cancellationProvider() {
103
106
  return this._options.cancellationProvider;
104
107
  }
105
- get librarySearchPathsToWatch() {
106
- return this._librarySearchPathsToWatch;
108
+ get librarySearchUrisToWatch() {
109
+ return this._librarySearchUrisToWatch;
107
110
  }
108
111
  get backgroundAnalysisProgram() {
109
112
  return this._backgroundAnalysisProgram;
@@ -131,7 +134,7 @@ class AnalyzerService {
131
134
  for (const fileInfo of this.backgroundAnalysisProgram.program.getOpened()) {
132
135
  const version = fileInfo.sourceFile.getClientVersion();
133
136
  if (version !== undefined) {
134
- service.setFileOpened(fileInfo.sourceFile.getFilePath(), version, fileInfo.sourceFile.getOpenFileContents(), fileInfo.sourceFile.getIPythonMode(), (_a = fileInfo.chainedSourceFile) === null || _a === void 0 ? void 0 : _a.sourceFile.getFilePath(), fileInfo.sourceFile.getRealFilePath());
137
+ service.setFileOpened(fileInfo.sourceFile.getUri(), version, fileInfo.sourceFile.getOpenFileContents(), fileInfo.sourceFile.getIPythonMode(), (_a = fileInfo.chainedSourceFile) === null || _a === void 0 ? void 0 : _a.sourceFile.getUri());
135
138
  }
136
139
  }
137
140
  return service;
@@ -178,64 +181,62 @@ class AnalyzerService {
178
181
  }
179
182
  configOptions.ensureDefaultPythonPlatform(host, this._console);
180
183
  this._backgroundAnalysisProgram.setConfigOptions(configOptions);
181
- this._executionRootPath = (0, pathUtils_1.realCasePath)((0, pathUtils_1.combinePaths)(commandLineOptions.executionRoot, configOptions.projectRoot), this.fs);
184
+ this._executionRootUri = configOptions.projectRoot;
182
185
  this._applyConfigOptions(host);
183
186
  }
184
- hasSourceFile(filePath) {
185
- return this.backgroundAnalysisProgram.hasSourceFile(filePath);
187
+ hasSourceFile(uri) {
188
+ return this.backgroundAnalysisProgram.hasSourceFile(uri);
186
189
  }
187
- isTracked(filePath) {
188
- return this._program.owns(filePath);
190
+ isTracked(uri) {
191
+ return this._program.owns(uri);
189
192
  }
190
193
  getUserFiles() {
191
- return this._program.getUserFiles().map((i) => i.sourceFile.getFilePath());
194
+ return this._program.getUserFiles().map((i) => i.sourceFile.getUri());
192
195
  }
193
196
  getOpenFiles() {
194
- return this._program.getOpened().map((i) => i.sourceFile.getFilePath());
197
+ return this._program.getOpened().map((i) => i.sourceFile.getUri());
195
198
  }
196
- setFileOpened(path, version, contents, ipythonMode = sourceFile_1.IPythonMode.None, chainedFilePath, realFilePath) {
199
+ setFileOpened(uri, version, contents, ipythonMode = sourceFile_1.IPythonMode.None, chainedFileUri) {
197
200
  // Open the file. Notebook cells are always tracked as they aren't 3rd party library files.
198
201
  // This is how it's worked in the past since each notebook used to have its own
199
202
  // workspace and the workspace include setting marked all cells as tracked.
200
- this._backgroundAnalysisProgram.setFileOpened(path, version, contents, {
201
- isTracked: this.isTracked(path) || ipythonMode !== sourceFile_1.IPythonMode.None,
203
+ this._backgroundAnalysisProgram.setFileOpened(uri, version, contents, {
204
+ isTracked: this.isTracked(uri) || ipythonMode !== sourceFile_1.IPythonMode.None,
202
205
  ipythonMode,
203
- chainedFilePath,
204
- realFilePath,
206
+ chainedFileUri: chainedFileUri,
205
207
  });
206
208
  this._scheduleReanalysis(/* requireTrackedFileUpdate */ false);
207
209
  }
208
- getChainedFilePath(path) {
209
- return this._backgroundAnalysisProgram.getChainedFilePath(path);
210
+ getChainedUri(uri) {
211
+ return this._backgroundAnalysisProgram.getChainedUri(uri);
210
212
  }
211
- updateChainedFilePath(path, chainedFilePath) {
212
- this._backgroundAnalysisProgram.updateChainedFilePath(path, chainedFilePath);
213
+ updateChainedUri(uri, chainedFileUri) {
214
+ this._backgroundAnalysisProgram.updateChainedUri(uri, chainedFileUri);
213
215
  this._scheduleReanalysis(/* requireTrackedFileUpdate */ false);
214
216
  }
215
- updateOpenFileContents(path, version, contents, ipythonMode = sourceFile_1.IPythonMode.None, realFilePath) {
216
- this._backgroundAnalysisProgram.updateOpenFileContents(path, version, contents, {
217
- isTracked: this.isTracked(path),
217
+ updateOpenFileContents(uri, version, contents, ipythonMode = sourceFile_1.IPythonMode.None) {
218
+ this._backgroundAnalysisProgram.updateOpenFileContents(uri, version, contents, {
219
+ isTracked: this.isTracked(uri),
218
220
  ipythonMode,
219
- chainedFilePath: undefined,
220
- realFilePath,
221
+ chainedFileUri: undefined,
221
222
  });
222
223
  this._scheduleReanalysis(/* requireTrackedFileUpdate */ false);
223
224
  }
224
- setFileClosed(path, isTracked) {
225
- this._backgroundAnalysisProgram.setFileClosed(path, isTracked);
225
+ setFileClosed(uri, isTracked) {
226
+ this._backgroundAnalysisProgram.setFileClosed(uri, isTracked);
226
227
  this._scheduleReanalysis(/* requireTrackedFileUpdate */ false);
227
228
  }
228
- addInterimFile(path) {
229
- this._backgroundAnalysisProgram.addInterimFile(path);
229
+ addInterimFile(uri) {
230
+ this._backgroundAnalysisProgram.addInterimFile(uri);
230
231
  }
231
- getParseResult(path) {
232
- return this._program.getParseResults(path);
232
+ getParseResult(uri) {
233
+ return this._program.getParseResults(uri);
233
234
  }
234
- getSourceFile(path) {
235
- return this._program.getBoundSourceFile(path);
235
+ getSourceFile(uri) {
236
+ return this._program.getBoundSourceFile(uri);
236
237
  }
237
- getTextOnRange(filePath, range, token) {
238
- return this._program.getTextOnRange(filePath, range, token);
238
+ getTextOnRange(fileUri, range, token) {
239
+ return this._program.getTextOnRange(fileUri, range, token);
239
240
  }
240
241
  getEvaluator() {
241
242
  return this._program.evaluator;
@@ -255,13 +256,13 @@ class AnalyzerService {
255
256
  this._program.printDetailedAnalysisTimes();
256
257
  }
257
258
  printDependencies(verbose) {
258
- this._program.printDependencies(this._executionRootPath, verbose);
259
+ this._program.printDependencies(this._executionRootUri, verbose);
259
260
  }
260
- analyzeFile(filePath, token) {
261
- return this._backgroundAnalysisProgram.analyzeFile(filePath, token);
261
+ analyzeFile(fileUri, token) {
262
+ return this._backgroundAnalysisProgram.analyzeFile(fileUri, token);
262
263
  }
263
- getDiagnosticsForRange(filePath, range, token) {
264
- return this._backgroundAnalysisProgram.getDiagnosticsForRange(filePath, range, token);
264
+ getDiagnosticsForRange(fileUri, range, token) {
265
+ return this._backgroundAnalysisProgram.getDiagnosticsForRange(fileUri, range, token);
265
266
  }
266
267
  getConfigOptions() {
267
268
  return this._configOptions;
@@ -283,21 +284,21 @@ class AnalyzerService {
283
284
  test_getFileNamesFromFileSpecs() {
284
285
  return this._getFileNamesFromFileSpecs();
285
286
  }
286
- test_shouldHandleSourceFileWatchChanges(path, isFile) {
287
- return this._shouldHandleSourceFileWatchChanges(path, isFile);
287
+ test_shouldHandleSourceFileWatchChanges(uri, isFile) {
288
+ return this._shouldHandleSourceFileWatchChanges(uri, isFile);
288
289
  }
289
- test_shouldHandleLibraryFileWatchChanges(path, libSearchPaths) {
290
- return this._shouldHandleLibraryFileWatchChanges(path, libSearchPaths);
290
+ test_shouldHandleLibraryFileWatchChanges(uri, libSearchUris) {
291
+ return this._shouldHandleLibraryFileWatchChanges(uri, libSearchUris);
291
292
  }
292
293
  writeTypeStub(token) {
293
294
  var _a;
294
- const typingsSubdirPath = this._getTypeStubFolder();
295
- this._program.writeTypeStub((_a = this._typeStubTargetPath) !== null && _a !== void 0 ? _a : '', this._typeStubTargetIsSingleFile, typingsSubdirPath, token);
295
+ const typingsSubdirUri = this._getTypeStubFolder();
296
+ this._program.writeTypeStub((_a = this._typeStubTargetUri) !== null && _a !== void 0 ? _a : uri_1.Uri.empty(), this._typeStubTargetIsSingleFile, typingsSubdirUri, token);
296
297
  }
297
298
  writeTypeStubInBackground(token) {
298
299
  var _a;
299
- const typingsSubdirPath = this._getTypeStubFolder();
300
- return this._backgroundAnalysisProgram.writeTypeStub((_a = this._typeStubTargetPath) !== null && _a !== void 0 ? _a : '', this._typeStubTargetIsSingleFile, typingsSubdirPath, token);
300
+ const typingsSubdirUri = this._getTypeStubFolder();
301
+ return this._backgroundAnalysisProgram.writeTypeStub((_a = this._typeStubTargetUri) !== null && _a !== void 0 ? _a : uri_1.Uri.empty(), this._typeStubTargetIsSingleFile, typingsSubdirUri, token);
301
302
  }
302
303
  invalidateAndForceReanalysis(reason) {
303
304
  this._backgroundAnalysisProgram.invalidateAndForceReanalysis(reason);
@@ -350,32 +351,35 @@ class AnalyzerService {
350
351
  // an optional config file, and default values.
351
352
  _getConfigOptions(host, commandLineOptions) {
352
353
  var _a, _b, _c;
353
- let projectRoot = (0, pathUtils_1.realCasePath)(commandLineOptions.executionRoot, this.fs);
354
+ let projectRoot = this.fs.realCasePath(uri_1.Uri.file(commandLineOptions.executionRoot, this.fs.isCaseSensitive, /* checkRelative */ true));
355
+ const executionRoot = this.fs.realCasePath(uri_1.Uri.file(commandLineOptions.executionRoot, this.fs.isCaseSensitive, /* checkRelative */ true));
354
356
  let configFilePath;
355
357
  let pyprojectFilePath;
356
358
  if (commandLineOptions.configFilePath) {
357
359
  // If the config file path was specified, determine whether it's
358
360
  // a directory (in which case the default config file name is assumed)
359
361
  // or a file.
360
- configFilePath = (0, pathUtils_1.realCasePath)((0, pathUtils_1.combinePaths)(commandLineOptions.executionRoot, (0, pathUtils_1.normalizePath)(commandLineOptions.configFilePath)), this.fs);
362
+ configFilePath = this.fs.realCasePath((0, pathUtils_1.isRootedDiskPath)(commandLineOptions.configFilePath)
363
+ ? uri_1.Uri.file(commandLineOptions.configFilePath, this.fs.isCaseSensitive, /* checkRelative */ true)
364
+ : projectRoot.combinePaths(commandLineOptions.configFilePath));
361
365
  if (!this.fs.existsSync(configFilePath)) {
362
- this._console.info(`Configuration file not found at ${configFilePath}.`);
363
- configFilePath = (0, pathUtils_1.realCasePath)(commandLineOptions.executionRoot, this.fs);
366
+ this._console.info(`Configuration file not found at ${configFilePath.toUserVisibleString()}.`);
367
+ configFilePath = projectRoot;
364
368
  }
365
369
  else {
366
- if (configFilePath.toLowerCase().endsWith('.json')) {
367
- projectRoot = (0, pathUtils_1.realCasePath)((0, pathUtils_1.getDirectoryPath)(configFilePath), this.fs);
370
+ if (configFilePath.lastExtension.endsWith('.json')) {
371
+ projectRoot = configFilePath.getDirectory();
368
372
  }
369
373
  else {
370
374
  projectRoot = configFilePath;
371
375
  configFilePath = this._findConfigFile(configFilePath);
372
376
  if (!configFilePath) {
373
- this._console.info(`Configuration file not found at ${projectRoot}.`);
377
+ this._console.info(`Configuration file not found at ${projectRoot.toUserVisibleString()}.`);
374
378
  }
375
379
  }
376
380
  }
377
381
  }
378
- else if (projectRoot) {
382
+ else if (commandLineOptions.executionRoot) {
379
383
  // In a project-based IDE like VS Code, we should assume that the
380
384
  // project root directory contains the config file.
381
385
  configFilePath = this._findConfigFile(projectRoot);
@@ -386,7 +390,7 @@ class AnalyzerService {
386
390
  configFilePath = this._findConfigFileHereOrUp(projectRoot);
387
391
  }
388
392
  if (configFilePath) {
389
- projectRoot = (0, pathUtils_1.getDirectoryPath)(configFilePath);
393
+ projectRoot = configFilePath.getDirectory();
390
394
  }
391
395
  else {
392
396
  this._console.log(`No configuration file found.`);
@@ -400,8 +404,8 @@ class AnalyzerService {
400
404
  pyprojectFilePath = this._findPyprojectTomlFileHereOrUp(projectRoot);
401
405
  }
402
406
  if (pyprojectFilePath) {
403
- projectRoot = (0, pathUtils_1.getDirectoryPath)(pyprojectFilePath);
404
- this._console.log(`pyproject.toml file found at ${projectRoot}.`);
407
+ projectRoot = pyprojectFilePath.getDirectory();
408
+ this._console.log(`pyproject.toml file found at ${projectRoot.toUserVisibleString()}.`);
405
409
  }
406
410
  else {
407
411
  this._console.log(`No pyproject.toml file found.`);
@@ -411,7 +415,7 @@ class AnalyzerService {
411
415
  const defaultExcludes = ['**/node_modules', '**/__pycache__', '**/.*'];
412
416
  if (commandLineOptions.pythonPath) {
413
417
  this._console.info(`Setting pythonPath for service "${this._instanceName}": ` + `"${commandLineOptions.pythonPath}"`);
414
- (configOptions.pythonPath = commandLineOptions.pythonPath), this.fs;
418
+ configOptions.pythonPath = this.fs.realCasePath(uri_1.Uri.file(commandLineOptions.pythonPath, this.fs.isCaseSensitive, /* checkRelative */ true));
415
419
  }
416
420
  if (commandLineOptions.pythonEnvironmentName) {
417
421
  this._console.info(`Setting environmentName for service "${this._instanceName}": ` +
@@ -425,17 +429,17 @@ class AnalyzerService {
425
429
  configOptions.ensureDefaultExtraPaths(this.fs, (_a = commandLineOptions.autoSearchPaths) !== null && _a !== void 0 ? _a : false, commandLineOptions.extraPaths);
426
430
  if (commandLineOptions.includeFileSpecs.length > 0) {
427
431
  commandLineOptions.includeFileSpecs.forEach((fileSpec) => {
428
- configOptions.include.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, projectRoot, fileSpec));
432
+ configOptions.include.push((0, uriUtils_1.getFileSpec)(projectRoot, fileSpec));
429
433
  });
430
434
  }
431
435
  if (commandLineOptions.excludeFileSpecs.length > 0) {
432
436
  commandLineOptions.excludeFileSpecs.forEach((fileSpec) => {
433
- configOptions.exclude.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, projectRoot, fileSpec));
437
+ configOptions.exclude.push((0, uriUtils_1.getFileSpec)(projectRoot, fileSpec));
434
438
  });
435
439
  }
436
440
  if (commandLineOptions.ignoreFileSpecs.length > 0) {
437
441
  commandLineOptions.ignoreFileSpecs.forEach((fileSpec) => {
438
- configOptions.ignore.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, projectRoot, fileSpec));
442
+ configOptions.ignore.push((0, uriUtils_1.getFileSpec)(projectRoot, fileSpec));
439
443
  });
440
444
  }
441
445
  if (!configFilePath && commandLineOptions.executionRoot) {
@@ -443,40 +447,40 @@ class AnalyzerService {
443
447
  // If no config file was found and there are no explicit include
444
448
  // paths specified, assume the caller wants to include all source
445
449
  // files under the execution root path.
446
- configOptions.include.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, commandLineOptions.executionRoot, '.'));
450
+ configOptions.include.push((0, uriUtils_1.getFileSpec)(executionRoot, '.'));
447
451
  }
448
452
  if (commandLineOptions.excludeFileSpecs.length === 0) {
449
453
  // Add a few common excludes to avoid long scan times.
450
454
  defaultExcludes.forEach((exclude) => {
451
- configOptions.exclude.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, commandLineOptions.executionRoot, exclude));
455
+ configOptions.exclude.push((0, uriUtils_1.getFileSpec)(executionRoot, exclude));
452
456
  });
453
457
  }
454
458
  }
455
- this._configFilePath = configFilePath || pyprojectFilePath;
459
+ this._configFileUri = configFilePath || pyprojectFilePath;
456
460
  // If we found a config file, parse it to compute the effective options.
457
461
  let configJsonObj;
458
462
  if (configFilePath) {
459
- this._console.info(`Loading configuration file at ${configFilePath}`);
463
+ this._console.info(`Loading configuration file at ${configFilePath.toUserVisibleString()}`);
460
464
  configJsonObj = this._parseJsonConfigFile(configFilePath);
461
465
  }
462
466
  else if (pyprojectFilePath) {
463
- this._console.info(`Loading pyproject.toml file at ${pyprojectFilePath}`);
467
+ this._console.info(`Loading pyproject.toml file at ${pyprojectFilePath.toUserVisibleString()}`);
464
468
  configJsonObj = this._parsePyprojectTomlFile(pyprojectFilePath);
465
469
  }
466
470
  if (configJsonObj) {
467
471
  configOptions.initializeFromJson(configJsonObj, this._typeCheckingMode, this.serviceProvider, host, commandLineOptions.diagnosticSeverityOverrides);
468
- const configFileDir = (0, pathUtils_1.getDirectoryPath)(this._configFilePath);
472
+ const configFileDir = this._configFileUri.getDirectory();
469
473
  // If no include paths were provided, assume that all files within
470
474
  // the project should be included.
471
475
  if (configOptions.include.length === 0) {
472
- this._console.info(`No include entries specified; assuming ${configFileDir}`);
473
- configOptions.include.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, configFileDir, '.'));
476
+ this._console.info(`No include entries specified; assuming ${configFileDir.toUserVisibleString()}`);
477
+ configOptions.include.push((0, uriUtils_1.getFileSpec)(configFileDir, '.'));
474
478
  }
475
479
  // If there was no explicit set of excludes, add a few common ones to avoid long scan times.
476
480
  if (configOptions.exclude.length === 0) {
477
481
  defaultExcludes.forEach((exclude) => {
478
482
  this._console.info(`Auto-excluding ${exclude}`);
479
- configOptions.exclude.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, configFileDir, exclude));
483
+ configOptions.exclude.push((0, uriUtils_1.getFileSpec)(configFileDir, exclude));
480
484
  });
481
485
  if (configOptions.autoExcludeVenv === undefined) {
482
486
  configOptions.autoExcludeVenv = true;
@@ -496,7 +500,7 @@ class AnalyzerService {
496
500
  if (commandLineOptions.includeFileSpecsOverride) {
497
501
  configOptions.include = [];
498
502
  commandLineOptions.includeFileSpecsOverride.forEach((include) => {
499
- configOptions.include.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, include, '.'));
503
+ configOptions.include.push((0, uriUtils_1.getFileSpec)(uri_1.Uri.file(include, this.fs.isCaseSensitive, /* checkRelative */ true), '.'));
500
504
  });
501
505
  }
502
506
  const reportDuplicateSetting = (settingName, configValue) => {
@@ -512,18 +516,18 @@ class AnalyzerService {
512
516
  // duplicates.
513
517
  if (commandLineOptions.venvPath) {
514
518
  if (!configOptions.venvPath) {
515
- configOptions.venvPath = commandLineOptions.venvPath;
519
+ configOptions.venvPath = projectRoot.combinePaths(commandLineOptions.venvPath);
516
520
  }
517
521
  else {
518
- reportDuplicateSetting('venvPath', configOptions.venvPath);
522
+ reportDuplicateSetting('venvPath', configOptions.venvPath.toUserVisibleString());
519
523
  }
520
524
  }
521
525
  if (commandLineOptions.typeshedPath) {
522
526
  if (!configOptions.typeshedPath) {
523
- configOptions.typeshedPath = (0, pathUtils_1.realCasePath)(commandLineOptions.typeshedPath, this.fs);
527
+ configOptions.typeshedPath = projectRoot.combinePaths(commandLineOptions.typeshedPath);
524
528
  }
525
529
  else {
526
- reportDuplicateSetting('typeshedPath', configOptions.typeshedPath);
530
+ reportDuplicateSetting('typeshedPath', configOptions.typeshedPath.toUserVisibleString());
527
531
  }
528
532
  }
529
533
  // If the caller specified that "typeshedPath" is the root of the project,
@@ -536,7 +540,7 @@ class AnalyzerService {
536
540
  this._console.info(`Excluding typeshed stdlib stubs according to VERSIONS file:`);
537
541
  excludeList.forEach((exclude) => {
538
542
  this._console.info(` ${exclude}`);
539
- configOptions.exclude.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, commandLineOptions.executionRoot, exclude));
543
+ configOptions.exclude.push((0, uriUtils_1.getFileSpec)(executionRoot, exclude.getFilePath()));
540
544
  });
541
545
  }
542
546
  configOptions.verboseOutput = (_b = commandLineOptions.verboseOutput) !== null && _b !== void 0 ? _b : configOptions.verboseOutput;
@@ -560,42 +564,42 @@ class AnalyzerService {
560
564
  }
561
565
  if (commandLineOptions.stubPath) {
562
566
  if (!configOptions.stubPath) {
563
- configOptions.stubPath = (0, pathUtils_1.realCasePath)(commandLineOptions.stubPath, this.fs);
567
+ configOptions.stubPath = this.fs.realCasePath(projectRoot.combinePaths(commandLineOptions.stubPath));
564
568
  }
565
569
  else {
566
- reportDuplicateSetting('stubPath', configOptions.stubPath);
570
+ reportDuplicateSetting('stubPath', configOptions.stubPath.toUserVisibleString());
567
571
  }
568
572
  }
569
573
  if (configOptions.stubPath) {
570
574
  // If there was a stub path specified, validate it.
571
- if (!this.fs.existsSync(configOptions.stubPath) || !(0, pathUtils_1.isDirectory)(this.fs, configOptions.stubPath)) {
575
+ if (!this.fs.existsSync(configOptions.stubPath) || !(0, uriUtils_1.isDirectory)(this.fs, configOptions.stubPath)) {
572
576
  this._console.warn(`stubPath ${configOptions.stubPath} is not a valid directory.`);
573
577
  }
574
578
  }
575
579
  else {
576
580
  // If no stub path was specified, use a default path.
577
- configOptions.stubPath = (0, pathUtils_1.normalizePath)((0, pathUtils_1.combinePaths)(configOptions.projectRoot, pathConsts_1.defaultStubsDirectory));
581
+ configOptions.stubPath = configOptions.projectRoot.combinePaths(pathConsts_1.defaultStubsDirectory);
578
582
  }
579
583
  // Do some sanity checks on the specified settings and report missing
580
584
  // or inconsistent information.
581
585
  if (configOptions.venvPath) {
582
- if (!this.fs.existsSync(configOptions.venvPath) || !(0, pathUtils_1.isDirectory)(this.fs, configOptions.venvPath)) {
583
- this._console.error(`venvPath ${configOptions.venvPath} is not a valid directory.`);
586
+ if (!this.fs.existsSync(configOptions.venvPath) || !(0, uriUtils_1.isDirectory)(this.fs, configOptions.venvPath)) {
587
+ this._console.error(`venvPath ${configOptions.venvPath.toUserVisibleString()} is not a valid directory.`);
584
588
  }
585
589
  // venvPath without venv means it won't do anything while resolveImport.
586
590
  // so first, try to set venv from existing configOption if it is null. if both are null,
587
591
  // then, resolveImport won't consider venv
588
592
  configOptions.venv = (_c = configOptions.venv) !== null && _c !== void 0 ? _c : this._configOptions.venv;
589
- if (configOptions.venv) {
590
- const fullVenvPath = (0, pathUtils_1.combinePaths)(configOptions.venvPath, configOptions.venv);
591
- if (!this.fs.existsSync(fullVenvPath) || !(0, pathUtils_1.isDirectory)(this.fs, fullVenvPath)) {
592
- this._console.error(`venv ${configOptions.venv} subdirectory not found in venv path ${configOptions.venvPath}.`);
593
+ if (configOptions.venv && configOptions.venvPath) {
594
+ const fullVenvPath = configOptions.venvPath.combinePaths(configOptions.venv);
595
+ if (!this.fs.existsSync(fullVenvPath) || !(0, uriUtils_1.isDirectory)(this.fs, fullVenvPath)) {
596
+ this._console.error(`venv ${configOptions.venv} subdirectory not found in venv path ${configOptions.venvPath.toUserVisibleString()}.`);
593
597
  }
594
598
  else {
595
599
  const importFailureInfo = [];
596
600
  if ((0, pythonPathUtils_1.findPythonSearchPaths)(this.fs, configOptions, host, importFailureInfo) === undefined) {
597
601
  this._console.error(`site-packages directory cannot be located for venvPath ` +
598
- `${configOptions.venvPath} and venv ${configOptions.venv}.`);
602
+ `${configOptions.venvPath.toUserVisibleString()} and venv ${configOptions.venv}.`);
599
603
  if (configOptions.verboseOutput) {
600
604
  importFailureInfo.forEach((diag) => {
601
605
  this._console.error(` ${diag}`);
@@ -612,16 +616,16 @@ class AnalyzerService {
612
616
  }
613
617
  }
614
618
  if (configOptions.typeshedPath) {
615
- if (!this.fs.existsSync(configOptions.typeshedPath) || !(0, pathUtils_1.isDirectory)(this.fs, configOptions.typeshedPath)) {
616
- this._console.error(`typeshedPath ${configOptions.typeshedPath} is not a valid directory.`);
619
+ if (!this.fs.existsSync(configOptions.typeshedPath) || !(0, uriUtils_1.isDirectory)(this.fs, configOptions.typeshedPath)) {
620
+ this._console.error(`typeshedPath ${configOptions.typeshedPath.toUserVisibleString()} is not a valid directory.`);
617
621
  }
618
622
  }
619
623
  return configOptions;
620
624
  }
621
625
  _getTypeStubFolder() {
622
626
  var _a;
623
- const stubPath = (_a = this._configOptions.stubPath) !== null && _a !== void 0 ? _a : (0, pathUtils_1.realCasePath)((0, pathUtils_1.combinePaths)(this._configOptions.projectRoot, pathConsts_1.defaultStubsDirectory), this.fs);
624
- if (!this._typeStubTargetPath || !this._typeStubTargetImportName) {
627
+ const stubPath = (_a = this._configOptions.stubPath) !== null && _a !== void 0 ? _a : this.fs.realCasePath(this._configOptions.projectRoot.combinePaths(pathConsts_1.defaultStubsDirectory));
628
+ if (!this._typeStubTargetUri || !this._typeStubTargetImportName) {
625
629
  const errMsg = `Import '${this._typeStubTargetImportName}'` + ` could not be resolved`;
626
630
  this._console.error(errMsg);
627
631
  throw new Error(errMsg);
@@ -641,45 +645,45 @@ class AnalyzerService {
641
645
  }
642
646
  }
643
647
  catch (e) {
644
- const errMsg = `Could not create typings directory '${stubPath}'`;
648
+ const errMsg = `Could not create typings directory '${stubPath.toUserVisibleString()}'`;
645
649
  this._console.error(errMsg);
646
650
  throw new Error(errMsg);
647
651
  }
648
652
  // Generate a typings subdirectory hierarchy.
649
- const typingsSubdirPath = (0, pathUtils_1.combinePaths)(stubPath, typeStubInputTargetParts[0]);
650
- const typingsSubdirHierarchy = (0, pathUtils_1.combinePaths)(stubPath, ...typeStubInputTargetParts);
653
+ const typingsSubdirPath = stubPath.combinePaths(typeStubInputTargetParts[0]);
654
+ const typingsSubdirHierarchy = stubPath.combinePaths(...typeStubInputTargetParts);
651
655
  try {
652
656
  // Generate a new typings subdirectory if necessary.
653
657
  if (!this.fs.existsSync(typingsSubdirHierarchy)) {
654
- (0, pathUtils_1.makeDirectories)(this.fs, typingsSubdirHierarchy, stubPath);
658
+ (0, uriUtils_1.makeDirectories)(this.fs, typingsSubdirHierarchy, stubPath);
655
659
  }
656
660
  }
657
661
  catch (e) {
658
- const errMsg = `Could not create typings subdirectory '${typingsSubdirHierarchy}'`;
662
+ const errMsg = `Could not create typings subdirectory '${typingsSubdirHierarchy.toUserVisibleString()}'`;
659
663
  this._console.error(errMsg);
660
664
  throw new Error(errMsg);
661
665
  }
662
666
  return typingsSubdirPath;
663
667
  }
664
668
  _findConfigFileHereOrUp(searchPath) {
665
- return (0, pathUtils_1.forEachAncestorDirectory)(searchPath, (ancestor) => this._findConfigFile(ancestor));
669
+ return (0, uriUtils_1.forEachAncestorDirectory)(searchPath, (ancestor) => this._findConfigFile(ancestor));
666
670
  }
667
671
  _findConfigFile(searchPath) {
668
672
  for (const name of exports.configFileNames) {
669
- const fileName = (0, pathUtils_1.combinePaths)(searchPath, name);
673
+ const fileName = searchPath.combinePaths(name);
670
674
  if (this.fs.existsSync(fileName)) {
671
- return (0, pathUtils_1.realCasePath)(fileName, this.fs);
675
+ return this.fs.realCasePath(fileName);
672
676
  }
673
677
  }
674
678
  return undefined;
675
679
  }
676
680
  _findPyprojectTomlFileHereOrUp(searchPath) {
677
- return (0, pathUtils_1.forEachAncestorDirectory)(searchPath, (ancestor) => this._findPyprojectTomlFile(ancestor));
681
+ return (0, uriUtils_1.forEachAncestorDirectory)(searchPath, (ancestor) => this._findPyprojectTomlFile(ancestor));
678
682
  }
679
683
  _findPyprojectTomlFile(searchPath) {
680
- const fileName = (0, pathUtils_1.combinePaths)(searchPath, exports.pyprojectTomlName);
684
+ const fileName = searchPath.combinePaths(exports.pyprojectTomlName);
681
685
  if (this.fs.existsSync(fileName)) {
682
- return (0, pathUtils_1.realCasePath)(fileName, this.fs);
686
+ return this.fs.realCasePath(fileName);
683
687
  }
684
688
  return undefined;
685
689
  }
@@ -705,20 +709,20 @@ class AnalyzerService {
705
709
  this._console.error(`Pyproject file parse attempt ${attemptCount} error: ${JSON.stringify(e)}`);
706
710
  throw e;
707
711
  }
708
- this._console.info(`Pyproject file "${pyprojectPath}" has no "[tool.pyright]" section.`);
712
+ this._console.info(`Pyproject file "${pyprojectPath.toUserVisibleString()}" has no "[tool.pyright]" section.`);
709
713
  return undefined;
710
714
  });
711
715
  }
712
- _attemptParseFile(filePath, parseCallback) {
716
+ _attemptParseFile(fileUri, parseCallback) {
713
717
  let fileContents = '';
714
718
  let parseAttemptCount = 0;
715
719
  while (true) {
716
720
  // Attempt to read the file contents.
717
721
  try {
718
- fileContents = this.fs.readFileSync(filePath, 'utf8');
722
+ fileContents = this.fs.readFileSync(fileUri, 'utf8');
719
723
  }
720
724
  catch {
721
- this._console.error(`Config file "${filePath}" could not be read.`);
725
+ this._console.error(`Config file "${fileUri.toUserVisibleString()}" could not be read.`);
722
726
  this._reportConfigParseError();
723
727
  return undefined;
724
728
  }
@@ -737,7 +741,7 @@ class AnalyzerService {
737
741
  // may have been partially written when we read it, resulting in parse
738
742
  // errors. We'll give it a little more time and try again.
739
743
  if (parseAttemptCount++ >= 5) {
740
- this._console.error(`Config file "${filePath}" could not be parsed. Verify that format is correct.`);
744
+ this._console.error(`Config file "${fileUri.toUserVisibleString()}" could not be parsed. Verify that format is correct.`);
741
745
  this._reportConfigParseError();
742
746
  return undefined;
743
747
  }
@@ -751,16 +755,16 @@ class AnalyzerService {
751
755
  timing_1.timingStats.findFilesTime.timeOperation(() => {
752
756
  const matchedFiles = this._matchFiles(this._configOptions.include, this._configOptions.exclude);
753
757
  for (const file of matchedFiles) {
754
- fileMap.set(file, file);
758
+ fileMap.set(file.key, file);
755
759
  }
756
760
  });
757
761
  // And scan all matching open files. We need to do this since some of files are not backed by
758
762
  // files in file system but only exist in memory (ex, virtual workspace)
759
763
  this._backgroundAnalysisProgram.program
760
764
  .getOpened()
761
- .map((o) => o.sourceFile.getFilePath())
765
+ .map((o) => o.sourceFile.getUri())
762
766
  .filter((f) => (0, configOptions_1.matchFileSpecs)(this._program.configOptions, f))
763
- .forEach((f) => fileMap.set(f, f));
767
+ .forEach((f) => fileMap.set(f.key, f));
764
768
  return Array.from(fileMap.values());
765
769
  }
766
770
  // If markFilesDirtyUnconditionally is true, we need to reparse
@@ -772,50 +776,50 @@ class AnalyzerService {
772
776
  // Are we in type stub generation mode? If so, we need to search
773
777
  // for a different set of files.
774
778
  if (this._typeStubTargetImportName) {
775
- const execEnv = this._configOptions.findExecEnvironment(this._executionRootPath);
779
+ const execEnv = this._configOptions.findExecEnvironment(this._executionRootUri);
776
780
  const moduleDescriptor = (0, importResolver_1.createImportedModuleDescriptor)(this._typeStubTargetImportName);
777
- const importResult = this._backgroundAnalysisProgram.importResolver.resolveImport('', execEnv, moduleDescriptor);
781
+ const importResult = this._backgroundAnalysisProgram.importResolver.resolveImport(uri_1.Uri.empty(), execEnv, moduleDescriptor);
778
782
  if (importResult.isImportFound) {
779
783
  const filesToImport = [];
780
784
  // Determine the directory that contains the root package.
781
- const finalResolvedPath = importResult.resolvedPaths[importResult.resolvedPaths.length - 1];
782
- const isFinalPathFile = (0, pathUtils_1.isFile)(this.fs, finalResolvedPath);
783
- const isFinalPathInitFile = isFinalPathFile && (0, pathUtils_1.stripFileExtension)((0, pathUtils_1.getFileName)(finalResolvedPath)) === '__init__';
785
+ const finalResolvedPath = importResult.resolvedUris[importResult.resolvedUris.length - 1];
786
+ const isFinalPathFile = (0, uriUtils_1.isFile)(this.fs, finalResolvedPath);
787
+ const isFinalPathInitFile = isFinalPathFile && finalResolvedPath.stripAllExtensions().fileName === '__init__';
784
788
  let rootPackagePath = finalResolvedPath;
785
789
  if (isFinalPathFile) {
786
790
  // If the module is a __init__.pyi? file, use its parent directory instead.
787
- rootPackagePath = (0, pathUtils_1.getDirectoryPath)(rootPackagePath);
791
+ rootPackagePath = rootPackagePath.getDirectory();
788
792
  }
789
- for (let i = importResult.resolvedPaths.length - 2; i >= 0; i--) {
790
- if (importResult.resolvedPaths[i]) {
791
- rootPackagePath = importResult.resolvedPaths[i];
793
+ for (let i = importResult.resolvedUris.length - 2; i >= 0; i--) {
794
+ if (!importResult.resolvedUris[i].isEmpty()) {
795
+ rootPackagePath = importResult.resolvedUris[i];
792
796
  }
793
797
  else {
794
798
  // If there was no file corresponding to this portion
795
799
  // of the name path, assume that it's contained
796
800
  // within its parent directory.
797
- rootPackagePath = (0, pathUtils_1.getDirectoryPath)(rootPackagePath);
801
+ rootPackagePath = rootPackagePath.getDirectory();
798
802
  }
799
803
  }
800
- if ((0, pathUtils_1.isDirectory)(this.fs, rootPackagePath)) {
801
- this._typeStubTargetPath = rootPackagePath;
804
+ if ((0, uriUtils_1.isDirectory)(this.fs, rootPackagePath)) {
805
+ this._typeStubTargetUri = rootPackagePath;
802
806
  }
803
- else if ((0, pathUtils_1.isFile)(this.fs, rootPackagePath)) {
807
+ else if ((0, uriUtils_1.isFile)(this.fs, rootPackagePath)) {
804
808
  // This can occur if there is a "dir/__init__.py" at the same level as a
805
809
  // module "dir/module.py" that is specifically targeted for stub generation.
806
- this._typeStubTargetPath = (0, pathUtils_1.getDirectoryPath)(rootPackagePath);
810
+ this._typeStubTargetUri = rootPackagePath.getDirectory();
807
811
  }
808
812
  if (!finalResolvedPath) {
809
813
  this._typeStubTargetIsSingleFile = false;
810
814
  }
811
815
  else {
812
816
  filesToImport.push(finalResolvedPath);
813
- this._typeStubTargetIsSingleFile = importResult.resolvedPaths.length === 1 && !isFinalPathInitFile;
817
+ this._typeStubTargetIsSingleFile = importResult.resolvedUris.length === 1 && !isFinalPathInitFile;
814
818
  }
815
819
  // Add the implicit import paths.
816
820
  importResult.filteredImplicitImports.forEach((implicitImport) => {
817
- if (importResolver_1.ImportResolver.isSupportedImportSourceFile(implicitImport.path)) {
818
- filesToImport.push(implicitImport.path);
821
+ if (importResolver_1.ImportResolver.isSupportedImportSourceFile(implicitImport.uri)) {
822
+ filesToImport.push(implicitImport.uri);
819
823
  }
820
824
  });
821
825
  this._backgroundAnalysisProgram.setAllowedThirdPartyImports([this._typeStubTargetImportName]);
@@ -868,26 +872,24 @@ class AnalyzerService {
868
872
  }
869
873
  }
870
874
  if (this._configOptions.autoExcludeVenv) {
871
- if (envMarkers.some((f) => this.fs.existsSync((0, pathUtils_1.combinePaths)(absolutePath, ...f)))) {
875
+ if (envMarkers.some((f) => this.fs.existsSync(absolutePath.combinePaths(...f)))) {
872
876
  // Save auto exclude paths in the configOptions once we found them.
873
- if (!pathUtils_1.FileSpec.isInPath(absolutePath, exclude)) {
874
- exclude.push((0, pathUtils_1.getFileSpec)(this.serviceProvider, this._configOptions.projectRoot, `${absolutePath}/**`));
877
+ if (!uriUtils_1.FileSpec.isInPath(absolutePath, exclude)) {
878
+ exclude.push((0, uriUtils_1.getFileSpec)(this._configOptions.projectRoot, `${absolutePath}/**`));
875
879
  }
876
- this._console.info(`Auto-excluding ${absolutePath}`);
880
+ this._console.info(`Auto-excluding ${absolutePath.toUserVisibleString()}`);
877
881
  return;
878
882
  }
879
883
  }
880
- const { files, directories } = (0, pathUtils_1.getFileSystemEntries)(this.fs, absolutePath);
881
- for (const file of files) {
882
- const filePath = (0, pathUtils_1.combinePaths)(absolutePath, file);
883
- if (pathUtils_1.FileSpec.matchIncludeFileSpec(includeRegExp, exclude, filePath)) {
884
+ const { files, directories } = (0, uriUtils_1.getFileSystemEntries)(this.fs, absolutePath);
885
+ for (const filePath of files) {
886
+ if (uriUtils_1.FileSpec.matchIncludeFileSpec(includeRegExp, exclude, filePath)) {
884
887
  results.push(filePath);
885
888
  }
886
889
  }
887
- for (const directory of directories) {
888
- const dirPath = (0, pathUtils_1.combinePaths)(absolutePath, directory);
889
- if (includeRegExp.test(dirPath) || hasDirectoryWildcard) {
890
- if (!pathUtils_1.FileSpec.isInPath(dirPath, exclude)) {
890
+ for (const dirPath of directories) {
891
+ if (dirPath.matchesRegex(includeRegExp) || hasDirectoryWildcard) {
892
+ if (!uriUtils_1.FileSpec.isInPath(dirPath, exclude)) {
891
893
  visitDirectory(dirPath, includeRegExp, hasDirectoryWildcard);
892
894
  }
893
895
  }
@@ -895,27 +897,27 @@ class AnalyzerService {
895
897
  };
896
898
  const seenDirs = new Set();
897
899
  const visitDirectory = (absolutePath, includeRegExp, hasDirectoryWildcard) => {
898
- const realDirPath = (0, pathUtils_1.tryRealpath)(this.fs, absolutePath);
900
+ const realDirPath = (0, uriUtils_1.tryRealpath)(this.fs, absolutePath);
899
901
  if (!realDirPath) {
900
902
  this._console.warn(`Skipping broken link "${absolutePath}"`);
901
903
  return;
902
904
  }
903
- if (seenDirs.has(realDirPath)) {
905
+ if (seenDirs.has(realDirPath.key)) {
904
906
  this._console.warn(`Skipping recursive symlink "${absolutePath}" -> "${realDirPath}"`);
905
907
  return;
906
908
  }
907
- seenDirs.add(realDirPath);
909
+ seenDirs.add(realDirPath.key);
908
910
  try {
909
911
  visitDirectoryUnchecked(absolutePath, includeRegExp, hasDirectoryWildcard);
910
912
  }
911
913
  finally {
912
- seenDirs.delete(realDirPath);
914
+ seenDirs.delete(realDirPath.key);
913
915
  }
914
916
  };
915
917
  include.forEach((includeSpec) => {
916
- if (!pathUtils_1.FileSpec.isInPath(includeSpec.wildcardRoot, exclude)) {
918
+ if (!uriUtils_1.FileSpec.isInPath(includeSpec.wildcardRoot, exclude)) {
917
919
  let foundFileSpec = false;
918
- const stat = (0, pathUtils_1.tryStat)(this.fs, includeSpec.wildcardRoot);
920
+ const stat = (0, uriUtils_1.tryStat)(this.fs, includeSpec.wildcardRoot);
919
921
  if (stat === null || stat === void 0 ? void 0 : stat.isFile()) {
920
922
  results.push(includeSpec.wildcardRoot);
921
923
  foundFileSpec = true;
@@ -925,7 +927,7 @@ class AnalyzerService {
925
927
  foundFileSpec = true;
926
928
  }
927
929
  if (!foundFileSpec) {
928
- this._console.error(`File or directory "${includeSpec.wildcardRoot}" does not exist.`);
930
+ this._console.error(`File or directory "${includeSpec.wildcardRoot.toUserVisibleString()}" does not exist.`);
929
931
  }
930
932
  }
931
933
  });
@@ -944,13 +946,13 @@ class AnalyzerService {
944
946
  }
945
947
  if (this._configOptions.include.length > 0) {
946
948
  const fileList = this._configOptions.include.map((spec) => {
947
- return (0, pathUtils_1.combinePaths)(this._executionRootPath, spec.wildcardRoot);
949
+ return spec.wildcardRoot;
948
950
  });
949
951
  try {
950
952
  if (this._verboseOutput) {
951
953
  this._console.info(`Adding fs watcher for directories:\n ${fileList.join('\n')}`);
952
954
  }
953
- const isIgnored = (0, fileWatcher_1.ignoredWatchEventFunction)(fileList);
955
+ const isIgnored = (0, fileWatcher_1.ignoredWatchEventFunction)(fileList.map((f) => f.getFilePath()));
954
956
  this._sourceFileWatcher = this.fs.createFileSystemWatcher(fileList, (event, path) => {
955
957
  if (!path) {
956
958
  return;
@@ -958,15 +960,15 @@ class AnalyzerService {
958
960
  if (this._verboseOutput) {
959
961
  this._console.info(`SourceFile: Received fs event '${event}' for path '${path}'`);
960
962
  }
961
- if (isIgnored(path)) {
963
+ if (isIgnored(path.getFilePath())) {
962
964
  return;
963
965
  }
964
966
  // Wholesale ignore events that appear to be from tmp file / .git modification.
965
- if (path.endsWith('.tmp') || path.endsWith('.git') || path.includes(_gitDirectory)) {
967
+ if (path.pathEndsWith('.tmp') || path.pathEndsWith('.git') || path.pathIncludes(_gitDirectory)) {
966
968
  return;
967
969
  }
968
970
  // Make sure path is the true case.
969
- path = (0, pathUtils_1.realCasePath)(path, this.fs);
971
+ path = this.fs.realCasePath(path);
970
972
  const eventInfo = getEventInfo(this.fs, this._console, this._program, event, path);
971
973
  if (!eventInfo) {
972
974
  // no-op event, return.
@@ -995,13 +997,15 @@ class AnalyzerService {
995
997
  });
996
998
  }
997
999
  catch {
998
- this._console.error(`Exception caught when installing fs watcher for:\n ${fileList.join('\n')}`);
1000
+ this._console.error(`Exception caught when installing fs watcher for:\n ${fileList
1001
+ .map((f) => f.toUserVisibleString())
1002
+ .join('\n')}`);
999
1003
  }
1000
1004
  }
1001
1005
  function getEventInfo(fs, console, program, event, path) {
1002
1006
  // Due to the way we implemented file watcher, we will only get 2 events; 'add' and 'change'.
1003
1007
  // Here, we will convert those 2 to 3 events. 'add', 'change' and 'unlink';
1004
- const stats = (0, pathUtils_1.tryStat)(fs, path);
1008
+ const stats = (0, uriUtils_1.tryStat)(fs, path);
1005
1009
  if (event === 'add') {
1006
1010
  if (!stats) {
1007
1011
  // If we are told that the path is added, but if we can't access it, then consider it as already deleted.
@@ -1031,7 +1035,7 @@ class AnalyzerService {
1031
1035
  }
1032
1036
  _shouldHandleSourceFileWatchChanges(path, isFile) {
1033
1037
  if (isFile) {
1034
- if (!(0, pathUtils_1.hasPythonExtension)(path) || isTemporaryFile(path)) {
1038
+ if (!(0, uriUtils_1.hasPythonExtension)(path) || isTemporaryFile(path)) {
1035
1039
  return false;
1036
1040
  }
1037
1041
  // Check whether the file change can affect semantics. If the file changed is not a user file or already a part of
@@ -1047,10 +1051,10 @@ class AnalyzerService {
1047
1051
  // First, make sure the folder is included. By default, we exclude any folder whose name starts with '.'
1048
1052
  return false;
1049
1053
  }
1050
- const parentPath = (0, pathUtils_1.getDirectoryPath)(path);
1054
+ const parentPath = path.getDirectory();
1051
1055
  const hasInit = parentPath.startsWith(this._configOptions.projectRoot) &&
1052
- (this.fs.existsSync((0, pathUtils_1.combinePaths)(parentPath, '__init__.py')) ||
1053
- this.fs.existsSync((0, pathUtils_1.combinePaths)(parentPath, '__init__.pyi')));
1056
+ (this.fs.existsSync(parentPath.combinePaths('__init__.py')) ||
1057
+ this.fs.existsSync(parentPath.combinePaths('__init__.pyi')));
1054
1058
  // We don't have any file under the given path and its parent folder doesn't have __init__ then this folder change
1055
1059
  // doesn't have any meaning to us.
1056
1060
  if (!hasInit && !this._program.containsSourceFileIn(path)) {
@@ -1063,7 +1067,7 @@ class AnalyzerService {
1063
1067
  // alongside the original file and name them "x.py.<temp-id>.py" where
1064
1068
  // <temp-id> is a 32-character random string of hex digits. We don't
1065
1069
  // want these events to trigger a full reanalysis.
1066
- const fileName = (0, pathUtils_1.getFileName)(path);
1070
+ const fileName = path.fileName;
1067
1071
  const fileNameSplit = fileName.split('.');
1068
1072
  if (fileNameSplit.length === 4) {
1069
1073
  if (fileNameSplit[3] === fileNameSplit[1] && fileNameSplit[2].length === 32) {
@@ -1082,20 +1086,20 @@ class AnalyzerService {
1082
1086
  _updateLibraryFileWatcher() {
1083
1087
  this._removeLibraryFileWatcher();
1084
1088
  if (!this._watchForLibraryChanges) {
1085
- this._librarySearchPathsToWatch = undefined;
1089
+ this._librarySearchUrisToWatch = undefined;
1086
1090
  return;
1087
1091
  }
1088
1092
  // Watch the library paths for package install/uninstall.
1089
1093
  const importFailureInfo = [];
1090
- this._librarySearchPathsToWatch = (0, pythonPathUtils_1.findPythonSearchPaths)(this.fs, this._backgroundAnalysisProgram.configOptions, this._backgroundAnalysisProgram.host, importFailureInfo,
1091
- /* includeWatchPathsOnly */ true, this._executionRootPath);
1092
- const watchList = this._librarySearchPathsToWatch;
1094
+ this._librarySearchUrisToWatch = (0, pythonPathUtils_1.findPythonSearchPaths)(this.fs, this._backgroundAnalysisProgram.configOptions, this._backgroundAnalysisProgram.host, importFailureInfo,
1095
+ /* includeWatchPathsOnly */ true, this._executionRootUri);
1096
+ const watchList = this._librarySearchUrisToWatch;
1093
1097
  if (watchList && watchList.length > 0) {
1094
1098
  try {
1095
1099
  if (this._verboseOutput) {
1096
1100
  this._console.info(`Adding fs watcher for library directories:\n ${watchList.join('\n')}`);
1097
1101
  }
1098
- const isIgnored = (0, fileWatcher_1.ignoredWatchEventFunction)(watchList);
1102
+ const isIgnored = (0, fileWatcher_1.ignoredWatchEventFunction)(watchList.map((f) => f.getFilePath()));
1099
1103
  this._libraryFileWatcher = this.fs.createFileSystemWatcher(watchList, (event, path) => {
1100
1104
  if (!path) {
1101
1105
  return;
@@ -1103,7 +1107,7 @@ class AnalyzerService {
1103
1107
  if (this._verboseOutput) {
1104
1108
  this._console.info(`LibraryFile: Received fs event '${event}' for path '${path}'`);
1105
1109
  }
1106
- if (isIgnored(path)) {
1110
+ if (isIgnored(path.getFilePath())) {
1107
1111
  return;
1108
1112
  }
1109
1113
  if (!this._shouldHandleLibraryFileWatchChanges(path, watchList)) {
@@ -1115,7 +1119,9 @@ class AnalyzerService {
1115
1119
  });
1116
1120
  }
1117
1121
  catch {
1118
- this._console.error(`Exception caught when installing fs watcher for:\n ${watchList.join('\n')}`);
1122
+ this._console.error(`Exception caught when installing fs watcher for:\n ${watchList
1123
+ .map((w) => w.toUserVisibleString())
1124
+ .join('\n')}`);
1119
1125
  }
1120
1126
  }
1121
1127
  }
@@ -1125,19 +1131,17 @@ class AnalyzerService {
1125
1131
  }
1126
1132
  // find the innermost matching search path
1127
1133
  let matchingSearchPath;
1128
- const tempFile = this.serviceProvider.tryGet(serviceProviderExtensions_1.ServiceKeys.tempFile);
1129
- const ignoreCase = !(0, pathUtils_1.isFileSystemCaseSensitive)(this.fs, tempFile);
1130
1134
  for (const libSearchPath of libSearchPaths) {
1131
- if ((0, pathUtils_1.containsPath)(libSearchPath, path, ignoreCase) &&
1132
- (!matchingSearchPath || matchingSearchPath.length < libSearchPath.length)) {
1135
+ if (path.isChild(libSearchPath) &&
1136
+ (!matchingSearchPath || matchingSearchPath.getPathLength() < libSearchPath.getPathLength())) {
1133
1137
  matchingSearchPath = libSearchPath;
1134
1138
  }
1135
1139
  }
1136
1140
  if (!matchingSearchPath) {
1137
1141
  return true;
1138
1142
  }
1139
- const parentComponents = (0, pathUtils_1.getPathComponents)(matchingSearchPath);
1140
- const childComponents = (0, pathUtils_1.getPathComponents)(path);
1143
+ const parentComponents = matchingSearchPath.getPathComponents();
1144
+ const childComponents = path.getPathComponents();
1141
1145
  for (let i = parentComponents.length; i < childComponents.length; i++) {
1142
1146
  if (childComponents[i].startsWith('.')) {
1143
1147
  return false;
@@ -1193,21 +1197,21 @@ class AnalyzerService {
1193
1197
  if (!this._watchForConfigChanges) {
1194
1198
  return;
1195
1199
  }
1196
- if (this._configFilePath) {
1197
- this._configFileWatcher = this.fs.createFileSystemWatcher([this._configFilePath], (event) => {
1200
+ if (this._configFileUri) {
1201
+ this._configFileWatcher = this.fs.createFileSystemWatcher([this._configFileUri], (event) => {
1198
1202
  if (this._verboseOutput) {
1199
1203
  this._console.info(`Received fs event '${event}' for config file`);
1200
1204
  }
1201
1205
  this._scheduleReloadConfigFile();
1202
1206
  });
1203
1207
  }
1204
- else if (this._executionRootPath) {
1205
- this._configFileWatcher = this.fs.createFileSystemWatcher([this._executionRootPath], (event, path) => {
1208
+ else if (this._executionRootUri) {
1209
+ this._configFileWatcher = this.fs.createFileSystemWatcher([this._executionRootUri], (event, path) => {
1206
1210
  if (!path) {
1207
1211
  return;
1208
1212
  }
1209
1213
  if (event === 'add' || event === 'change') {
1210
- const fileName = (0, pathUtils_1.getFileName)(path);
1214
+ const fileName = path.fileName;
1211
1215
  if (fileName && exports.configFileNames.some((name) => name === fileName)) {
1212
1216
  if (this._verboseOutput) {
1213
1217
  this._console.info(`Received fs event '${event}' for config file`);
@@ -1239,8 +1243,8 @@ class AnalyzerService {
1239
1243
  }
1240
1244
  _reloadConfigFile() {
1241
1245
  this._updateConfigFileWatcher();
1242
- if (this._configFilePath) {
1243
- this._console.info(`Reloading configuration file at ${this._configFilePath}`);
1246
+ if (this._configFileUri) {
1247
+ this._console.info(`Reloading configuration file at ${this._configFileUri.toUserVisibleString()}`);
1244
1248
  const host = this._backgroundAnalysisProgram.host;
1245
1249
  // We can't just reload config file when it is changed; we need to consider
1246
1250
  // command line options as well to construct new config Options.
@@ -1261,7 +1265,7 @@ class AnalyzerService {
1261
1265
  (0, console_1.log)(this._console, logLevel, `Search paths for ${execEnv.root || '<default>'}`);
1262
1266
  const roots = importResolver.getImportRoots(execEnv, /* forLogging */ true);
1263
1267
  roots.forEach((path) => {
1264
- (0, console_1.log)(this._console, logLevel, ` ${path}`);
1268
+ (0, console_1.log)(this._console, logLevel, ` ${path.toUserVisibleString()}`);
1265
1269
  });
1266
1270
  }
1267
1271
  }