@zzzen/pyright-internal 1.2.0-dev.20231126 → 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.
- package/dist/analyzer/analyzerFileInfo.d.ts +4 -3
- package/dist/analyzer/analyzerFileInfo.js.map +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +15 -14
- package/dist/analyzer/backgroundAnalysisProgram.js +38 -38
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.js +59 -52
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.d.ts +4 -1
- package/dist/analyzer/checker.js +189 -42
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/circularDependency.d.ts +3 -2
- package/dist/analyzer/circularDependency.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.js +36 -36
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/commentUtils.js +7 -0
- package/dist/analyzer/commentUtils.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +14 -5
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructors.js +2 -1
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +58 -47
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +5 -3
- package/dist/analyzer/declaration.js +3 -2
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.d.ts +3 -2
- package/dist/analyzer/declarationUtils.js +14 -12
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/enums.js +1 -1
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +29 -25
- package/dist/analyzer/importResolver.js +300 -301
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importResult.d.ts +5 -4
- package/dist/analyzer/importResult.js.map +1 -1
- package/dist/analyzer/importStatementUtils.d.ts +5 -4
- package/dist/analyzer/importStatementUtils.js +23 -22
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/namedTuples.js +3 -3
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.js +16 -14
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeReport.d.ts +7 -6
- package/dist/analyzer/packageTypeReport.js +4 -4
- package/dist/analyzer/packageTypeReport.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +68 -64
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parentDirectoryCache.d.ts +7 -6
- package/dist/analyzer/parentDirectoryCache.js +9 -10
- package/dist/analyzer/parentDirectoryCache.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +1 -1
- package/dist/analyzer/parseTreeUtils.js +6 -3
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/patternMatching.js +79 -14
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +27 -26
- package/dist/analyzer/program.js +162 -156
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js +3 -3
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +27 -13
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/pyTypedUtils.d.ts +3 -2
- package/dist/analyzer/pyTypedUtils.js +4 -5
- package/dist/analyzer/pyTypedUtils.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.d.ts +7 -6
- package/dist/analyzer/pythonPathUtils.js +21 -23
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/service.d.ts +24 -23
- package/dist/analyzer/service.js +187 -183
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +4 -5
- package/dist/analyzer/sourceFile.js +68 -56
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceFileInfoUtils.js +3 -3
- package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
- package/dist/analyzer/sourceMapper.d.ts +11 -10
- package/dist/analyzer/sourceMapper.js +59 -62
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/sourceMapperUtils.d.ts +2 -1
- package/dist/analyzer/sourceMapperUtils.js +2 -2
- package/dist/analyzer/sourceMapperUtils.js.map +1 -1
- package/dist/analyzer/tracePrinter.d.ts +3 -2
- package/dist/analyzer/tracePrinter.js +21 -23
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.d.ts +2 -1
- package/dist/analyzer/typeDocStringUtils.js +14 -17
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +298 -231
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +1 -1
- package/dist/analyzer/typeEvaluatorTypes.js +1 -1
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.js +3 -3
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.d.ts +2 -0
- package/dist/analyzer/typePrinter.js +48 -8
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.d.ts +2 -1
- package/dist/analyzer/typeStubWriter.js +2 -2
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +5 -3
- package/dist/analyzer/typeUtils.js +32 -17
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.d.ts +2 -0
- package/dist/analyzer/typeVarContext.js +27 -0
- package/dist/analyzer/typeVarContext.js.map +1 -1
- package/dist/analyzer/typedDicts.js +6 -36
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +8 -12
- package/dist/analyzer/types.js +13 -20
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysis.d.ts +1 -2
- package/dist/backgroundAnalysis.js +6 -4
- package/dist/backgroundAnalysis.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +22 -20
- package/dist/backgroundAnalysisBase.js +76 -55
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/backgroundThreadBase.d.ts +1 -1
- package/dist/backgroundThreadBase.js +20 -11
- package/dist/backgroundThreadBase.js.map +1 -1
- package/dist/commands/commandController.js +1 -2
- package/dist/commands/commandController.js.map +1 -1
- package/dist/commands/commands.d.ts +0 -1
- package/dist/commands/commands.js +0 -1
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/createTypeStub.js +3 -2
- package/dist/commands/createTypeStub.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +21 -20
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/commands/quickActionCommand.js +5 -5
- package/dist/commands/quickActionCommand.js.map +1 -1
- package/dist/common/configOptions.d.ts +15 -13
- package/dist/common/configOptions.js +120 -30
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/diagnostic.d.ts +6 -9
- package/dist/common/diagnostic.js +2 -2
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/common/diagnosticSink.d.ts +2 -1
- package/dist/common/diagnosticSink.js.map +1 -1
- package/dist/common/editAction.d.ts +6 -5
- package/dist/common/editAction.js +2 -2
- package/dist/common/editAction.js.map +1 -1
- package/dist/common/envVarUtils.d.ts +2 -1
- package/dist/common/envVarUtils.js +20 -28
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.d.ts +19 -19
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/fileSystem.d.ts +29 -28
- package/dist/common/fileWatcher.d.ts +3 -2
- package/dist/common/fileWatcher.js.map +1 -1
- package/dist/common/fullAccessHost.d.ts +8 -7
- package/dist/common/fullAccessHost.js +21 -16
- package/dist/common/fullAccessHost.js.map +1 -1
- package/dist/common/host.d.ts +7 -6
- package/dist/common/host.js +1 -1
- package/dist/common/host.js.map +1 -1
- package/dist/common/logTracker.d.ts +2 -1
- package/dist/common/logTracker.js +4 -4
- package/dist/common/logTracker.js.map +1 -1
- package/dist/common/pathUtils.d.ts +1 -28
- package/dist/common/pathUtils.js +17 -366
- package/dist/common/pathUtils.js.map +1 -1
- package/dist/common/realFileSystem.d.ts +7 -3
- package/dist/common/realFileSystem.js +78 -60
- package/dist/common/realFileSystem.js.map +1 -1
- package/dist/common/serviceProviderExtensions.d.ts +2 -1
- package/dist/common/serviceProviderExtensions.js +5 -2
- package/dist/common/serviceProviderExtensions.js.map +1 -1
- package/dist/common/textEditTracker.d.ts +2 -1
- package/dist/common/textEditTracker.js +28 -28
- package/dist/common/textEditTracker.js.map +1 -1
- package/dist/common/textRange.d.ts +2 -1
- package/dist/common/textRange.js.map +1 -1
- package/dist/common/uri/baseUri.d.ts +51 -0
- package/dist/common/uri/baseUri.js +194 -0
- package/dist/common/uri/baseUri.js.map +1 -0
- package/dist/common/uri/emptyUri.d.ts +32 -0
- package/dist/common/uri/emptyUri.js +122 -0
- package/dist/common/uri/emptyUri.js.map +1 -0
- package/dist/common/uri/fileUri.d.ts +36 -0
- package/dist/common/uri/fileUri.js +180 -0
- package/dist/common/uri/fileUri.js.map +1 -0
- package/dist/common/uri/memoization.d.ts +3 -0
- package/dist/common/uri/memoization.js +72 -0
- package/dist/common/uri/memoization.js.map +1 -0
- package/dist/common/uri/uri.d.ts +50 -0
- package/dist/common/uri/uri.js +104 -0
- package/dist/common/uri/uri.js.map +1 -0
- package/dist/common/uri/uriUtils.d.ts +39 -0
- package/dist/common/uri/uriUtils.js +362 -0
- package/dist/common/uri/uriUtils.js.map +1 -0
- package/dist/common/uri/webUri.d.ts +36 -0
- package/dist/common/uri/webUri.js +207 -0
- package/dist/common/uri/webUri.js.map +1 -0
- package/dist/common/workspaceEditUtils.d.ts +8 -8
- package/dist/common/workspaceEditUtils.js +34 -37
- package/dist/common/workspaceEditUtils.js.map +1 -1
- package/dist/languageServerBase.d.ts +19 -22
- package/dist/languageServerBase.js +91 -95
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/analyzerServiceExecutor.d.ts +2 -1
- package/dist/languageService/analyzerServiceExecutor.js +14 -16
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
- package/dist/languageService/autoImporter.d.ts +11 -9
- package/dist/languageService/autoImporter.js +45 -44
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.d.ts +3 -2
- package/dist/languageService/callHierarchyProvider.js +23 -35
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/codeActionProvider.d.ts +2 -1
- package/dist/languageService/codeActionProvider.js +8 -24
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +7 -6
- package/dist/languageService/completionProvider.js +32 -30
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.d.ts +2 -1
- package/dist/languageService/completionProviderUtils.js +1 -1
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.d.ts +4 -3
- package/dist/languageService/definitionProvider.js +26 -24
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentHighlightProvider.d.ts +3 -2
- package/dist/languageService/documentHighlightProvider.js +3 -3
- package/dist/languageService/documentHighlightProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.js +8 -7
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.d.ts +5 -4
- package/dist/languageService/documentSymbolProvider.js +9 -11
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.d.ts +4 -3
- package/dist/languageService/hoverProvider.js +6 -5
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/navigationUtils.d.ts +2 -1
- package/dist/languageService/navigationUtils.js +2 -3
- package/dist/languageService/navigationUtils.js.map +1 -1
- package/dist/languageService/quickActions.d.ts +2 -2
- package/dist/languageService/quickActions.js +3 -83
- package/dist/languageService/quickActions.js.map +1 -1
- package/dist/languageService/referencesProvider.d.ts +10 -9
- package/dist/languageService/referencesProvider.js +28 -28
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/renameProvider.d.ts +4 -3
- package/dist/languageService/renameProvider.js +17 -18
- package/dist/languageService/renameProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.d.ts +3 -2
- package/dist/languageService/signatureHelpProvider.js +4 -4
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.d.ts +2 -1
- package/dist/languageService/symbolIndexer.js +1 -1
- package/dist/languageService/symbolIndexer.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +10 -4
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/languageService/workspaceSymbolProvider.d.ts +4 -3
- package/dist/languageService/workspaceSymbolProvider.js +10 -11
- package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +13 -9
- package/dist/localization/localize.js +7 -4
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +0 -4
- package/dist/localization/package.nls.de.json +0 -4
- package/dist/localization/package.nls.en-us.json +9 -6
- package/dist/localization/package.nls.es.json +2 -6
- package/dist/localization/package.nls.fr.json +0 -4
- package/dist/localization/package.nls.it.json +0 -4
- package/dist/localization/package.nls.ja.json +0 -4
- package/dist/localization/package.nls.ko.json +0 -4
- package/dist/localization/package.nls.pl.json +0 -4
- package/dist/localization/package.nls.pt-br.json +0 -4
- package/dist/localization/package.nls.qps-ploc.json +0 -4
- package/dist/localization/package.nls.ru.json +0 -4
- package/dist/localization/package.nls.tr.json +0 -4
- package/dist/localization/package.nls.zh-cn.json +0 -4
- package/dist/localization/package.nls.zh-tw.json +0 -4
- package/dist/pyright.js +18 -17
- package/dist/pyright.js.map +1 -1
- package/dist/pyrightFileSystem.d.ts +13 -13
- package/dist/pyrightFileSystem.js +39 -44
- package/dist/pyrightFileSystem.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.d.ts +29 -28
- package/dist/readonlyAugmentedFileSystem.js +68 -61
- package/dist/readonlyAugmentedFileSystem.js.map +1 -1
- package/dist/server.js +22 -21
- package/dist/server.js.map +1 -1
- package/dist/tests/chainedSourceFiles.test.js +39 -30
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +38 -29
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/completions.test.js +7 -3
- package/dist/tests/completions.test.js.map +1 -1
- package/dist/tests/config.test.js +24 -22
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/documentSymbolCollector.test.js +3 -2
- package/dist/tests/documentSymbolCollector.test.js.map +1 -1
- package/dist/tests/filesystem.test.js +37 -35
- package/dist/tests/filesystem.test.js.map +1 -1
- package/dist/tests/fourSlashParser.test.js +4 -4
- package/dist/tests/fourSlashParser.test.js.map +1 -1
- package/dist/tests/fourslash/fourslash.d.ts +1 -2
- package/dist/tests/fourslash/hover.docstring.alias.fourslash.js +27 -11
- package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/fourSlashParser.js +2 -2
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.d.ts +4 -5
- package/dist/tests/harness/fourslash/testLanguageService.js +9 -15
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.Consts.d.ts +1 -2
- package/dist/tests/harness/fourslash/testState.Consts.js +0 -1
- package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.d.ts +4 -4
- package/dist/tests/harness/fourslash/testState.js +92 -52
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/harness/testAccessHost.d.ts +3 -2
- package/dist/tests/harness/testAccessHost.js +2 -1
- package/dist/tests/harness/testAccessHost.js.map +1 -1
- package/dist/tests/harness/testHost.js +13 -11
- package/dist/tests/harness/testHost.js.map +1 -1
- package/dist/tests/harness/vfs/factory.d.ts +3 -2
- package/dist/tests/harness/vfs/factory.js +5 -4
- package/dist/tests/harness/vfs/factory.js.map +1 -1
- package/dist/tests/harness/vfs/filesystem.d.ts +32 -31
- package/dist/tests/harness/vfs/filesystem.js +47 -49
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/harness/vfs/pathValidation.js +1 -10
- package/dist/tests/harness/vfs/pathValidation.js.map +1 -1
- package/dist/tests/importResolver.test.js +81 -58
- package/dist/tests/importResolver.test.js.map +1 -1
- package/dist/tests/importStatementUtils.test.js +10 -9
- package/dist/tests/importStatementUtils.test.js.map +1 -1
- package/dist/tests/ipythonMode.test.js +12 -11
- package/dist/tests/ipythonMode.test.js.map +1 -1
- package/dist/tests/logger.test.js +2 -1
- package/dist/tests/logger.test.js.map +1 -1
- package/dist/tests/parseTreeUtils.test.js +2 -1
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/pathUtils.test.js +3 -138
- package/dist/tests/pathUtils.test.js.map +1 -1
- package/dist/tests/pyrightFileSystem.test.js +76 -25
- package/dist/tests/pyrightFileSystem.test.js.map +1 -1
- package/dist/tests/service.test.js +37 -42
- package/dist/tests/service.test.js.map +1 -1
- package/dist/tests/signatureHelp.test.js +3 -2
- package/dist/tests/signatureHelp.test.js.map +1 -1
- package/dist/tests/sourceFile.test.js +8 -7
- package/dist/tests/sourceFile.test.js.map +1 -1
- package/dist/tests/sourceMapperUtils.test.js +13 -6
- package/dist/tests/sourceMapperUtils.test.js.map +1 -1
- package/dist/tests/testState.test.js +13 -9
- package/dist/tests/testState.test.js.map +1 -1
- package/dist/tests/testStateUtils.d.ts +2 -5
- package/dist/tests/testStateUtils.js +27 -64
- package/dist/tests/testStateUtils.js.map +1 -1
- package/dist/tests/testUtils.d.ts +3 -5
- package/dist/tests/testUtils.js +15 -64
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/textEditUtil.test.js +4 -3
- package/dist/tests/textEditUtil.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +23 -19
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +21 -12
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +84 -70
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +26 -21
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +36 -31
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typePrinter.test.js +4 -3
- package/dist/tests/typePrinter.test.js.map +1 -1
- package/dist/tests/uri.test.d.ts +1 -0
- package/dist/tests/uri.test.js +695 -0
- package/dist/tests/uri.test.js.map +1 -0
- package/dist/tests/workspaceEditUtils.test.js +28 -28
- package/dist/tests/workspaceEditUtils.test.js.map +1 -1
- package/dist/tests/zipfs.test.js +11 -11
- package/dist/tests/zipfs.test.js.map +1 -1
- package/dist/workspaceFactory.d.ts +13 -14
- package/dist/workspaceFactory.js +54 -55
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +2 -2
- package/dist/common/uriParser.d.ts +0 -24
- package/dist/common/uriParser.js +0 -45
- package/dist/common/uriParser.js.map +0 -1
@@ -51,6 +51,8 @@ const positionUtils_1 = require("../../../common/positionUtils");
|
|
51
51
|
const serviceProviderExtensions_1 = require("../../../common/serviceProviderExtensions");
|
52
52
|
const stringUtils_1 = require("../../../common/stringUtils");
|
53
53
|
const textRange_1 = require("../../../common/textRange");
|
54
|
+
const uri_1 = require("../../../common/uri/uri");
|
55
|
+
const uriUtils_1 = require("../../../common/uri/uriUtils");
|
54
56
|
const workspaceEditUtils_1 = require("../../../common/workspaceEditUtils");
|
55
57
|
const callHierarchyProvider_1 = require("../../../languageService/callHierarchyProvider");
|
56
58
|
const completionProvider_1 = require("../../../languageService/completionProvider");
|
@@ -74,7 +76,7 @@ const fourSlashTypes_1 = require("./fourSlashTypes");
|
|
74
76
|
const testLanguageService_1 = require("./testLanguageService");
|
75
77
|
const testStateUtils_1 = require("./testStateUtils");
|
76
78
|
const workspaceEditTestUtils_1 = require("./workspaceEditTestUtils");
|
77
|
-
const testAccessHost = new testAccessHost_1.TestAccessHost(vfs.MODULE_PATH, [factory_1.libFolder, factory_1.distlibFolder]);
|
79
|
+
const testAccessHost = new testAccessHost_1.TestAccessHost(uri_1.Uri.file(vfs.MODULE_PATH), [factory_1.libFolder, factory_1.distlibFolder]);
|
78
80
|
class TestState {
|
79
81
|
constructor(projectRoot, testData, mountPaths, hostSpecificFeatures, testFS,
|
80
82
|
// Setting delayFileInitialization to true enables derived class constructors to execute
|
@@ -101,16 +103,15 @@ class TestState {
|
|
101
103
|
this.rawConfigJson = vfsInfo.rawConfigJson;
|
102
104
|
const configOptions = this._convertGlobalOptionsToConfigOptions(vfsInfo.projectRoot, mountPaths);
|
103
105
|
if (this.rawConfigJson) {
|
104
|
-
configOptions.initializeFromJson(this.rawConfigJson, '
|
106
|
+
configOptions.initializeFromJson(this.rawConfigJson, 'standard', this.serviceProvider, testAccessHost);
|
105
107
|
this._applyTestConfigOptions(configOptions);
|
106
108
|
}
|
107
109
|
const service = this._createAnalysisService(this.console, this._hostSpecificFeatures.importResolverFactory, this._hostSpecificFeatures.backgroundAnalysisProgramFactory, configOptions);
|
108
110
|
this.workspace = {
|
109
111
|
workspaceName: 'test workspace',
|
110
|
-
|
112
|
+
rootUri: uri_1.Uri.file(vfsInfo.projectRoot),
|
111
113
|
pythonPath: undefined,
|
112
114
|
pythonPathKind: workspaceFactory_1.WorkspacePythonPathKind.Mutable,
|
113
|
-
uri: (0, pathUtils_1.convertPathToUri)(this.fs, vfsInfo.projectRoot),
|
114
115
|
kinds: [workspaceFactory_1.WellKnownWorkspaceKinds.Test],
|
115
116
|
service: service,
|
116
117
|
disableLanguageServices: false,
|
@@ -130,7 +131,7 @@ class TestState {
|
|
130
131
|
if (!delayFileInitialization) {
|
131
132
|
this.initializeFiles();
|
132
133
|
}
|
133
|
-
(0,
|
134
|
+
(0, uriUtils_1.setTestingMode)(true);
|
134
135
|
}
|
135
136
|
get importResolver() {
|
136
137
|
return this.workspace.service.getImportResolver();
|
@@ -158,7 +159,7 @@ class TestState {
|
|
158
159
|
for (const filePath of this.files) {
|
159
160
|
const file = this._vfsFiles[filePath];
|
160
161
|
if ((_a = file.meta) === null || _a === void 0 ? void 0 : _a["ipythonmode" /* MetadataOptionNames.ipythonMode */]) {
|
161
|
-
(_b = this.program.getSourceFile(filePath)) === null || _b === void 0 ? void 0 : _b.test_enableIPythonMode(true);
|
162
|
+
(_b = this.program.getSourceFile(uri_1.Uri.file(filePath))) === null || _b === void 0 ? void 0 : _b.test_enableIPythonMode(true);
|
162
163
|
}
|
163
164
|
}
|
164
165
|
}
|
@@ -190,8 +191,9 @@ class TestState {
|
|
190
191
|
}
|
191
192
|
}
|
192
193
|
getMappedFilePath(path) {
|
193
|
-
|
194
|
-
|
194
|
+
const uri = uri_1.Uri.file(path);
|
195
|
+
this.importResolver.ensurePartialStubPackages(this.configOptions.findExecEnvironment(uri));
|
196
|
+
return this.fs.getMappedUri(uri).getFilePath();
|
195
197
|
}
|
196
198
|
getMarkerName(m) {
|
197
199
|
return (0, testStateUtils_1.getMarkerName)(this.testData, m);
|
@@ -232,12 +234,6 @@ class TestState {
|
|
232
234
|
convertPositionRange(range) {
|
233
235
|
return this.convertOffsetsToRange(range.fileName, range.pos, range.end);
|
234
236
|
}
|
235
|
-
convertPathToUri(path) {
|
236
|
-
return (0, pathUtils_1.convertPathToUri)(this.fs, path);
|
237
|
-
}
|
238
|
-
getDirectoryPath(path) {
|
239
|
-
return (0, pathUtils_1.getDirectoryPath)(path);
|
240
|
-
}
|
241
237
|
getPathSep() {
|
242
238
|
return path.sep;
|
243
239
|
}
|
@@ -321,7 +317,7 @@ class TestState {
|
|
321
317
|
const fileToOpen = this.findFile(indexOrName);
|
322
318
|
fileToOpen.fileName = (0, pathUtils_1.normalizeSlashes)(fileToOpen.fileName);
|
323
319
|
this.activeFile = fileToOpen;
|
324
|
-
this.program.setFileOpened(this.activeFile.fileName, 1, fileToOpen.content);
|
320
|
+
this.program.setFileOpened(uri_1.Uri.file(this.activeFile.fileName), 1, fileToOpen.content);
|
325
321
|
return fileToOpen;
|
326
322
|
}
|
327
323
|
openFiles(indexOrNames) {
|
@@ -534,6 +530,11 @@ class TestState {
|
|
534
530
|
function convertToString(args) {
|
535
531
|
return args === null || args === void 0 ? void 0 : args.map((a) => {
|
536
532
|
if ((0, core_1.isString)(a)) {
|
533
|
+
// Might be a URI. For comparison purposes in a test, convert it into a
|
534
|
+
// file path.
|
535
|
+
if (a.startsWith('file://')) {
|
536
|
+
return (0, pathUtils_1.normalizeSlashes)(uri_1.Uri.parse(a, true).getFilePath());
|
537
|
+
}
|
537
538
|
return (0, pathUtils_1.normalizeSlashes)(a);
|
538
539
|
}
|
539
540
|
return JSON.stringify(a);
|
@@ -541,7 +542,16 @@ class TestState {
|
|
541
542
|
}
|
542
543
|
}
|
543
544
|
async verifyCommand(command, files) {
|
545
|
+
var _a;
|
544
546
|
this.analyze();
|
547
|
+
// Convert command arguments to file Uri strings. That's the expected input for command arguments.
|
548
|
+
const convertedArgs = (_a = command.arguments) === null || _a === void 0 ? void 0 : _a.map((arg) => {
|
549
|
+
if (typeof arg === 'string' && (arg.endsWith('.py') || arg.endsWith('.pyi'))) {
|
550
|
+
return uri_1.Uri.file(arg).toString();
|
551
|
+
}
|
552
|
+
return arg;
|
553
|
+
});
|
554
|
+
command.arguments = convertedArgs;
|
545
555
|
const commandResult = await this._hostSpecificFeatures.execute(new testLanguageService_1.TestLanguageService(this.workspace, this.console, this.fs), { command: command.command, arguments: command.arguments || [] }, vscode_languageserver_1.CancellationToken.None);
|
546
556
|
if (command.command === 'pyright.createtypestub') {
|
547
557
|
await this._verifyFiles(files);
|
@@ -612,7 +622,7 @@ class TestState {
|
|
612
622
|
continue;
|
613
623
|
}
|
614
624
|
const rangePos = this.convertOffsetsToRange(range.fileName, range.pos, range.end);
|
615
|
-
const provider = new hoverProvider_1.HoverProvider(this.program, range.fileName, rangePos.start, kind, vscode_languageserver_1.CancellationToken.None);
|
625
|
+
const provider = new hoverProvider_1.HoverProvider(this.program, uri_1.Uri.file(range.fileName), rangePos.start, kind, vscode_languageserver_1.CancellationToken.None);
|
616
626
|
const actual = provider.getHover();
|
617
627
|
// if expected is null then there should be nothing shown on hover
|
618
628
|
if (expected === null) {
|
@@ -740,7 +750,7 @@ class TestState {
|
|
740
750
|
}
|
741
751
|
const expected = map[name];
|
742
752
|
const position = this.convertOffsetToPosition(fileName, marker.position);
|
743
|
-
const actual = new signatureHelpProvider_1.SignatureHelpProvider(this.program, fileName, position, docFormat,
|
753
|
+
const actual = new signatureHelpProvider_1.SignatureHelpProvider(this.program, uri_1.Uri.file(fileName), position, docFormat,
|
744
754
|
/* hasSignatureLabelOffsetCapability */ true,
|
745
755
|
/* hasActiveParameterCapability */ true,
|
746
756
|
/* context */ undefined, vscode_languageserver_1.CancellationToken.None).getSignatureHelp();
|
@@ -788,9 +798,16 @@ class TestState {
|
|
788
798
|
if (!(name in map)) {
|
789
799
|
continue;
|
790
800
|
}
|
791
|
-
|
801
|
+
let expected = map[name].references;
|
802
|
+
expected = expected.map((c) => {
|
803
|
+
var _a;
|
804
|
+
return {
|
805
|
+
...c,
|
806
|
+
uri: (_a = c.uri) !== null && _a !== void 0 ? _a : uri_1.Uri.file(c.path),
|
807
|
+
};
|
808
|
+
});
|
792
809
|
const position = this.convertOffsetToPosition(fileName, marker.position);
|
793
|
-
const actual = new referencesProvider_1.ReferencesProvider(this.program, vscode_languageserver_1.CancellationToken.None, createDocumentRange, convertToLocation).reportReferences(fileName, position, /* includeDeclaration */ true);
|
810
|
+
const actual = new referencesProvider_1.ReferencesProvider(this.program, vscode_languageserver_1.CancellationToken.None, createDocumentRange, convertToLocation).reportReferences(uri_1.Uri.file(fileName), position, /* includeDeclaration */ true);
|
794
811
|
assert_1.default.strictEqual((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expected.length, `${name} has failed`);
|
795
812
|
for (const r of (0, navigationUtils_1.convertDocumentRangesToLocation)(this.program.fileSystem, expected, convertToLocation)) {
|
796
813
|
assert_1.default.equal(actual === null || actual === void 0 ? void 0 : actual.filter((d) => this._deepEqual(d, r)).length, 1);
|
@@ -810,7 +827,7 @@ class TestState {
|
|
810
827
|
const expectedRange = map[name].items.map((x) => x.range);
|
811
828
|
const expectedName = map[name].items.map((x) => x.name);
|
812
829
|
const position = this.convertOffsetToPosition(fileName, marker.position);
|
813
|
-
const actual = new callHierarchyProvider_1.CallHierarchyProvider(this.program, fileName, position, vscode_languageserver_1.CancellationToken.None).getIncomingCalls();
|
830
|
+
const actual = new callHierarchyProvider_1.CallHierarchyProvider(this.program, uri_1.Uri.file(fileName), position, vscode_languageserver_1.CancellationToken.None).getIncomingCalls();
|
814
831
|
assert_1.default.strictEqual((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expectedFilePath.length, `${name} has failed`);
|
815
832
|
assert_1.default.strictEqual((_b = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _b !== void 0 ? _b : 0, expectedRange.length, `${name} has failed`);
|
816
833
|
assert_1.default.strictEqual((_c = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _c !== void 0 ? _c : 0, expectedName.length, `${name} has failed`);
|
@@ -818,7 +835,7 @@ class TestState {
|
|
818
835
|
for (const a of actual) {
|
819
836
|
assert_1.default.strictEqual(expectedRange === null || expectedRange === void 0 ? void 0 : expectedRange.filter((e) => this._deepEqual(a.from.range, e)).length, 1);
|
820
837
|
assert_1.default.strictEqual(expectedName === null || expectedName === void 0 ? void 0 : expectedName.filter((e) => this._deepEqual(a.from.name, e)).length, 1);
|
821
|
-
assert_1.default.ok((expectedFilePath === null || expectedFilePath === void 0 ? void 0 : expectedFilePath.filter((e) => this._deepEqual(a.from.uri,
|
838
|
+
assert_1.default.ok((expectedFilePath === null || expectedFilePath === void 0 ? void 0 : expectedFilePath.filter((e) => this._deepEqual(a.from.uri, uri_1.Uri.file(e).toString())).length) >= 1);
|
822
839
|
}
|
823
840
|
}
|
824
841
|
}
|
@@ -836,7 +853,7 @@ class TestState {
|
|
836
853
|
const expectedRange = map[name].items.map((x) => x.range);
|
837
854
|
const expectedName = map[name].items.map((x) => x.name);
|
838
855
|
const position = this.convertOffsetToPosition(fileName, marker.position);
|
839
|
-
const actual = new callHierarchyProvider_1.CallHierarchyProvider(this.program, fileName, position, vscode_languageserver_1.CancellationToken.None).getOutgoingCalls();
|
856
|
+
const actual = new callHierarchyProvider_1.CallHierarchyProvider(this.program, uri_1.Uri.file(fileName), position, vscode_languageserver_1.CancellationToken.None).getOutgoingCalls();
|
840
857
|
assert_1.default.strictEqual((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expectedFilePath.length, `${name} has failed`);
|
841
858
|
assert_1.default.strictEqual((_b = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _b !== void 0 ? _b : 0, expectedRange.length, `${name} has failed`);
|
842
859
|
assert_1.default.strictEqual((_c = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _c !== void 0 ? _c : 0, expectedName.length, `${name} has failed`);
|
@@ -844,7 +861,7 @@ class TestState {
|
|
844
861
|
for (const a of actual) {
|
845
862
|
assert_1.default.strictEqual(expectedRange === null || expectedRange === void 0 ? void 0 : expectedRange.filter((e) => this._deepEqual(a.to.range, e)).length, 1);
|
846
863
|
assert_1.default.strictEqual(expectedName === null || expectedName === void 0 ? void 0 : expectedName.filter((e) => this._deepEqual(a.to.name, e)).length, 1);
|
847
|
-
assert_1.default.ok((expectedFilePath === null || expectedFilePath === void 0 ? void 0 : expectedFilePath.filter((e) => this._deepEqual(a.to.uri,
|
864
|
+
assert_1.default.ok((expectedFilePath === null || expectedFilePath === void 0 ? void 0 : expectedFilePath.filter((e) => this._deepEqual(a.to.uri, uri_1.Uri.file(e).toString())).length) >= 1);
|
848
865
|
}
|
849
866
|
}
|
850
867
|
}
|
@@ -870,7 +887,7 @@ class TestState {
|
|
870
887
|
const fileName = marker.fileName;
|
871
888
|
const expected = map[name].references;
|
872
889
|
const position = this.convertOffsetToPosition(fileName, marker.position);
|
873
|
-
const actual = new documentHighlightProvider_1.DocumentHighlightProvider(this.program, fileName, position, vscode_languageserver_1.CancellationToken.None).getDocumentHighlight();
|
890
|
+
const actual = new documentHighlightProvider_1.DocumentHighlightProvider(this.program, uri_1.Uri.file(fileName), position, vscode_languageserver_1.CancellationToken.None).getDocumentHighlight();
|
874
891
|
assert_1.default.equal((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expected.length);
|
875
892
|
for (const r of expected) {
|
876
893
|
const match = actual === null || actual === void 0 ? void 0 : actual.filter((h) => this._deepEqual(h.range, r.range));
|
@@ -881,6 +898,15 @@ class TestState {
|
|
881
898
|
}
|
882
899
|
}
|
883
900
|
}
|
901
|
+
fixupDefinitionsToMatchExpected(actual) {
|
902
|
+
return actual === null || actual === void 0 ? void 0 : actual.map((a) => {
|
903
|
+
const { uri, ...restOfActual } = a;
|
904
|
+
return {
|
905
|
+
...restOfActual,
|
906
|
+
path: uri.getFilePath(),
|
907
|
+
};
|
908
|
+
});
|
909
|
+
}
|
884
910
|
verifyFindDefinitions(map, filter = definitionProvider_1.DefinitionFilter.All) {
|
885
911
|
var _a;
|
886
912
|
this.analyze();
|
@@ -891,16 +917,18 @@ class TestState {
|
|
891
917
|
continue;
|
892
918
|
}
|
893
919
|
const expected = map[name].definitions;
|
920
|
+
const uri = uri_1.Uri.file(fileName);
|
894
921
|
// If we're going to def from a file, act like it's open.
|
895
|
-
if (!this.program.getSourceFileInfo(
|
922
|
+
if (!this.program.getSourceFileInfo(uri)) {
|
896
923
|
const file = this.testData.files.find((v) => v.fileName === fileName);
|
897
924
|
if (file) {
|
898
|
-
this.program.setFileOpened(
|
925
|
+
this.program.setFileOpened(uri, file.version, file.content);
|
899
926
|
}
|
900
927
|
}
|
901
928
|
const position = this.convertOffsetToPosition(fileName, marker.position);
|
902
|
-
|
929
|
+
let actual = new definitionProvider_1.DefinitionProvider(this.program, uri, position, filter, vscode_languageserver_1.CancellationToken.None).getDefinitions();
|
903
930
|
assert_1.default.equal((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expected.length, `No definitions found for marker "${name}"`);
|
931
|
+
actual = this.fixupDefinitionsToMatchExpected(actual);
|
904
932
|
for (const r of expected) {
|
905
933
|
assert_1.default.equal(actual === null || actual === void 0 ? void 0 : actual.filter((d) => this._deepEqual(d, r)).length, 1, `No match found for ${JSON.stringify(r)} from marker ${name}`);
|
906
934
|
}
|
@@ -917,7 +945,8 @@ class TestState {
|
|
917
945
|
}
|
918
946
|
const expected = map[name].definitions;
|
919
947
|
const position = this.convertOffsetToPosition(fileName, marker.position);
|
920
|
-
|
948
|
+
let actual = new definitionProvider_1.TypeDefinitionProvider(this.program, uri_1.Uri.file(fileName), position, vscode_languageserver_1.CancellationToken.None).getDefinitions();
|
949
|
+
actual = this.fixupDefinitionsToMatchExpected(actual);
|
921
950
|
assert_1.default.strictEqual((_a = actual === null || actual === void 0 ? void 0 : actual.length) !== null && _a !== void 0 ? _a : 0, expected.length, name);
|
922
951
|
for (const r of expected) {
|
923
952
|
assert_1.default.strictEqual(actual === null || actual === void 0 ? void 0 : actual.filter((d) => this._deepEqual(d, r)).length, 1, name);
|
@@ -933,10 +962,16 @@ class TestState {
|
|
933
962
|
continue;
|
934
963
|
}
|
935
964
|
const expected = map[name];
|
965
|
+
expected.changes = expected.changes.map((c) => {
|
966
|
+
var _a;
|
967
|
+
return {
|
968
|
+
...c,
|
969
|
+
fileUri: (_a = c.fileUri) !== null && _a !== void 0 ? _a : uri_1.Uri.file(c.filePath),
|
970
|
+
};
|
971
|
+
});
|
936
972
|
const position = this.convertOffsetToPosition(fileName, marker.position);
|
937
|
-
const actual = new renameProvider_1.RenameProvider(this.program, fileName, position, vscode_languageserver_1.CancellationToken.None).renameSymbol(expected.newName,
|
938
|
-
|
939
|
-
(0, workspaceEditTestUtils_1.verifyWorkspaceEdit)((0, workspaceEditUtils_1.convertToWorkspaceEdit)(this.program.fileSystem, { edits: expected.changes, fileOperations: [] }), actual !== null && actual !== void 0 ? actual : { documentChanges: [] });
|
973
|
+
const actual = new renameProvider_1.RenameProvider(this.program, uri_1.Uri.file(fileName), position, vscode_languageserver_1.CancellationToken.None).renameSymbol(expected.newName, /* isDefaultWorkspace */ false, isUntitled);
|
974
|
+
(0, workspaceEditTestUtils_1.verifyWorkspaceEdit)((0, workspaceEditUtils_1.convertToWorkspaceEdit)({ edits: expected.changes, fileOperations: [] }), actual !== null && actual !== void 0 ? actual : { documentChanges: [] });
|
940
975
|
}
|
941
976
|
}
|
942
977
|
setCancelled(numberOfCalls) {
|
@@ -988,7 +1023,7 @@ class TestState {
|
|
988
1023
|
snippet: true,
|
989
1024
|
lazyEdit: false,
|
990
1025
|
};
|
991
|
-
const provider = new completionProvider_1.CompletionProvider(this.program, this.workspace.
|
1026
|
+
const provider = new completionProvider_1.CompletionProvider(this.program, this.workspace.rootUri, uri_1.Uri.file(filePath), completionPosition, options, vscode_languageserver_1.CancellationToken.None);
|
992
1027
|
return {
|
993
1028
|
getCompletions: () => provider.getCompletions(),
|
994
1029
|
resolveCompletionItem: (i) => provider.resolveCompletionItem(i),
|
@@ -1063,7 +1098,7 @@ class TestState {
|
|
1063
1098
|
}
|
1064
1099
|
}
|
1065
1100
|
_convertGlobalOptionsToConfigOptions(projectRoot, mountPaths) {
|
1066
|
-
const configOptions = new configOptions_1.ConfigOptions(projectRoot);
|
1101
|
+
const configOptions = new configOptions_1.ConfigOptions(uri_1.Uri.file(projectRoot));
|
1067
1102
|
// add more global options as we need them
|
1068
1103
|
const newConfigOptions = this._applyTestConfigOptions(configOptions, mountPaths);
|
1069
1104
|
// default tests to run use compact signatures.
|
@@ -1077,15 +1112,15 @@ class TestState {
|
|
1077
1112
|
configOptions.checkOnlyOpenFiles = false;
|
1078
1113
|
// make sure we set typing path
|
1079
1114
|
if (configOptions.stubPath === undefined) {
|
1080
|
-
configOptions.stubPath = (
|
1115
|
+
configOptions.stubPath = uri_1.Uri.file(vfs.MODULE_PATH).combinePaths('typings');
|
1081
1116
|
}
|
1082
|
-
configOptions.include.push((0,
|
1083
|
-
configOptions.exclude.push((0,
|
1084
|
-
configOptions.exclude.push((0,
|
1085
|
-
configOptions.exclude.push((0,
|
1117
|
+
configOptions.include.push((0, uriUtils_1.getFileSpec)(configOptions.projectRoot, '.'));
|
1118
|
+
configOptions.exclude.push((0, uriUtils_1.getFileSpec)(configOptions.projectRoot, factory_1.typeshedFolder));
|
1119
|
+
configOptions.exclude.push((0, uriUtils_1.getFileSpec)(configOptions.projectRoot, factory_1.distlibFolder.getFilePath()));
|
1120
|
+
configOptions.exclude.push((0, uriUtils_1.getFileSpec)(configOptions.projectRoot, factory_1.libFolder.getFilePath()));
|
1086
1121
|
if (mountPaths) {
|
1087
1122
|
for (const mountPath of mountPaths.keys()) {
|
1088
|
-
configOptions.exclude.push((0,
|
1123
|
+
configOptions.exclude.push((0, uriUtils_1.getFileSpec)(configOptions.projectRoot, mountPath));
|
1089
1124
|
}
|
1090
1125
|
}
|
1091
1126
|
if (configOptions.functionSignatureDisplay === undefined) {
|
@@ -1094,7 +1129,7 @@ class TestState {
|
|
1094
1129
|
return configOptions;
|
1095
1130
|
}
|
1096
1131
|
_getParseResult(fileName) {
|
1097
|
-
const file = this.program.getBoundSourceFile(fileName);
|
1132
|
+
const file = this.program.getBoundSourceFile(uri_1.Uri.file(fileName));
|
1098
1133
|
return file === null || file === void 0 ? void 0 : file.getParseResults();
|
1099
1134
|
}
|
1100
1135
|
_getTextRangeCollection(fileName) {
|
@@ -1105,7 +1140,7 @@ class TestState {
|
|
1105
1140
|
}
|
1106
1141
|
}
|
1107
1142
|
// slow path
|
1108
|
-
const fileContents = this.fs.readFileSync(fileName, 'utf8');
|
1143
|
+
const fileContents = this.fs.readFileSync(uri_1.Uri.file(fileName), 'utf8');
|
1109
1144
|
const tokenizer = new tokenizer_1.Tokenizer();
|
1110
1145
|
return tokenizer.tokenize(fileContents).lines;
|
1111
1146
|
}
|
@@ -1122,9 +1157,10 @@ class TestState {
|
|
1122
1157
|
var _a, _b;
|
1123
1158
|
let fileContent = this.getFileContent(fileName);
|
1124
1159
|
fileContent = fileContent.slice(0, editStart) + newText + fileContent.slice(editEnd);
|
1125
|
-
|
1126
|
-
|
1127
|
-
this.program.
|
1160
|
+
const uri = uri_1.Uri.file(fileName);
|
1161
|
+
this.testFS.writeFileSync(uri, fileContent, 'utf8');
|
1162
|
+
const newVersion = ((_b = (_a = this.program.getSourceFile(uri)) === null || _a === void 0 ? void 0 : _a.getClientVersion()) !== null && _b !== void 0 ? _b : -1) + 1;
|
1163
|
+
this.program.setFileOpened(uri, newVersion, fileContent);
|
1128
1164
|
for (const marker of this.testData.markers) {
|
1129
1165
|
if (marker.fileName === fileName) {
|
1130
1166
|
marker.position = this._updatePosition(marker.position, editStart, editEnd, newText);
|
@@ -1238,20 +1274,22 @@ class TestState {
|
|
1238
1274
|
return position <= editStart ? position : position < editEnd ? -1 : position + length - +(editEnd - editStart);
|
1239
1275
|
}
|
1240
1276
|
_getDiagnosticsPerFile() {
|
1241
|
-
const sourceFiles = this.files.map((f) => this.program.getSourceFile(f));
|
1277
|
+
const sourceFiles = this.files.map((f) => this.program.getSourceFile(uri_1.Uri.file(f)));
|
1242
1278
|
const results = sourceFiles.map((sourceFile, index) => {
|
1243
1279
|
if (sourceFile) {
|
1244
1280
|
const diagnostics = sourceFile.getDiagnostics(this.configOptions) || [];
|
1245
|
-
const
|
1281
|
+
const fileUri = sourceFile.getUri();
|
1246
1282
|
const value = {
|
1247
|
-
|
1283
|
+
fileUri,
|
1248
1284
|
parseResults: sourceFile.getParseResults(),
|
1249
1285
|
errors: diagnostics.filter((diag) => diag.category === 0 /* DiagnosticCategory.Error */),
|
1250
1286
|
warnings: diagnostics.filter((diag) => diag.category === 1 /* DiagnosticCategory.Warning */),
|
1251
1287
|
information: diagnostics.filter((diag) => diag.category === 2 /* DiagnosticCategory.Information */),
|
1252
1288
|
unused: diagnostics.filter((diag) => diag.category === 3 /* DiagnosticCategory.UnusedCode */),
|
1253
1289
|
};
|
1254
|
-
|
1290
|
+
// Don't use the uri key, but rather the file name, because other spots
|
1291
|
+
// in the test data assume file paths.
|
1292
|
+
return [this.files[index], value];
|
1255
1293
|
}
|
1256
1294
|
else {
|
1257
1295
|
this.raiseError(`Source file not found for ${this.files[index]}`);
|
@@ -1276,6 +1314,7 @@ class TestState {
|
|
1276
1314
|
const fileExtension = (0, pathUtils_1.getFileExtension)(path).toLowerCase();
|
1277
1315
|
return fileExtension === '.py' || fileExtension === '.pyi';
|
1278
1316
|
})
|
1317
|
+
.map((path) => uri_1.Uri.file(path))
|
1279
1318
|
.filter((path) => service.isTracked(path)));
|
1280
1319
|
return service;
|
1281
1320
|
}
|
@@ -1290,7 +1329,8 @@ class TestState {
|
|
1290
1329
|
return true;
|
1291
1330
|
}
|
1292
1331
|
async _waitForFile(filePath) {
|
1293
|
-
|
1332
|
+
const uri = uri_1.Uri.file(filePath);
|
1333
|
+
while (!this.fs.existsSync(uri)) {
|
1294
1334
|
await new Promise((res) => setTimeout(() => {
|
1295
1335
|
res();
|
1296
1336
|
}, 200));
|
@@ -1302,7 +1342,7 @@ class TestState {
|
|
1302
1342
|
start: this.convertOffsetToPosition(file, range.pos),
|
1303
1343
|
end: this.convertOffsetToPosition(file, range.end),
|
1304
1344
|
};
|
1305
|
-
return this._hostSpecificFeatures.getCodeActionsForPosition(this.workspace, file, textRange, vscode_languageserver_1.CancellationToken.None);
|
1345
|
+
return this._hostSpecificFeatures.getCodeActionsForPosition(this.workspace, uri_1.Uri.file(file), textRange, vscode_languageserver_1.CancellationToken.None);
|
1306
1346
|
}
|
1307
1347
|
async _verifyFiles(files) {
|
1308
1348
|
for (const filePath of Object.keys(files)) {
|
@@ -1310,7 +1350,7 @@ class TestState {
|
|
1310
1350
|
const normalizedFilePath = (0, pathUtils_1.normalizeSlashes)(filePath);
|
1311
1351
|
// wait until the file exists
|
1312
1352
|
await this._waitForFile(normalizedFilePath);
|
1313
|
-
const actual = this.fs.readFileSync(normalizedFilePath, 'utf8');
|
1353
|
+
const actual = this.fs.readFileSync(uri_1.Uri.file(normalizedFilePath), 'utf8');
|
1314
1354
|
if (actual !== expected) {
|
1315
1355
|
this.raiseError(`doesn't contain expected result: ${(0, utils_1.stringify)(expected)}, actual: ${(0, utils_1.stringify)(actual)}`);
|
1316
1356
|
}
|
@@ -1374,7 +1414,7 @@ exports.getNodeForRange = getNodeForRange;
|
|
1374
1414
|
function getNodeAtMarker(codeOrState, markerName = 'marker') {
|
1375
1415
|
const state = (0, core_1.isString)(codeOrState) ? parseAndGetTestState(codeOrState).state : codeOrState;
|
1376
1416
|
const marker = state.getMarkerByName(markerName);
|
1377
|
-
const sourceFile = state.program.getBoundSourceFile(marker.fileName);
|
1417
|
+
const sourceFile = state.program.getBoundSourceFile(uri_1.Uri.file(marker.fileName));
|
1378
1418
|
(0, assert_1.default)(sourceFile);
|
1379
1419
|
const parserResults = sourceFile.getParseResults();
|
1380
1420
|
(0, assert_1.default)(parserResults);
|