@zzzen/pyright-internal 1.1.254
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/aliasDeclarationUtils.d.ts +9 -0
- package/dist/analyzer/aliasDeclarationUtils.js +128 -0
- package/dist/analyzer/aliasDeclarationUtils.js.map +1 -0
- package/dist/analyzer/analysis.d.ts +18 -0
- package/dist/analyzer/analysis.js +81 -0
- package/dist/analyzer/analysis.js.map +1 -0
- package/dist/analyzer/analyzerFileInfo.d.ts +39 -0
- package/dist/analyzer/analyzerFileInfo.js +17 -0
- package/dist/analyzer/analyzerFileInfo.js.map +1 -0
- package/dist/analyzer/analyzerNodeInfo.d.ts +32 -0
- package/dist/analyzer/analyzerNodeInfo.js +138 -0
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -0
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +54 -0
- package/dist/analyzer/backgroundAnalysisProgram.js +222 -0
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -0
- package/dist/analyzer/binder.d.ts +149 -0
- package/dist/analyzer/binder.js +3195 -0
- package/dist/analyzer/binder.js.map +1 -0
- package/dist/analyzer/checker.d.ts +116 -0
- package/dist/analyzer/checker.js +3828 -0
- package/dist/analyzer/checker.js.map +1 -0
- package/dist/analyzer/circularDependency.d.ts +7 -0
- package/dist/analyzer/circularDependency.js +51 -0
- package/dist/analyzer/circularDependency.js.map +1 -0
- package/dist/analyzer/codeFlowEngine.d.ts +21 -0
- package/dist/analyzer/codeFlowEngine.js +1132 -0
- package/dist/analyzer/codeFlowEngine.js.map +1 -0
- package/dist/analyzer/codeFlowTypes.d.ts +82 -0
- package/dist/analyzer/codeFlowTypes.js +134 -0
- package/dist/analyzer/codeFlowTypes.js.map +1 -0
- package/dist/analyzer/codeFlowUtils.d.ts +2 -0
- package/dist/analyzer/codeFlowUtils.js +348 -0
- package/dist/analyzer/codeFlowUtils.js.map +1 -0
- package/dist/analyzer/commentUtils.d.ts +4 -0
- package/dist/analyzer/commentUtils.js +131 -0
- package/dist/analyzer/commentUtils.js.map +1 -0
- package/dist/analyzer/constraintSolver.d.ts +7 -0
- package/dist/analyzer/constraintSolver.js +605 -0
- package/dist/analyzer/constraintSolver.js.map +1 -0
- package/dist/analyzer/constructorTransform.d.ts +4 -0
- package/dist/analyzer/constructorTransform.js +219 -0
- package/dist/analyzer/constructorTransform.js.map +1 -0
- package/dist/analyzer/dataClasses.d.ts +9 -0
- package/dist/analyzer/dataClasses.js +762 -0
- package/dist/analyzer/dataClasses.js.map +1 -0
- package/dist/analyzer/declaration.d.ts +90 -0
- package/dist/analyzer/declaration.js +42 -0
- package/dist/analyzer/declaration.js.map +1 -0
- package/dist/analyzer/declarationUtils.d.ts +12 -0
- package/dist/analyzer/declarationUtils.js +212 -0
- package/dist/analyzer/declarationUtils.js.map +1 -0
- package/dist/analyzer/docStringConversion.d.ts +2 -0
- package/dist/analyzer/docStringConversion.js +699 -0
- package/dist/analyzer/docStringConversion.js.map +1 -0
- package/dist/analyzer/docStringUtils.d.ts +3 -0
- package/dist/analyzer/docStringUtils.js +103 -0
- package/dist/analyzer/docStringUtils.js.map +1 -0
- package/dist/analyzer/functionTransform.d.ts +4 -0
- package/dist/analyzer/functionTransform.js +96 -0
- package/dist/analyzer/functionTransform.js.map +1 -0
- package/dist/analyzer/importResolver.d.ts +97 -0
- package/dist/analyzer/importResolver.js +1617 -0
- package/dist/analyzer/importResolver.js.map +1 -0
- package/dist/analyzer/importResult.d.ts +33 -0
- package/dist/analyzer/importResult.js +11 -0
- package/dist/analyzer/importResult.js.map +1 -0
- package/dist/analyzer/importStatementUtils.d.ts +46 -0
- package/dist/analyzer/importStatementUtils.js +618 -0
- package/dist/analyzer/importStatementUtils.js.map +1 -0
- package/dist/analyzer/namedTuples.d.ts +5 -0
- package/dist/analyzer/namedTuples.js +342 -0
- package/dist/analyzer/namedTuples.js.map +1 -0
- package/dist/analyzer/packageTypeReport.d.ts +52 -0
- package/dist/analyzer/packageTypeReport.js +45 -0
- package/dist/analyzer/packageTypeReport.js.map +1 -0
- package/dist/analyzer/packageTypeVerifier.d.ts +37 -0
- package/dist/analyzer/packageTypeVerifier.js +908 -0
- package/dist/analyzer/packageTypeVerifier.js.map +1 -0
- package/dist/analyzer/parentDirectoryCache.d.ts +23 -0
- package/dist/analyzer/parentDirectoryCache.js +71 -0
- package/dist/analyzer/parentDirectoryCache.js.map +1 -0
- package/dist/analyzer/parseTreeCleaner.d.ts +8 -0
- package/dist/analyzer/parseTreeCleaner.js +51 -0
- package/dist/analyzer/parseTreeCleaner.js.map +1 -0
- package/dist/analyzer/parseTreeUtils.d.ts +98 -0
- package/dist/analyzer/parseTreeUtils.js +1753 -0
- package/dist/analyzer/parseTreeUtils.js.map +1 -0
- package/dist/analyzer/parseTreeWalker.d.ts +81 -0
- package/dist/analyzer/parseTreeWalker.js +437 -0
- package/dist/analyzer/parseTreeWalker.js.map +1 -0
- package/dist/analyzer/patternMatching.d.ts +6 -0
- package/dist/analyzer/patternMatching.js +866 -0
- package/dist/analyzer/patternMatching.js.map +1 -0
- package/dist/analyzer/program.d.ts +158 -0
- package/dist/analyzer/program.js +1902 -0
- package/dist/analyzer/program.js.map +1 -0
- package/dist/analyzer/properties.d.ts +10 -0
- package/dist/analyzer/properties.js +368 -0
- package/dist/analyzer/properties.js.map +1 -0
- package/dist/analyzer/protocols.d.ts +8 -0
- package/dist/analyzer/protocols.js +409 -0
- package/dist/analyzer/protocols.js.map +1 -0
- package/dist/analyzer/pyTypedUtils.d.ts +6 -0
- package/dist/analyzer/pyTypedUtils.js +42 -0
- package/dist/analyzer/pyTypedUtils.js.map +1 -0
- package/dist/analyzer/pythonPathUtils.d.ts +14 -0
- package/dist/analyzer/pythonPathUtils.js +173 -0
- package/dist/analyzer/pythonPathUtils.js.map +1 -0
- package/dist/analyzer/scope.d.ts +39 -0
- package/dist/analyzer/scope.js +110 -0
- package/dist/analyzer/scope.js.map +1 -0
- package/dist/analyzer/scopeUtils.d.ts +6 -0
- package/dist/analyzer/scopeUtils.js +72 -0
- package/dist/analyzer/scopeUtils.js.map +1 -0
- package/dist/analyzer/service.d.ts +144 -0
- package/dist/analyzer/service.js +1197 -0
- package/dist/analyzer/service.js.map +1 -0
- package/dist/analyzer/sourceFile.d.ts +123 -0
- package/dist/analyzer/sourceFile.js +908 -0
- package/dist/analyzer/sourceFile.js.map +1 -0
- package/dist/analyzer/sourceMapper.d.ts +47 -0
- package/dist/analyzer/sourceMapper.js +543 -0
- package/dist/analyzer/sourceMapper.js.map +1 -0
- package/dist/analyzer/staticExpressions.d.ts +4 -0
- package/dist/analyzer/staticExpressions.js +242 -0
- package/dist/analyzer/staticExpressions.js.map +1 -0
- package/dist/analyzer/symbol.d.ts +50 -0
- package/dist/analyzer/symbol.js +160 -0
- package/dist/analyzer/symbol.js.map +1 -0
- package/dist/analyzer/symbolNameUtils.d.ts +8 -0
- package/dist/analyzer/symbolNameUtils.js +53 -0
- package/dist/analyzer/symbolNameUtils.js.map +1 -0
- package/dist/analyzer/symbolUtils.d.ts +7 -0
- package/dist/analyzer/symbolUtils.js +46 -0
- package/dist/analyzer/symbolUtils.js.map +1 -0
- package/dist/analyzer/testWalker.d.ts +14 -0
- package/dist/analyzer/testWalker.js +92 -0
- package/dist/analyzer/testWalker.js.map +1 -0
- package/dist/analyzer/tracePrinter.d.ts +11 -0
- package/dist/analyzer/tracePrinter.js +222 -0
- package/dist/analyzer/tracePrinter.js.map +1 -0
- package/dist/analyzer/typeCache.d.ts +40 -0
- package/dist/analyzer/typeCache.js +134 -0
- package/dist/analyzer/typeCache.js.map +1 -0
- package/dist/analyzer/typeDocStringUtils.d.ts +12 -0
- package/dist/analyzer/typeDocStringUtils.js +293 -0
- package/dist/analyzer/typeDocStringUtils.js.map +1 -0
- package/dist/analyzer/typeEvaluator.d.ts +18 -0
- package/dist/analyzer/typeEvaluator.js +16598 -0
- package/dist/analyzer/typeEvaluator.js.map +1 -0
- package/dist/analyzer/typeEvaluatorTypes.d.ts +220 -0
- package/dist/analyzer/typeEvaluatorTypes.js +16 -0
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -0
- package/dist/analyzer/typeEvaluatorWithTracker.d.ts +6 -0
- package/dist/analyzer/typeEvaluatorWithTracker.js +121 -0
- package/dist/analyzer/typeEvaluatorWithTracker.js.map +1 -0
- package/dist/analyzer/typeGuards.d.ts +6 -0
- package/dist/analyzer/typeGuards.js +1293 -0
- package/dist/analyzer/typeGuards.js.map +1 -0
- package/dist/analyzer/typePrinter.d.ts +17 -0
- package/dist/analyzer/typePrinter.js +603 -0
- package/dist/analyzer/typePrinter.js.map +1 -0
- package/dist/analyzer/typeStubWriter.d.ts +48 -0
- package/dist/analyzer/typeStubWriter.js +605 -0
- package/dist/analyzer/typeStubWriter.js.map +1 -0
- package/dist/analyzer/typeUtils.d.ts +134 -0
- package/dist/analyzer/typeUtils.js +2380 -0
- package/dist/analyzer/typeUtils.js.map +1 -0
- package/dist/analyzer/typeVarContext.d.ts +50 -0
- package/dist/analyzer/typeVarContext.js +250 -0
- package/dist/analyzer/typeVarContext.js.map +1 -0
- package/dist/analyzer/typedDicts.d.ts +12 -0
- package/dist/analyzer/typedDicts.js +695 -0
- package/dist/analyzer/typedDicts.js.map +1 -0
- package/dist/analyzer/types.d.ts +484 -0
- package/dist/analyzer/types.js +1844 -0
- package/dist/analyzer/types.js.map +1 -0
- package/dist/backgroundAnalysis.d.ts +14 -0
- package/dist/backgroundAnalysis.js +42 -0
- package/dist/backgroundAnalysis.js.map +1 -0
- package/dist/backgroundAnalysisBase.d.ts +83 -0
- package/dist/backgroundAnalysisBase.js +429 -0
- package/dist/backgroundAnalysisBase.js.map +1 -0
- package/dist/backgroundThreadBase.d.ts +34 -0
- package/dist/backgroundThreadBase.js +134 -0
- package/dist/backgroundThreadBase.js.map +1 -0
- package/dist/commands/commandController.d.ts +13 -0
- package/dist/commands/commandController.js +48 -0
- package/dist/commands/commandController.js.map +1 -0
- package/dist/commands/commandResult.d.ts +9 -0
- package/dist/commands/commandResult.js +19 -0
- package/dist/commands/commandResult.js.map +1 -0
- package/dist/commands/commands.d.ts +7 -0
- package/dist/commands/commands.js +11 -0
- package/dist/commands/commands.js.map +1 -0
- package/dist/commands/createTypeStub.d.ts +8 -0
- package/dist/commands/createTypeStub.js +50 -0
- package/dist/commands/createTypeStub.js.map +1 -0
- package/dist/commands/quickActionCommand.d.ts +8 -0
- package/dist/commands/quickActionCommand.js +31 -0
- package/dist/commands/quickActionCommand.js.map +1 -0
- package/dist/commands/restartServer.d.ts +8 -0
- package/dist/commands/restartServer.js +20 -0
- package/dist/commands/restartServer.js.map +1 -0
- package/dist/common/cancellationUtils.d.ts +16 -0
- package/dist/common/cancellationUtils.js +60 -0
- package/dist/common/cancellationUtils.js.map +1 -0
- package/dist/common/chokidarFileWatcherProvider.d.ts +9 -0
- package/dist/common/chokidarFileWatcherProvider.js +88 -0
- package/dist/common/chokidarFileWatcherProvider.js.map +1 -0
- package/dist/common/collectionUtils.d.ts +114 -0
- package/dist/common/collectionUtils.js +292 -0
- package/dist/common/collectionUtils.js.map +1 -0
- package/dist/common/commandLineOptions.d.ts +41 -0
- package/dist/common/commandLineOptions.js +46 -0
- package/dist/common/commandLineOptions.js.map +1 -0
- package/dist/common/configOptions.d.ts +144 -0
- package/dist/common/configOptions.js +908 -0
- package/dist/common/configOptions.js.map +1 -0
- package/dist/common/console.d.ts +61 -0
- package/dist/common/console.js +191 -0
- package/dist/common/console.js.map +1 -0
- package/dist/common/core.d.ts +67 -0
- package/dist/common/core.js +118 -0
- package/dist/common/core.js.map +1 -0
- package/dist/common/crypto.d.ts +1 -0
- package/dist/common/crypto.js +37 -0
- package/dist/common/crypto.js.map +1 -0
- package/dist/common/debug.d.ts +13 -0
- package/dist/common/debug.js +131 -0
- package/dist/common/debug.js.map +1 -0
- package/dist/common/deferred.d.ts +11 -0
- package/dist/common/deferred.js +62 -0
- package/dist/common/deferred.js.map +1 -0
- package/dist/common/diagnostic.d.ts +59 -0
- package/dist/common/diagnostic.js +134 -0
- package/dist/common/diagnostic.js.map +1 -0
- package/dist/common/diagnosticRules.d.ts +67 -0
- package/dist/common/diagnosticRules.js +83 -0
- package/dist/common/diagnosticRules.js.map +1 -0
- package/dist/common/diagnosticSink.d.ts +34 -0
- package/dist/common/diagnosticSink.js +110 -0
- package/dist/common/diagnosticSink.js.map +1 -0
- package/dist/common/editAction.d.ts +29 -0
- package/dist/common/editAction.js +11 -0
- package/dist/common/editAction.js.map +1 -0
- package/dist/common/extensibility.d.ts +11 -0
- package/dist/common/extensibility.js +10 -0
- package/dist/common/extensibility.js.map +1 -0
- package/dist/common/extensions.d.ts +3 -0
- package/dist/common/extensions.js +15 -0
- package/dist/common/extensions.js.map +1 -0
- package/dist/common/fileBasedCancellationUtils.d.ts +11 -0
- package/dist/common/fileBasedCancellationUtils.js +259 -0
- package/dist/common/fileBasedCancellationUtils.js.map +1 -0
- package/dist/common/fileSystem.d.ts +72 -0
- package/dist/common/fileSystem.js +69 -0
- package/dist/common/fileSystem.js.map +1 -0
- package/dist/common/fullAccessHost.d.ts +19 -0
- package/dist/common/fullAccessHost.js +193 -0
- package/dist/common/fullAccessHost.js.map +1 -0
- package/dist/common/host.d.ts +21 -0
- package/dist/common/host.js +30 -0
- package/dist/common/host.js.map +1 -0
- package/dist/common/logTracker.d.ts +15 -0
- package/dist/common/logTracker.js +129 -0
- package/dist/common/logTracker.js.map +1 -0
- package/dist/common/lspUtils.d.ts +3 -0
- package/dist/common/lspUtils.js +20 -0
- package/dist/common/lspUtils.js.map +1 -0
- package/dist/common/memUtils.d.ts +3 -0
- package/dist/common/memUtils.js +37 -0
- package/dist/common/memUtils.js.map +1 -0
- package/dist/common/pathConsts.d.ts +8 -0
- package/dist/common/pathConsts.js +19 -0
- package/dist/common/pathConsts.js.map +1 -0
- package/dist/common/pathUtils.d.ts +170 -0
- package/dist/common/pathUtils.js +762 -0
- package/dist/common/pathUtils.js.map +1 -0
- package/dist/common/positionUtils.d.ts +7 -0
- package/dist/common/positionUtils.js +71 -0
- package/dist/common/positionUtils.js.map +1 -0
- package/dist/common/progressReporter.d.ts +15 -0
- package/dist/common/progressReporter.js +44 -0
- package/dist/common/progressReporter.js.map +1 -0
- package/dist/common/pythonVersion.d.ts +20 -0
- package/dist/common/pythonVersion.js +71 -0
- package/dist/common/pythonVersion.js.map +1 -0
- package/dist/common/realFileSystem.d.ts +8 -0
- package/dist/common/realFileSystem.js +368 -0
- package/dist/common/realFileSystem.js.map +1 -0
- package/dist/common/stringUtils.d.ts +47 -0
- package/dist/common/stringUtils.js +160 -0
- package/dist/common/stringUtils.js.map +1 -0
- package/dist/common/textEditUtils.d.ts +3 -0
- package/dist/common/textEditUtils.js +29 -0
- package/dist/common/textEditUtils.js.map +1 -0
- package/dist/common/textRange.d.ts +47 -0
- package/dist/common/textRange.js +211 -0
- package/dist/common/textRange.js.map +1 -0
- package/dist/common/textRangeCollection.d.ts +13 -0
- package/dist/common/textRangeCollection.js +108 -0
- package/dist/common/textRangeCollection.js.map +1 -0
- package/dist/common/timing.d.ts +31 -0
- package/dist/common/timing.js +100 -0
- package/dist/common/timing.js.map +1 -0
- package/dist/common/uriParser.d.ts +12 -0
- package/dist/common/uriParser.js +25 -0
- package/dist/common/uriParser.js.map +1 -0
- package/dist/common/workspaceEditUtils.d.ts +7 -0
- package/dist/common/workspaceEditUtils.js +63 -0
- package/dist/common/workspaceEditUtils.js.map +1 -0
- package/dist/languageServerBase.d.ts +211 -0
- package/dist/languageServerBase.js +923 -0
- package/dist/languageServerBase.js.map +1 -0
- package/dist/languageService/analyzerServiceExecutor.d.ts +8 -0
- package/dist/languageService/analyzerServiceExecutor.js +97 -0
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -0
- package/dist/languageService/autoImporter.d.ts +84 -0
- package/dist/languageService/autoImporter.js +635 -0
- package/dist/languageService/autoImporter.js.map +1 -0
- package/dist/languageService/callHierarchyProvider.d.ts +12 -0
- package/dist/languageService/callHierarchyProvider.js +368 -0
- package/dist/languageService/callHierarchyProvider.js.map +1 -0
- package/dist/languageService/codeActionProvider.d.ts +6 -0
- package/dist/languageService/codeActionProvider.js +53 -0
- package/dist/languageService/codeActionProvider.js.map +1 -0
- package/dist/languageService/completionProvider.d.ts +147 -0
- package/dist/languageService/completionProvider.js +2220 -0
- package/dist/languageService/completionProvider.js.map +1 -0
- package/dist/languageService/definitionProvider.d.ts +17 -0
- package/dist/languageService/definitionProvider.js +206 -0
- package/dist/languageService/definitionProvider.js.map +1 -0
- package/dist/languageService/documentHighlightProvider.d.ts +7 -0
- package/dist/languageService/documentHighlightProvider.js +63 -0
- package/dist/languageService/documentHighlightProvider.js.map +1 -0
- package/dist/languageService/documentSymbolCollector.d.ts +37 -0
- package/dist/languageService/documentSymbolCollector.js +344 -0
- package/dist/languageService/documentSymbolCollector.js.map +1 -0
- package/dist/languageService/documentSymbolProvider.d.ts +37 -0
- package/dist/languageService/documentSymbolProvider.js +308 -0
- package/dist/languageService/documentSymbolProvider.js.map +1 -0
- package/dist/languageService/hoverProvider.d.ts +25 -0
- package/dist/languageService/hoverProvider.js +366 -0
- package/dist/languageService/hoverProvider.js.map +1 -0
- package/dist/languageService/importAdder.d.ts +24 -0
- package/dist/languageService/importAdder.js +296 -0
- package/dist/languageService/importAdder.js.map +1 -0
- package/dist/languageService/importSorter.d.ts +15 -0
- package/dist/languageService/importSorter.js +152 -0
- package/dist/languageService/importSorter.js.map +1 -0
- package/dist/languageService/indentationUtils.d.ts +4 -0
- package/dist/languageService/indentationUtils.js +597 -0
- package/dist/languageService/indentationUtils.js.map +1 -0
- package/dist/languageService/quickActions.d.ts +4 -0
- package/dist/languageService/quickActions.js +97 -0
- package/dist/languageService/quickActions.js.map +1 -0
- package/dist/languageService/referencesProvider.d.ts +36 -0
- package/dist/languageService/referencesProvider.js +236 -0
- package/dist/languageService/referencesProvider.js.map +1 -0
- package/dist/languageService/renameModuleProvider.d.ts +58 -0
- package/dist/languageService/renameModuleProvider.js +884 -0
- package/dist/languageService/renameModuleProvider.js.map +1 -0
- package/dist/languageService/signatureHelpProvider.d.ts +26 -0
- package/dist/languageService/signatureHelpProvider.js +180 -0
- package/dist/languageService/signatureHelpProvider.js.map +1 -0
- package/dist/languageService/tooltipUtils.d.ts +9 -0
- package/dist/languageService/tooltipUtils.js +129 -0
- package/dist/languageService/tooltipUtils.js.map +1 -0
- package/dist/localization/localize.d.ts +1324 -0
- package/dist/localization/localize.js +788 -0
- package/dist/localization/localize.js.map +1 -0
- package/dist/localization/package.nls.de.json +1 -0
- package/dist/localization/package.nls.en-us.json +636 -0
- package/dist/localization/package.nls.es.json +1 -0
- package/dist/localization/package.nls.fr.json +1 -0
- package/dist/localization/package.nls.ja.json +1 -0
- package/dist/localization/package.nls.ru.json +1 -0
- package/dist/localization/package.nls.zh-cn.json +1 -0
- package/dist/localization/package.nls.zh-tw.json +1 -0
- package/dist/nodeMain.d.ts +1 -0
- package/dist/nodeMain.js +21 -0
- package/dist/nodeMain.js.map +1 -0
- package/dist/nodeServer.d.ts +3 -0
- package/dist/nodeServer.js +31 -0
- package/dist/nodeServer.js.map +1 -0
- package/dist/parser/characterStream.d.ts +27 -0
- package/dist/parser/characterStream.js +120 -0
- package/dist/parser/characterStream.js.map +1 -0
- package/dist/parser/characters.d.ts +17 -0
- package/dist/parser/characters.js +240 -0
- package/dist/parser/characters.js.map +1 -0
- package/dist/parser/parseNodes.d.ts +750 -0
- package/dist/parser/parseNodes.js +1406 -0
- package/dist/parser/parseNodes.js.map +1 -0
- package/dist/parser/parser.d.ts +191 -0
- package/dist/parser/parser.js +3806 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/stringTokenUtils.d.ts +25 -0
- package/dist/parser/stringTokenUtils.js +455 -0
- package/dist/parser/stringTokenUtils.js.map +1 -0
- package/dist/parser/tokenizer.d.ts +71 -0
- package/dist/parser/tokenizer.js +1111 -0
- package/dist/parser/tokenizer.js.map +1 -0
- package/dist/parser/tokenizerTypes.d.ts +223 -0
- package/dist/parser/tokenizerTypes.js +164 -0
- package/dist/parser/tokenizerTypes.js.map +1 -0
- package/dist/parser/unicode.d.ts +23 -0
- package/dist/parser/unicode.js +2899 -0
- package/dist/parser/unicode.js.map +1 -0
- package/dist/pyright.d.ts +1 -0
- package/dist/pyright.js +645 -0
- package/dist/pyright.js.map +1 -0
- package/dist/pyrightFileSystem.d.ts +28 -0
- package/dist/pyrightFileSystem.js +196 -0
- package/dist/pyrightFileSystem.js.map +1 -0
- package/dist/readonlyAugmentedFileSystem.d.ts +40 -0
- package/dist/readonlyAugmentedFileSystem.js +155 -0
- package/dist/readonlyAugmentedFileSystem.js.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.js +232 -0
- package/dist/server.js.map +1 -0
- package/dist/tests/chainedSourceFiles.test.d.ts +1 -0
- package/dist/tests/chainedSourceFiles.test.js +153 -0
- package/dist/tests/chainedSourceFiles.test.js.map +1 -0
- package/dist/tests/checker.test.d.ts +1 -0
- package/dist/tests/checker.test.js +346 -0
- package/dist/tests/checker.test.js.map +1 -0
- package/dist/tests/collectionUtils.test.d.ts +1 -0
- package/dist/tests/collectionUtils.test.js +153 -0
- package/dist/tests/collectionUtils.test.js.map +1 -0
- package/dist/tests/common.test.d.ts +1 -0
- package/dist/tests/common.test.js +125 -0
- package/dist/tests/common.test.js.map +1 -0
- package/dist/tests/config.test.d.ts +1 -0
- package/dist/tests/config.test.js +230 -0
- package/dist/tests/config.test.js.map +1 -0
- package/dist/tests/debug.test.d.ts +1 -0
- package/dist/tests/debug.test.js +102 -0
- package/dist/tests/debug.test.js.map +1 -0
- package/dist/tests/deferred.test.d.ts +1 -0
- package/dist/tests/deferred.test.js +65 -0
- package/dist/tests/deferred.test.js.map +1 -0
- package/dist/tests/diagnosticOverrides.test.d.ts +1 -0
- package/dist/tests/diagnosticOverrides.test.js +108 -0
- package/dist/tests/diagnosticOverrides.test.js.map +1 -0
- package/dist/tests/docStringConversion.test.d.ts +1 -0
- package/dist/tests/docStringConversion.test.js +695 -0
- package/dist/tests/docStringConversion.test.js.map +1 -0
- package/dist/tests/docStringUtils.test.d.ts +1 -0
- package/dist/tests/docStringUtils.test.js +70 -0
- package/dist/tests/docStringUtils.test.js.map +1 -0
- package/dist/tests/documentSymbolCollector.test.d.ts +1 -0
- package/dist/tests/documentSymbolCollector.test.js +635 -0
- package/dist/tests/documentSymbolCollector.test.js.map +1 -0
- package/dist/tests/filesystem.test.d.ts +1 -0
- package/dist/tests/filesystem.test.js +194 -0
- package/dist/tests/filesystem.test.js.map +1 -0
- package/dist/tests/fourSlashParser.test.d.ts +1 -0
- package/dist/tests/fourSlashParser.test.js +281 -0
- package/dist/tests/fourSlashParser.test.js.map +1 -0
- package/dist/tests/fourSlashRunner.test.d.ts +1 -0
- package/dist/tests/fourSlashRunner.test.js +52 -0
- package/dist/tests/fourSlashRunner.test.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js +30 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.Type.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js +42 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.Found.duplication.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.js +13 -0
- package/dist/tests/fourslash/completions.autoimport.Lib.NotFound.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.js +23 -0
- package/dist/tests/fourslash/completions.autoimport.disabled.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js +35 -0
- package/dist/tests/fourslash/completions.autoimport.duplicates.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.fourslash.js +27 -0
- package/dist/tests/fourslash/completions.autoimport.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js +128 -0
- package/dist/tests/fourslash/completions.autoimport.fromImport.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js +27 -0
- package/dist/tests/fourslash/completions.autoimport.plainText.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js +43 -0
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js +29 -0
- package/dist/tests/fourslash/completions.autoimport.submodule.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js +50 -0
- package/dist/tests/fourslash/completions.autoimport.topLevel.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js +116 -0
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.builtinOverride.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.builtinOverride.fourslash.js +21 -0
- package/dist/tests/fourslash/completions.builtinOverride.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js +54 -0
- package/dist/tests/fourslash/completions.call.stringLiteral.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.js +245 -0
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js +162 -0
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js +132 -0
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.classVariable.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.classVariable.fourslash.js +37 -0
- package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.comment.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.comment.fourslash.js +27 -0
- package/dist/tests/fourslash/completions.comment.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.class.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.class.fourslash.js +30 -0
- package/dist/tests/fourslash/completions.declNames.class.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.exception.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.exception.fourslash.js +18 -0
- package/dist/tests/fourslash/completions.declNames.exception.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.for.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.for.fourslash.js +26 -0
- package/dist/tests/fourslash/completions.declNames.for.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.js +15 -0
- package/dist/tests/fourslash/completions.declNames.importAlias.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.lambda.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js +36 -0
- package/dist/tests/fourslash/completions.declNames.lambda.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.method.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.method.fourslash.js +68 -0
- package/dist/tests/fourslash/completions.declNames.method.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.overload.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.overload.fourslash.js +147 -0
- package/dist/tests/fourslash/completions.declNames.overload.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js +131 -0
- package/dist/tests/fourslash/completions.declNames.topLevelOverload.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js +73 -0
- package/dist/tests/fourslash/completions.dictionary.keys.complex.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js +58 -0
- package/dist/tests/fourslash/completions.dictionary.keys.expression.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js +154 -0
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js +143 -0
- package/dist/tests/fourslash/completions.dictionary.keys.simple.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js +109 -0
- package/dist/tests/fourslash/completions.dictionary.keys.stringLiterals.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js +50 -0
- package/dist/tests/fourslash/completions.dictionary.keys.symbols.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.enums.members.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.enums.members.fourslash.js +44 -0
- package/dist/tests/fourslash/completions.enums.members.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.excluded.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.excluded.fourslash.js +12 -0
- package/dist/tests/fourslash/completions.excluded.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.fourslash.js +51 -0
- package/dist/tests/fourslash/completions.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fstring.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.fstring.fourslash.js +32 -0
- package/dist/tests/fourslash/completions.fstring.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js +96 -0
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.js +30 -0
- package/dist/tests/fourslash/completions.fuzzyMatching.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.importDunderNames.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.importDunderNames.fourslash.js +29 -0
- package/dist/tests/fourslash/completions.importDunderNames.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.importSubmodule.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.importSubmodule.fourslash.js +22 -0
- package/dist/tests/fourslash/completions.importSubmodule.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.importsDuplicates.fourslash.d.ts +0 -0
- package/dist/tests/fourslash/completions.importsDuplicates.fourslash.js +22 -0
- package/dist/tests/fourslash/completions.importsDuplicates.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inList.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inList.fourslash.js +32 -0
- package/dist/tests/fourslash/completions.inList.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.included.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.included.fourslash.js +12 -0
- package/dist/tests/fourslash/completions.included.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js +54 -0
- package/dist/tests/fourslash/completions.indexer.keys.getitem.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.js +26 -0
- package/dist/tests/fourslash/completions.inherited.function.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js +49 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromScrWithStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js +50 -0
- package/dist/tests/fourslash/completions.inherited.overload.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.js +101 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromSrc.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.js +105 -0
- package/dist/tests/fourslash/completions.inherited.property.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js +67 -0
- package/dist/tests/fourslash/completions.keywords.pythonVersion.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js +75 -0
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js +66 -0
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.libStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.libStub.fourslash.js +66 -0
- package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.literals.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.literals.fourslash.js +31 -0
- package/dist/tests/fourslash/completions.literals.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.localCode.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.localCode.fourslash.js +71 -0
- package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.js +17 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownMemberOnInstance.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.js +57 -0
- package/dist/tests/fourslash/completions.moduleContext.UnknownStaticFunctionOnClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.js +27 -0
- package/dist/tests/fourslash/completions.moduleContext.libCodeNoStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.overloads.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.overloads.fourslash.js +37 -0
- package/dist/tests/fourslash/completions.overloads.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.default.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.default.fourslash.js +47 -0
- package/dist/tests/fourslash/completions.override.default.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.default.importStub.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.default.importStub.js +49 -0
- package/dist/tests/fourslash/completions.override.default.importStub.js.map +1 -0
- package/dist/tests/fourslash/completions.override.default.imported.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.default.imported.fourslash.js +60 -0
- package/dist/tests/fourslash/completions.override.default.imported.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.default.stub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.default.stub.fourslash.js +47 -0
- package/dist/tests/fourslash/completions.override.default.stub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.fourslash.js +47 -0
- package/dist/tests/fourslash/completions.override.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.property.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.property.fourslash.js +31 -0
- package/dist/tests/fourslash/completions.override.property.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.property.stub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.property.stub.fourslash.js +31 -0
- package/dist/tests/fourslash/completions.override.property.stub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js +63 -0
- package/dist/tests/fourslash/completions.override.staticAndClassmethod.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override.stub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override.stub.fourslash.js +47 -0
- package/dist/tests/fourslash/completions.override.stub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.override2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.override2.fourslash.js +66 -0
- package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.parameters.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.parameters.fourslash.js +22 -0
- package/dist/tests/fourslash/completions.parameters.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.params.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.params.fourslash.js +23 -0
- package/dist/tests/fourslash/completions.params.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.parentFolder.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.parentFolder.fourslash.js +15 -0
- package/dist/tests/fourslash/completions.parentFolder.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.parentFolders.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.parentFolders.fourslash.js +68 -0
- package/dist/tests/fourslash/completions.parentFolders.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.plainText.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.plainText.fourslash.js +34 -0
- package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.private.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.private.fourslash.js +61 -0
- package/dist/tests/fourslash/completions.private.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.property.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.property.fourslash.js +28 -0
- package/dist/tests/fourslash/completions.property.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.js +64 -0
- package/dist/tests/fourslash/completions.propertyDocStrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.self.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.self.fourslash.js +43 -0
- package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js +71 -0
- package/dist/tests/fourslash/completions.stringLiteral.escape.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.js +78 -0
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.typeAlias.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.typeAlias.fourslash.js +29 -0
- package/dist/tests/fourslash/completions.typeAlias.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.typeshed.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.typeshed.fourslash.js +9 -0
- package/dist/tests/fourslash/completions.typeshed.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.vardecls.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.vardecls.fourslash.js +33 -0
- package/dist/tests/fourslash/completions.vardecls.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js +68 -0
- package/dist/tests/fourslash/completions.variableDocStrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.js +109 -0
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.with.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.with.fourslash.js +25 -0
- package/dist/tests/fourslash/completions.with.fourslash.js.map +1 -0
- package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js +64 -0
- package/dist/tests/fourslash/diagnostics.missingModuleSource.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js +24 -0
- package/dist/tests/fourslash/findDefinitions.builtinClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.classes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.classes.fourslash.js +93 -0
- package/dist/tests/fourslash/findDefinitions.classes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js +23 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js +19 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferSource.onlyStubs.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js +23 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js +20 -0
- package/dist/tests/fourslash/findDefinitions.definitionFilter.preferStub.onlySource.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.fields.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.fields.fourslash.js +123 -0
- package/dist/tests/fourslash/findDefinitions.fields.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.functions.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.functions.fourslash.js +79 -0
- package/dist/tests/fourslash/findDefinitions.functions.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.methods.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.methods.fourslash.js +154 -0
- package/dist/tests/fourslash/findDefinitions.methods.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.modules.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.modules.fourslash.js +42 -0
- package/dist/tests/fourslash/findDefinitions.modules.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js +34 -0
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.overloads.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js +213 -0
- package/dist/tests/fourslash/findDefinitions.overloads.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.parameters.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js +154 -0
- package/dist/tests/fourslash/findDefinitions.parameters.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js +23 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.function.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js +29 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js +30 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.innerClassMethod.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js +25 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js +26 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassMethod.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js +28 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadOnly.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js +33 -0
- package/dist/tests/fourslash/findDefinitions.sourceAndStub.outerClassPropertyReadWrite.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js +26 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.class.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js +25 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function1.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js +25 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.function2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js +20 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport1.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js +20 -0
- package/dist/tests/fourslash/findDefinitions.sourceOnly.relativeImport2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js +59 -0
- package/dist/tests/fourslash/findDefinitions.stubOnly.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js +59 -0
- package/dist/tests/fourslash/findDefinitions.stubPackages.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js +94 -0
- package/dist/tests/fourslash/findDefinitions.typedDict.keys.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.variables.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.variables.fourslash.js +79 -0
- package/dist/tests/fourslash/findDefinitions.variables.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js +106 -0
- package/dist/tests/fourslash/findDefinitions.wildcardimports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js +24 -0
- package/dist/tests/fourslash/findTypeDefinitions.builtinClass.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js +66 -0
- package/dist/tests/fourslash/findTypeDefinitions.classes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js +26 -0
- package/dist/tests/fourslash/findTypeDefinitions.unions.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js +36 -0
- package/dist/tests/fourslash/findallreferences.classPropertyReadWrite.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.fourslash.js +30 -0
- package/dist/tests/fourslash/findallreferences.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.importalias.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.importalias.fourslash.js +30 -0
- package/dist/tests/fourslash/findallreferences.importalias.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js +46 -0
- package/dist/tests/fourslash/findallreferences.invokedFromLibrary.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.module.nested.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js +60 -0
- package/dist/tests/fourslash/findallreferences.module.nested.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js +54 -0
- package/dist/tests/fourslash/findallreferences.modules.duplicated.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.modules.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.modules.fourslash.js +41 -0
- package/dist/tests/fourslash/findallreferences.modules.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js +83 -0
- package/dist/tests/fourslash/findallreferences.modules.shadow.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.openFiles.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js +32 -0
- package/dist/tests/fourslash/findallreferences.openFiles.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.parameter.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.parameter.fourslash.js +22 -0
- package/dist/tests/fourslash/findallreferences.parameter.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js +29 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.class.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js +33 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classMethod.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js +36 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadOnly.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js +44 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.classPropertyReadWrite.fourslash.skip.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js +31 -0
- package/dist/tests/fourslash/findallreferences.sourceAndStub.function.fourslash.js.map +1 -0
- package/dist/tests/fourslash/findallreferences.variable.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.variable.fourslash.js +22 -0
- package/dist/tests/fourslash/findallreferences.variable.fourslash.js.map +1 -0
- package/dist/tests/fourslash/fourslash.d.ts +301 -0
- package/dist/tests/fourslash/fourslash.js +25 -0
- package/dist/tests/fourslash/fourslash.js.map +1 -0
- package/dist/tests/fourslash/highlightreferences.attributes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js +30 -0
- package/dist/tests/fourslash/highlightreferences.attributes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js +63 -0
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.classNoInit.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.classNoInit.fourslash.js +14 -0
- package/dist/tests/fourslash/hover.classNoInit.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromScr.stringFormat.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromScr.stringFormat.fourslash.js +47 -0
- package/dist/tests/fourslash/hover.docFromScr.stringFormat.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.js +77 -0
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js +22 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js +22 -0
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js +21 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js +20 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js +38 -0
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js +25 -0
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js +18 -0
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docstring.links.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js +12 -0
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docstring.overloads.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docstring.overloads.fourslash.js +38 -0
- package/dist/tests/fourslash/hover.docstring.overloads.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docstring.split.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js +24 -0
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.fourslash.js +20 -0
- package/dist/tests/fourslash/hover.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.import.django.view.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.import.django.view.fourslash.js +23 -0
- package/dist/tests/fourslash/hover.import.django.view.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.import.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.import.fourslash.js +10 -0
- package/dist/tests/fourslash/hover.import.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js +61 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js +51 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js +40 -0
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js +43 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromSrcWithStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js +44 -0
- package/dist/tests/fourslash/hover.inherited.overload.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.js +84 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromSrcWithStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.js +88 -0
- package/dist/tests/fourslash/hover.inherited.property.docFromStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.init.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.init.fourslash.js +38 -0
- package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js +49 -0
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js +39 -0
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.libStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.libStub.fourslash.js +39 -0
- package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.js +14 -0
- package/dist/tests/fourslash/hover.optionalAliasParameter.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.plainText.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.plainText.fourslash.js +20 -0
- package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.typedDict.key.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.typedDict.key.fourslash.js +50 -0
- package/dist/tests/fourslash/hover.typedDict.key.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.variable.docString.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js +35 -0
- package/dist/tests/fourslash/hover.variable.docString.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.js +73 -0
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.publicSymbols.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.publicSymbols.fourslash.js +63 -0
- package/dist/tests/fourslash/import.publicSymbols.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.js +72 -0
- package/dist/tests/fourslash/import.pytyped.dunderAll.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.js +61 -0
- package/dist/tests/fourslash/import.pytyped.privateSymbols.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js +35 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js +35 -0
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -0
- package/dist/tests/fourslash/import.wildcard.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/import.wildcard.fourslash.js +24 -0
- package/dist/tests/fourslash/import.wildcard.fourslash.js.map +1 -0
- package/dist/tests/fourslash/importnotresolved.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/importnotresolved.fourslash.js +13 -0
- package/dist/tests/fourslash/importnotresolved.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.js +18 -0
- package/dist/tests/fourslash/missingModuleSource.disablingInStrictMode.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingModuleSource.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingModuleSource.fourslash.js +13 -0
- package/dist/tests/fourslash/missingModuleSource.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js +31 -0
- package/dist/tests/fourslash/missingTypeStub.codeAction.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.d.ts +7 -0
- package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.js +44 -0
- package/dist/tests/fourslash/missingTypeStub.command.multipart.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.d.ts +7 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.js +35 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlefile.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.d.ts +7 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.js +35 -0
- package/dist/tests/fourslash/missingTypeStub.command.singlepart.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingTypeStub.fourslash.js +18 -0
- package/dist/tests/fourslash/missingTypeStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.js +34 -0
- package/dist/tests/fourslash/missingTypeStub.invokeCodeAction.fourslash.js.map +1 -0
- package/dist/tests/fourslash/noerrors.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/noerrors.fourslash.js +9 -0
- package/dist/tests/fourslash/noerrors.fourslash.js.map +1 -0
- package/dist/tests/fourslash/orderImports1.command.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/orderImports1.command.fourslash.js +17 -0
- package/dist/tests/fourslash/orderImports1.command.fourslash.js.map +1 -0
- package/dist/tests/fourslash/orderImports2.command.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/orderImports2.command.fourslash.js +21 -0
- package/dist/tests/fourslash/orderImports2.command.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js +23 -0
- package/dist/tests/fourslash/rename.externallyHidden.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js +23 -0
- package/dist/tests/fourslash/rename.externallyHidden.params.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.fourslash.js +26 -0
- package/dist/tests/fourslash/rename.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.library.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.library.fourslash.js +26 -0
- package/dist/tests/fourslash/rename.library.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.js +29 -0
- package/dist/tests/fourslash/rename.library.sourceAndStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.multipleDecl.fourslash.d.ts +2 -0
- package/dist/tests/fourslash/rename.multipleDecl.fourslash.js +19 -0
- package/dist/tests/fourslash/rename.multipleDecl.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.sourceAndStub.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js +33 -0
- package/dist/tests/fourslash/rename.sourceAndStub.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.string.excluded.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.string.excluded.fourslash.js +39 -0
- package/dist/tests/fourslash/rename.string.excluded.fourslash.js.map +1 -0
- package/dist/tests/fourslash/rename.string.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/rename.string.fourslash.js +25 -0
- package/dist/tests/fourslash/rename.string.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js +62 -0
- package/dist/tests/fourslash/signature.builtinDocstrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.complicated.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.complicated.fourslash.js +97 -0
- package/dist/tests/fourslash/signature.complicated.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.cornercases.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.cornercases.fourslash.js +22 -0
- package/dist/tests/fourslash/signature.cornercases.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.docstrings.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.docstrings.fourslash.js +42 -0
- package/dist/tests/fourslash/signature.docstrings.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js +49 -0
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js +115 -0
- package/dist/tests/fourslash/signature.docstrings.wildcardimports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.overload.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.overload.fourslash.js +63 -0
- package/dist/tests/fourslash/signature.overload.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.simple.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.simple.fourslash.js +104 -0
- package/dist/tests/fourslash/signature.simple.fourslash.js.map +1 -0
- package/dist/tests/harness/fourslash/fourSlashParser.d.ts +10 -0
- package/dist/tests/harness/fourslash/fourSlashParser.js +347 -0
- package/dist/tests/harness/fourslash/fourSlashParser.js.map +1 -0
- package/dist/tests/harness/fourslash/fourSlashTypes.d.ts +81 -0
- package/dist/tests/harness/fourslash/fourSlashTypes.js +65 -0
- package/dist/tests/harness/fourslash/fourSlashTypes.js.map +1 -0
- package/dist/tests/harness/fourslash/runner.d.ts +20 -0
- package/dist/tests/harness/fourslash/runner.js +93 -0
- package/dist/tests/harness/fourslash/runner.js.map +1 -0
- package/dist/tests/harness/fourslash/testLanguageService.d.ts +40 -0
- package/dist/tests/harness/fourslash/testLanguageService.js +120 -0
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -0
- package/dist/tests/harness/fourslash/testState.Consts.d.ts +11 -0
- package/dist/tests/harness/fourslash/testState.Consts.js +50 -0
- package/dist/tests/harness/fourslash/testState.Consts.js.map +1 -0
- package/dist/tests/harness/fourslash/testState.d.ts +232 -0
- package/dist/tests/harness/fourslash/testState.js +1381 -0
- package/dist/tests/harness/fourslash/testState.js.map +1 -0
- package/dist/tests/harness/testAccessHost.d.ts +8 -0
- package/dist/tests/harness/testAccessHost.js +26 -0
- package/dist/tests/harness/testAccessHost.js.map +1 -0
- package/dist/tests/harness/testHost.d.ts +16 -0
- package/dist/tests/harness/testHost.js +161 -0
- package/dist/tests/harness/testHost.js.map +1 -0
- package/dist/tests/harness/utils.d.ts +74 -0
- package/dist/tests/harness/utils.js +328 -0
- package/dist/tests/harness/utils.js.map +1 -0
- package/dist/tests/harness/vfs/factory.d.ts +32 -0
- package/dist/tests/harness/vfs/factory.js +173 -0
- package/dist/tests/harness/vfs/factory.js.map +1 -0
- package/dist/tests/harness/vfs/filesystem.d.ts +430 -0
- package/dist/tests/harness/vfs/filesystem.js +1455 -0
- package/dist/tests/harness/vfs/filesystem.js.map +1 -0
- package/dist/tests/harness/vfs/pathValidation.d.ts +24 -0
- package/dist/tests/harness/vfs/pathValidation.js +123 -0
- package/dist/tests/harness/vfs/pathValidation.js.map +1 -0
- package/dist/tests/importAdder.test.d.ts +1 -0
- package/dist/tests/importAdder.test.js +1192 -0
- package/dist/tests/importAdder.test.js.map +1 -0
- package/dist/tests/importResolver.test.d.ts +1 -0
- package/dist/tests/importResolver.test.js +450 -0
- package/dist/tests/importResolver.test.js.map +1 -0
- package/dist/tests/importStatementUtils.test.d.ts +1 -0
- package/dist/tests/importStatementUtils.test.js +371 -0
- package/dist/tests/importStatementUtils.test.js.map +1 -0
- package/dist/tests/indentationUtils.ptvs.test.d.ts +1 -0
- package/dist/tests/indentationUtils.ptvs.test.js +324 -0
- package/dist/tests/indentationUtils.ptvs.test.js.map +1 -0
- package/dist/tests/indentationUtils.reindent.test.d.ts +1 -0
- package/dist/tests/indentationUtils.reindent.test.js +332 -0
- package/dist/tests/indentationUtils.reindent.test.js.map +1 -0
- package/dist/tests/indentationUtils.test.d.ts +1 -0
- package/dist/tests/indentationUtils.test.js +375 -0
- package/dist/tests/indentationUtils.test.js.map +1 -0
- package/dist/tests/ipythonMode.test.d.ts +1 -0
- package/dist/tests/ipythonMode.test.js +303 -0
- package/dist/tests/ipythonMode.test.js.map +1 -0
- package/dist/tests/localizer.test.d.ts +1 -0
- package/dist/tests/localizer.test.js +64 -0
- package/dist/tests/localizer.test.js.map +1 -0
- package/dist/tests/parseTreeUtils.test.d.ts +1 -0
- package/dist/tests/parseTreeUtils.test.js +228 -0
- package/dist/tests/parseTreeUtils.test.js.map +1 -0
- package/dist/tests/parser.test.d.ts +1 -0
- package/dist/tests/parser.test.js +101 -0
- package/dist/tests/parser.test.js.map +1 -0
- package/dist/tests/pathUtils.test.d.ts +1 -0
- package/dist/tests/pathUtils.test.js +253 -0
- package/dist/tests/pathUtils.test.js.map +1 -0
- package/dist/tests/pyrightFileSystem.test.d.ts +1 -0
- package/dist/tests/pyrightFileSystem.test.js +152 -0
- package/dist/tests/pyrightFileSystem.test.js.map +1 -0
- package/dist/tests/renameModule.folder.test.d.ts +1 -0
- package/dist/tests/renameModule.folder.test.js +229 -0
- package/dist/tests/renameModule.folder.test.js.map +1 -0
- package/dist/tests/renameModule.fromImports.test.d.ts +1 -0
- package/dist/tests/renameModule.fromImports.test.js +790 -0
- package/dist/tests/renameModule.fromImports.test.js.map +1 -0
- package/dist/tests/renameModule.imports.test.d.ts +1 -0
- package/dist/tests/renameModule.imports.test.js +380 -0
- package/dist/tests/renameModule.imports.test.js.map +1 -0
- package/dist/tests/renameModule.misc.test.d.ts +1 -0
- package/dist/tests/renameModule.misc.test.js +615 -0
- package/dist/tests/renameModule.misc.test.js.map +1 -0
- package/dist/tests/renameModule.relativePath.test.d.ts +1 -0
- package/dist/tests/renameModule.relativePath.test.js +231 -0
- package/dist/tests/renameModule.relativePath.test.js.map +1 -0
- package/dist/tests/renameModuleTestUtils.d.ts +4 -0
- package/dist/tests/renameModuleTestUtils.js +148 -0
- package/dist/tests/renameModuleTestUtils.js.map +1 -0
- package/dist/tests/sourceFile.test.d.ts +1 -0
- package/dist/tests/sourceFile.test.js +25 -0
- package/dist/tests/sourceFile.test.js.map +1 -0
- package/dist/tests/stringUtils.test.d.ts +1 -0
- package/dist/tests/stringUtils.test.js +69 -0
- package/dist/tests/stringUtils.test.js.map +1 -0
- package/dist/tests/symbolNameUtils.test.d.ts +1 -0
- package/dist/tests/symbolNameUtils.test.js +83 -0
- package/dist/tests/symbolNameUtils.test.js.map +1 -0
- package/dist/tests/testState.test.d.ts +1 -0
- package/dist/tests/testState.test.js +521 -0
- package/dist/tests/testState.test.js.map +1 -0
- package/dist/tests/testUtils.d.ts +27 -0
- package/dist/tests/testUtils.js +213 -0
- package/dist/tests/testUtils.js.map +1 -0
- package/dist/tests/tokenizer.test.d.ts +1 -0
- package/dist/tests/tokenizer.test.js +1277 -0
- package/dist/tests/tokenizer.test.js.map +1 -0
- package/dist/tests/typeEvaluator1.test.d.ts +1 -0
- package/dist/tests/typeEvaluator1.test.js +1023 -0
- package/dist/tests/typeEvaluator1.test.js.map +1 -0
- package/dist/tests/typeEvaluator2.test.d.ts +1 -0
- package/dist/tests/typeEvaluator2.test.js +869 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -0
- package/dist/tests/typeEvaluator3.test.d.ts +1 -0
- package/dist/tests/typeEvaluator3.test.js +915 -0
- package/dist/tests/typeEvaluator3.test.js.map +1 -0
- package/dist/tests/typeEvaluator4.test.d.ts +1 -0
- package/dist/tests/typeEvaluator4.test.js +901 -0
- package/dist/tests/typeEvaluator4.test.js.map +1 -0
- package/dist/tests/updateSymbolReference.test.d.ts +1 -0
- package/dist/tests/updateSymbolReference.test.js +980 -0
- package/dist/tests/updateSymbolReference.test.js.map +1 -0
- package/dist/tests/zipfs.test.d.ts +1 -0
- package/dist/tests/zipfs.test.js +112 -0
- package/dist/tests/zipfs.test.js.map +1 -0
- package/dist/workspaceMap.d.ts +6 -0
- package/dist/workspaceMap.js +73 -0
- package/dist/workspaceMap.js.map +1 -0
- package/package.json +45 -0
@@ -0,0 +1,1902 @@
|
|
1
|
+
"use strict";
|
2
|
+
/*
|
3
|
+
* program.ts
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
5
|
+
* Licensed under the MIT license.
|
6
|
+
* Author: Eric Traut
|
7
|
+
*
|
8
|
+
* An object that tracks all of the source files being analyzed
|
9
|
+
* and all of their recursive imports.
|
10
|
+
*/
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
12
|
+
if (k2 === undefined) k2 = k;
|
13
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
14
|
+
}) : (function(o, m, k, k2) {
|
15
|
+
if (k2 === undefined) k2 = k;
|
16
|
+
o[k2] = m[k];
|
17
|
+
}));
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
20
|
+
}) : function(o, v) {
|
21
|
+
o["default"] = v;
|
22
|
+
});
|
23
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
24
|
+
if (mod && mod.__esModule) return mod;
|
25
|
+
var result = {};
|
26
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
27
|
+
__setModuleDefault(result, mod);
|
28
|
+
return result;
|
29
|
+
};
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
31
|
+
exports.Program = exports.MaxWorkspaceIndexFileCount = void 0;
|
32
|
+
const v8_1 = require("v8");
|
33
|
+
const vscode_languageserver_1 = require("vscode-languageserver");
|
34
|
+
const vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
35
|
+
const cancellationUtils_1 = require("../common/cancellationUtils");
|
36
|
+
const collectionUtils_1 = require("../common/collectionUtils");
|
37
|
+
const console_1 = require("../common/console");
|
38
|
+
const debug_1 = require("../common/debug");
|
39
|
+
const logTracker_1 = require("../common/logTracker");
|
40
|
+
const pathUtils_1 = require("../common/pathUtils");
|
41
|
+
const positionUtils_1 = require("../common/positionUtils");
|
42
|
+
const stringUtils_1 = require("../common/stringUtils");
|
43
|
+
const textRange_1 = require("../common/textRange");
|
44
|
+
const timing_1 = require("../common/timing");
|
45
|
+
const autoImporter_1 = require("../languageService/autoImporter");
|
46
|
+
const callHierarchyProvider_1 = require("../languageService/callHierarchyProvider");
|
47
|
+
const completionProvider_1 = require("../languageService/completionProvider");
|
48
|
+
const documentSymbolCollector_1 = require("../languageService/documentSymbolCollector");
|
49
|
+
const referencesProvider_1 = require("../languageService/referencesProvider");
|
50
|
+
const renameModuleProvider_1 = require("../languageService/renameModuleProvider");
|
51
|
+
const AnalyzerNodeInfo = __importStar(require("./analyzerNodeInfo"));
|
52
|
+
const circularDependency_1 = require("./circularDependency");
|
53
|
+
const parseTreeUtils_1 = require("./parseTreeUtils");
|
54
|
+
const scopeUtils_1 = require("./scopeUtils");
|
55
|
+
const sourceFile_1 = require("./sourceFile");
|
56
|
+
const sourceMapper_1 = require("./sourceMapper");
|
57
|
+
const symbolNameUtils_1 = require("./symbolNameUtils");
|
58
|
+
const tracePrinter_1 = require("./tracePrinter");
|
59
|
+
const typeEvaluatorWithTracker_1 = require("./typeEvaluatorWithTracker");
|
60
|
+
const typeStubWriter_1 = require("./typeStubWriter");
|
61
|
+
const _maxImportDepth = 256;
|
62
|
+
exports.MaxWorkspaceIndexFileCount = 2000;
|
63
|
+
// Container for all of the files that are being analyzed. Files
|
64
|
+
// can fall into one or more of the following categories:
|
65
|
+
// Tracked - specified by the config options
|
66
|
+
// Referenced - part of the transitive closure
|
67
|
+
// Opened - temporarily opened in the editor
|
68
|
+
// Shadowed - implementation file that shadows a type stub file
|
69
|
+
class Program {
|
70
|
+
constructor(initialImportResolver, initialConfigOptions, console, _extension, logTracker, _disableChecker) {
|
71
|
+
this._extension = _extension;
|
72
|
+
this._disableChecker = _disableChecker;
|
73
|
+
this._sourceFileList = [];
|
74
|
+
this._sourceFileMap = new Map();
|
75
|
+
this._parsedFileCount = 0;
|
76
|
+
this._lookUpImport = (filePathOrModule) => {
|
77
|
+
var _a;
|
78
|
+
let sourceFileInfo;
|
79
|
+
if (typeof filePathOrModule === 'string') {
|
80
|
+
sourceFileInfo = this._getSourceFileInfoFromPath(filePathOrModule);
|
81
|
+
}
|
82
|
+
else {
|
83
|
+
// Resolve the import.
|
84
|
+
const importResult = this._importResolver.resolveImport(filePathOrModule.importingFilePath, this._configOptions.findExecEnvironment(filePathOrModule.importingFilePath), {
|
85
|
+
leadingDots: 0,
|
86
|
+
nameParts: filePathOrModule.nameParts,
|
87
|
+
importedSymbols: undefined,
|
88
|
+
});
|
89
|
+
if (importResult.isImportFound && !importResult.isNativeLib && importResult.resolvedPaths.length > 0) {
|
90
|
+
let resolvedPath = importResult.resolvedPaths[importResult.resolvedPaths.length - 1];
|
91
|
+
if (resolvedPath) {
|
92
|
+
// See if the source file already exists in the program.
|
93
|
+
sourceFileInfo = this._getSourceFileInfoFromPath(resolvedPath);
|
94
|
+
if (!sourceFileInfo) {
|
95
|
+
resolvedPath = (0, pathUtils_1.normalizePathCase)(this._fs, resolvedPath);
|
96
|
+
// Start tracking the source file.
|
97
|
+
this.addTrackedFile(resolvedPath);
|
98
|
+
sourceFileInfo = this._getSourceFileInfoFromPath(resolvedPath);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
if (!sourceFileInfo) {
|
104
|
+
return undefined;
|
105
|
+
}
|
106
|
+
if (sourceFileInfo.sourceFile.isBindingRequired()) {
|
107
|
+
// Bind the file if it's not already bound. Don't count this time
|
108
|
+
// against the type checker.
|
109
|
+
timing_1.timingStats.typeCheckerTime.subtractFromTime(() => {
|
110
|
+
this._bindFile(sourceFileInfo);
|
111
|
+
});
|
112
|
+
}
|
113
|
+
const symbolTable = sourceFileInfo.sourceFile.getModuleSymbolTable();
|
114
|
+
if (!symbolTable) {
|
115
|
+
return undefined;
|
116
|
+
}
|
117
|
+
const parseResults = sourceFileInfo.sourceFile.getParseResults();
|
118
|
+
const moduleNode = parseResults.parseTree;
|
119
|
+
const dunderAllInfo = AnalyzerNodeInfo.getDunderAllInfo(parseResults.parseTree);
|
120
|
+
return {
|
121
|
+
symbolTable,
|
122
|
+
dunderAllNames: dunderAllInfo === null || dunderAllInfo === void 0 ? void 0 : dunderAllInfo.names,
|
123
|
+
usesUnsupportedDunderAllForm: (_a = dunderAllInfo === null || dunderAllInfo === void 0 ? void 0 : dunderAllInfo.usesUnsupportedDunderAllForm) !== null && _a !== void 0 ? _a : false,
|
124
|
+
get docString() {
|
125
|
+
return (0, parseTreeUtils_1.getDocString)(moduleNode.statements);
|
126
|
+
},
|
127
|
+
};
|
128
|
+
};
|
129
|
+
this._console = console || new console_1.StandardConsole();
|
130
|
+
this._logTracker = logTracker !== null && logTracker !== void 0 ? logTracker : new logTracker_1.LogTracker(console, 'FG');
|
131
|
+
this._importResolver = initialImportResolver;
|
132
|
+
this._configOptions = initialConfigOptions;
|
133
|
+
this._createNewEvaluator();
|
134
|
+
}
|
135
|
+
get evaluator() {
|
136
|
+
return this._evaluator;
|
137
|
+
}
|
138
|
+
setConfigOptions(configOptions) {
|
139
|
+
this._configOptions = configOptions;
|
140
|
+
// Create a new evaluator with the updated config options.
|
141
|
+
this._createNewEvaluator();
|
142
|
+
}
|
143
|
+
setImportResolver(importResolver) {
|
144
|
+
this._importResolver = importResolver;
|
145
|
+
// Create a new evaluator with the updated import resolver.
|
146
|
+
// Otherwise, lookup import passed to type evaluator might use
|
147
|
+
// older import resolver when resolving imports after parsing.
|
148
|
+
this._createNewEvaluator();
|
149
|
+
}
|
150
|
+
// Sets the list of tracked files that make up the program.
|
151
|
+
setTrackedFiles(filePaths) {
|
152
|
+
if (this._sourceFileList.length > 0) {
|
153
|
+
// We need to determine which files to remove from the existing file list.
|
154
|
+
const newFileMap = new Map();
|
155
|
+
filePaths.forEach((path) => {
|
156
|
+
newFileMap.set((0, pathUtils_1.normalizePathCase)(this._fs, path), path);
|
157
|
+
});
|
158
|
+
// Files that are not in the tracked file list are
|
159
|
+
// marked as no longer tracked.
|
160
|
+
this._sourceFileList.forEach((oldFile) => {
|
161
|
+
const filePath = (0, pathUtils_1.normalizePathCase)(this._fs, oldFile.sourceFile.getFilePath());
|
162
|
+
if (!newFileMap.has(filePath)) {
|
163
|
+
oldFile.isTracked = false;
|
164
|
+
}
|
165
|
+
});
|
166
|
+
}
|
167
|
+
// Add the new files. Only the new items will be added.
|
168
|
+
this.addTrackedFiles(filePaths);
|
169
|
+
return this._removeUnneededFiles();
|
170
|
+
}
|
171
|
+
// Allows a caller to set a callback that is called right before
|
172
|
+
// a source file is type checked. It is intended for testing only.
|
173
|
+
setPreCheckCallback(preCheckCallback) {
|
174
|
+
this._preCheckCallback = preCheckCallback;
|
175
|
+
}
|
176
|
+
// By default, no third-party imports are allowed. This enables
|
177
|
+
// third-party imports for a specified import and its children.
|
178
|
+
// For example, if importNames is ['tensorflow'], then third-party
|
179
|
+
// (absolute) imports are allowed for 'import tensorflow',
|
180
|
+
// 'import tensorflow.optimizers', etc.
|
181
|
+
setAllowedThirdPartyImports(importNames) {
|
182
|
+
this._allowedThirdPartyImports = importNames;
|
183
|
+
}
|
184
|
+
addTrackedFiles(filePaths, isThirdPartyImport = false, isInPyTypedPackage = false) {
|
185
|
+
filePaths.forEach((filePath) => {
|
186
|
+
this.addTrackedFile(filePath, isThirdPartyImport, isInPyTypedPackage);
|
187
|
+
});
|
188
|
+
}
|
189
|
+
addTrackedFile(filePath, isThirdPartyImport = false, isInPyTypedPackage = false) {
|
190
|
+
let sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
191
|
+
if (sourceFileInfo) {
|
192
|
+
sourceFileInfo.isTracked = true;
|
193
|
+
return sourceFileInfo.sourceFile;
|
194
|
+
}
|
195
|
+
const importName = this._getImportNameForFile(filePath);
|
196
|
+
const sourceFile = new sourceFile_1.SourceFile(this._fs, filePath, importName, isThirdPartyImport, isInPyTypedPackage, this._console, this._logTracker);
|
197
|
+
sourceFileInfo = {
|
198
|
+
sourceFile,
|
199
|
+
isTracked: true,
|
200
|
+
isOpenByClient: false,
|
201
|
+
isTypeshedFile: false,
|
202
|
+
isThirdPartyImport,
|
203
|
+
isThirdPartyPyTypedPresent: isInPyTypedPackage,
|
204
|
+
diagnosticsVersion: undefined,
|
205
|
+
imports: [],
|
206
|
+
importedBy: [],
|
207
|
+
shadows: [],
|
208
|
+
shadowedBy: [],
|
209
|
+
};
|
210
|
+
this._addToSourceFileListAndMap(sourceFileInfo);
|
211
|
+
return sourceFile;
|
212
|
+
}
|
213
|
+
setFileOpened(filePath, version, contents, options) {
|
214
|
+
var _a, _b;
|
215
|
+
let sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
216
|
+
if (!sourceFileInfo) {
|
217
|
+
const importName = this._getImportNameForFile(filePath);
|
218
|
+
const sourceFile = new sourceFile_1.SourceFile(this._fs, filePath, importName,
|
219
|
+
/* isThirdPartyImport */ false,
|
220
|
+
/* isInPyTypedPackage */ false, this._console, this._logTracker, (_a = options === null || options === void 0 ? void 0 : options.ipythonMode) !== null && _a !== void 0 ? _a : false);
|
221
|
+
const chainedFilePath = options === null || options === void 0 ? void 0 : options.chainedFilePath;
|
222
|
+
sourceFileInfo = {
|
223
|
+
sourceFile,
|
224
|
+
isTracked: (_b = options === null || options === void 0 ? void 0 : options.isTracked) !== null && _b !== void 0 ? _b : false,
|
225
|
+
chainedSourceFile: chainedFilePath ? this._getSourceFileInfoFromPath(chainedFilePath) : undefined,
|
226
|
+
isOpenByClient: true,
|
227
|
+
isTypeshedFile: false,
|
228
|
+
isThirdPartyImport: false,
|
229
|
+
isThirdPartyPyTypedPresent: false,
|
230
|
+
diagnosticsVersion: undefined,
|
231
|
+
imports: [],
|
232
|
+
importedBy: [],
|
233
|
+
shadows: [],
|
234
|
+
shadowedBy: [],
|
235
|
+
};
|
236
|
+
this._addToSourceFileListAndMap(sourceFileInfo);
|
237
|
+
}
|
238
|
+
else {
|
239
|
+
sourceFileInfo.isOpenByClient = true;
|
240
|
+
// Reset the diagnostic version so we force an update to the
|
241
|
+
// diagnostics, which can change based on whether the file is open.
|
242
|
+
// We do not set the version to undefined here because that implies
|
243
|
+
// there are no diagnostics currently reported for this file.
|
244
|
+
sourceFileInfo.diagnosticsVersion = 0;
|
245
|
+
}
|
246
|
+
sourceFileInfo.sourceFile.setClientVersion(version, contents);
|
247
|
+
}
|
248
|
+
updateChainedFilePath(filePath, chainedFilePath) {
|
249
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
250
|
+
if (sourceFileInfo) {
|
251
|
+
sourceFileInfo.chainedSourceFile = chainedFilePath
|
252
|
+
? this._getSourceFileInfoFromPath(chainedFilePath)
|
253
|
+
: undefined;
|
254
|
+
sourceFileInfo.sourceFile.markDirty();
|
255
|
+
this._markFileDirtyRecursive(sourceFileInfo, new Map());
|
256
|
+
}
|
257
|
+
}
|
258
|
+
setFileClosed(filePath) {
|
259
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
260
|
+
if (sourceFileInfo) {
|
261
|
+
sourceFileInfo.isOpenByClient = false;
|
262
|
+
sourceFileInfo.sourceFile.setClientVersion(null, []);
|
263
|
+
// There is no guarantee that content is saved before the file is closed.
|
264
|
+
// We need to mark the file dirty so we can re-analyze next time.
|
265
|
+
// This won't matter much for OpenFileOnly users, but it will matter for
|
266
|
+
// people who use diagnosticMode Workspace.
|
267
|
+
if (sourceFileInfo.sourceFile.didContentsChangeOnDisk()) {
|
268
|
+
sourceFileInfo.sourceFile.markDirty();
|
269
|
+
this._markFileDirtyRecursive(sourceFileInfo, new Map());
|
270
|
+
}
|
271
|
+
}
|
272
|
+
return this._removeUnneededFiles();
|
273
|
+
}
|
274
|
+
markAllFilesDirty(evenIfContentsAreSame, indexingNeeded = true) {
|
275
|
+
const markDirtyMap = new Map();
|
276
|
+
this._sourceFileList.forEach((sourceFileInfo) => {
|
277
|
+
if (evenIfContentsAreSame) {
|
278
|
+
sourceFileInfo.sourceFile.markDirty(indexingNeeded);
|
279
|
+
}
|
280
|
+
else if (sourceFileInfo.sourceFile.didContentsChangeOnDisk()) {
|
281
|
+
sourceFileInfo.sourceFile.markDirty(indexingNeeded);
|
282
|
+
// Mark any files that depend on this file as dirty
|
283
|
+
// also. This will retrigger analysis of these other files.
|
284
|
+
this._markFileDirtyRecursive(sourceFileInfo, markDirtyMap);
|
285
|
+
}
|
286
|
+
});
|
287
|
+
if (markDirtyMap.size > 0) {
|
288
|
+
this._createNewEvaluator();
|
289
|
+
}
|
290
|
+
}
|
291
|
+
markFilesDirty(filePaths, evenIfContentsAreSame, indexingNeeded = true) {
|
292
|
+
const markDirtyMap = new Map();
|
293
|
+
filePaths.forEach((filePath) => {
|
294
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
295
|
+
if (sourceFileInfo) {
|
296
|
+
const fileName = (0, pathUtils_1.getFileName)(filePath);
|
297
|
+
// Handle builtins and __builtins__ specially. They are implicitly
|
298
|
+
// included by all source files.
|
299
|
+
if (fileName === 'builtins.pyi' || fileName === '__builtins__.pyi') {
|
300
|
+
this.markAllFilesDirty(evenIfContentsAreSame, indexingNeeded);
|
301
|
+
return;
|
302
|
+
}
|
303
|
+
// If !evenIfContentsAreSame, see if the on-disk contents have
|
304
|
+
// changed. If the file is open, the on-disk contents don't matter
|
305
|
+
// because we'll receive updates directly from the client.
|
306
|
+
if (evenIfContentsAreSame ||
|
307
|
+
(!sourceFileInfo.isOpenByClient && sourceFileInfo.sourceFile.didContentsChangeOnDisk())) {
|
308
|
+
sourceFileInfo.sourceFile.markDirty(indexingNeeded);
|
309
|
+
// Mark any files that depend on this file as dirty
|
310
|
+
// also. This will retrigger analysis of these other files.
|
311
|
+
this._markFileDirtyRecursive(sourceFileInfo, markDirtyMap);
|
312
|
+
}
|
313
|
+
}
|
314
|
+
});
|
315
|
+
if (markDirtyMap.size > 0) {
|
316
|
+
this._createNewEvaluator();
|
317
|
+
}
|
318
|
+
}
|
319
|
+
getFileCount() {
|
320
|
+
return this._sourceFileList.length;
|
321
|
+
}
|
322
|
+
// Returns the number of files that are considered "user" files and therefore
|
323
|
+
// are checked.
|
324
|
+
getUserFileCount() {
|
325
|
+
return this._sourceFileList.filter((s) => this._isUserCode(s)).length;
|
326
|
+
}
|
327
|
+
getTracked() {
|
328
|
+
return this._sourceFileList.filter((s) => s.isTracked);
|
329
|
+
}
|
330
|
+
getOpened() {
|
331
|
+
return this._sourceFileList.filter((s) => s.isOpenByClient);
|
332
|
+
}
|
333
|
+
getFilesToAnalyzeCount() {
|
334
|
+
let sourceFileCount = 0;
|
335
|
+
if (this._disableChecker) {
|
336
|
+
return sourceFileCount;
|
337
|
+
}
|
338
|
+
this._sourceFileList.forEach((fileInfo) => {
|
339
|
+
if (fileInfo.sourceFile.isCheckingRequired()) {
|
340
|
+
if (this._shouldCheckFile(fileInfo)) {
|
341
|
+
sourceFileCount++;
|
342
|
+
}
|
343
|
+
}
|
344
|
+
});
|
345
|
+
return sourceFileCount;
|
346
|
+
}
|
347
|
+
isCheckingOnlyOpenFiles() {
|
348
|
+
return this._configOptions.checkOnlyOpenFiles || false;
|
349
|
+
}
|
350
|
+
containsSourceFileIn(folder) {
|
351
|
+
const normalized = (0, pathUtils_1.normalizePathCase)(this._fs, folder);
|
352
|
+
return this._sourceFileList.some((i) => i.sourceFile.getFilePath().startsWith(normalized));
|
353
|
+
}
|
354
|
+
getSourceFile(filePath) {
|
355
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
356
|
+
if (!sourceFileInfo) {
|
357
|
+
return undefined;
|
358
|
+
}
|
359
|
+
return sourceFileInfo.sourceFile;
|
360
|
+
}
|
361
|
+
getBoundSourceFile(filePath) {
|
362
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
363
|
+
if (!sourceFileInfo) {
|
364
|
+
return undefined;
|
365
|
+
}
|
366
|
+
this._bindFile(sourceFileInfo);
|
367
|
+
return this.getSourceFile(filePath);
|
368
|
+
}
|
369
|
+
// Performs parsing and analysis of any source files in the program
|
370
|
+
// that require it. If a limit time is specified, the operation
|
371
|
+
// is interrupted when the time expires. The return value indicates
|
372
|
+
// whether the method needs to be called again to complete the
|
373
|
+
// analysis. In interactive mode, the timeout is always limited
|
374
|
+
// to the smaller value to maintain responsiveness.
|
375
|
+
analyze(maxTime, token = vscode_languageserver_1.CancellationToken.None) {
|
376
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
377
|
+
const elapsedTime = new timing_1.Duration();
|
378
|
+
const openFiles = this._sourceFileList.filter((sf) => sf.isOpenByClient && sf.sourceFile.isCheckingRequired());
|
379
|
+
if (openFiles.length > 0) {
|
380
|
+
const effectiveMaxTime = maxTime ? maxTime.openFilesTimeInMs : Number.MAX_VALUE;
|
381
|
+
// Check the open files.
|
382
|
+
for (const sourceFileInfo of openFiles) {
|
383
|
+
if (this._checkTypes(sourceFileInfo)) {
|
384
|
+
if (elapsedTime.getDurationInMilliseconds() > effectiveMaxTime) {
|
385
|
+
return true;
|
386
|
+
}
|
387
|
+
}
|
388
|
+
}
|
389
|
+
// If the caller specified a maxTime, return at this point
|
390
|
+
// since we've finalized all open files. We want to get
|
391
|
+
// the results to the user as quickly as possible.
|
392
|
+
if (maxTime !== undefined) {
|
393
|
+
return true;
|
394
|
+
}
|
395
|
+
}
|
396
|
+
if (!this._configOptions.checkOnlyOpenFiles) {
|
397
|
+
const effectiveMaxTime = maxTime ? maxTime.noOpenFilesTimeInMs : Number.MAX_VALUE;
|
398
|
+
// Now do type parsing and analysis of the remaining.
|
399
|
+
for (const sourceFileInfo of this._sourceFileList) {
|
400
|
+
if (!this._isUserCode(sourceFileInfo)) {
|
401
|
+
continue;
|
402
|
+
}
|
403
|
+
if (this._checkTypes(sourceFileInfo)) {
|
404
|
+
if (elapsedTime.getDurationInMilliseconds() > effectiveMaxTime) {
|
405
|
+
return true;
|
406
|
+
}
|
407
|
+
}
|
408
|
+
}
|
409
|
+
}
|
410
|
+
return false;
|
411
|
+
});
|
412
|
+
}
|
413
|
+
indexWorkspace(callback, token) {
|
414
|
+
if (!this._configOptions.indexing) {
|
415
|
+
return 0;
|
416
|
+
}
|
417
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
418
|
+
// Go through all workspace files to create indexing data.
|
419
|
+
// This will cause all files in the workspace to be parsed and bound. But
|
420
|
+
// _handleMemoryHighUsage will make sure we don't OOM and
|
421
|
+
// at the end of this method, we will drop all trees and symbol tables
|
422
|
+
// created due to indexing.
|
423
|
+
const initiallyParsedSet = new Set();
|
424
|
+
for (const sourceFileInfo of this._sourceFileList) {
|
425
|
+
if (!sourceFileInfo.sourceFile.isParseRequired()) {
|
426
|
+
initiallyParsedSet.add(sourceFileInfo);
|
427
|
+
}
|
428
|
+
}
|
429
|
+
let count = 0;
|
430
|
+
for (const sourceFileInfo of this._sourceFileList) {
|
431
|
+
if (!this._isUserCode(sourceFileInfo) || !sourceFileInfo.sourceFile.isIndexingRequired()) {
|
432
|
+
continue;
|
433
|
+
}
|
434
|
+
this._bindFile(sourceFileInfo);
|
435
|
+
const results = sourceFileInfo.sourceFile.index({ indexingForAutoImportMode: false }, token);
|
436
|
+
if (results) {
|
437
|
+
if (++count > exports.MaxWorkspaceIndexFileCount) {
|
438
|
+
this._console.warn(`Workspace indexing has hit its upper limit: 2000 files`);
|
439
|
+
dropParseAndBindInfoCreatedForIndexing(this._sourceFileList, initiallyParsedSet);
|
440
|
+
return count;
|
441
|
+
}
|
442
|
+
callback(sourceFileInfo.sourceFile.getFilePath(), results);
|
443
|
+
}
|
444
|
+
this._handleMemoryHighUsage();
|
445
|
+
}
|
446
|
+
dropParseAndBindInfoCreatedForIndexing(this._sourceFileList, initiallyParsedSet);
|
447
|
+
return count;
|
448
|
+
});
|
449
|
+
function dropParseAndBindInfoCreatedForIndexing(sourceFiles, initiallyParsedSet) {
|
450
|
+
for (const sourceFileInfo of sourceFiles) {
|
451
|
+
if (sourceFileInfo.sourceFile.isParseRequired() || initiallyParsedSet.has(sourceFileInfo)) {
|
452
|
+
continue;
|
453
|
+
}
|
454
|
+
// Drop parse and bind info created during indexing.
|
455
|
+
sourceFileInfo.sourceFile.dropParseAndBindInfo();
|
456
|
+
}
|
457
|
+
}
|
458
|
+
}
|
459
|
+
// Prints a detailed list of files that have been checked and the times associated
|
460
|
+
// with each of them, sorted greatest to least.
|
461
|
+
printDetailedAnalysisTimes() {
|
462
|
+
const sortedFiles = this._sourceFileList
|
463
|
+
.filter((s) => s.sourceFile.getCheckTime() !== undefined)
|
464
|
+
.sort((a, b) => {
|
465
|
+
return b.sourceFile.getCheckTime() - a.sourceFile.getCheckTime();
|
466
|
+
});
|
467
|
+
this._console.info('');
|
468
|
+
this._console.info('Analysis time by file');
|
469
|
+
sortedFiles.forEach((sfInfo) => {
|
470
|
+
const checkTimeInMs = sfInfo.sourceFile.getCheckTime();
|
471
|
+
this._console.info(`${checkTimeInMs}ms: ${sfInfo.sourceFile.getFilePath()}`);
|
472
|
+
});
|
473
|
+
}
|
474
|
+
// Prints import dependency information for each of the files in
|
475
|
+
// the program, skipping any typeshed files.
|
476
|
+
printDependencies(projectRootDir, verbose) {
|
477
|
+
const fs = this._importResolver.fileSystem;
|
478
|
+
const sortedFiles = this._sourceFileList
|
479
|
+
.filter((s) => !s.isTypeshedFile)
|
480
|
+
.sort((a, b) => {
|
481
|
+
return fs.getOriginalFilePath(a.sourceFile.getFilePath()) <
|
482
|
+
fs.getOriginalFilePath(b.sourceFile.getFilePath())
|
483
|
+
? 1
|
484
|
+
: -1;
|
485
|
+
});
|
486
|
+
const zeroImportFiles = [];
|
487
|
+
sortedFiles.forEach((sfInfo) => {
|
488
|
+
this._console.info('');
|
489
|
+
let filePath = fs.getOriginalFilePath(sfInfo.sourceFile.getFilePath());
|
490
|
+
const relPath = (0, pathUtils_1.getRelativePath)(filePath, projectRootDir);
|
491
|
+
if (relPath) {
|
492
|
+
filePath = relPath;
|
493
|
+
}
|
494
|
+
this._console.info(`${filePath}`);
|
495
|
+
this._console.info(` Imports ${sfInfo.imports.length} ` + `file${sfInfo.imports.length === 1 ? '' : 's'}`);
|
496
|
+
if (verbose) {
|
497
|
+
sfInfo.imports.forEach((importInfo) => {
|
498
|
+
this._console.info(` ${fs.getOriginalFilePath(importInfo.sourceFile.getFilePath())}`);
|
499
|
+
});
|
500
|
+
}
|
501
|
+
this._console.info(` Imported by ${sfInfo.importedBy.length} ` + `file${sfInfo.importedBy.length === 1 ? '' : 's'}`);
|
502
|
+
if (verbose) {
|
503
|
+
sfInfo.importedBy.forEach((importInfo) => {
|
504
|
+
this._console.info(` ${fs.getOriginalFilePath(importInfo.sourceFile.getFilePath())}`);
|
505
|
+
});
|
506
|
+
}
|
507
|
+
if (sfInfo.importedBy.length === 0) {
|
508
|
+
zeroImportFiles.push(sfInfo.sourceFile);
|
509
|
+
}
|
510
|
+
});
|
511
|
+
if (zeroImportFiles.length > 0) {
|
512
|
+
this._console.info('');
|
513
|
+
this._console.info(`${zeroImportFiles.length} file${zeroImportFiles.length === 1 ? '' : 's'}` + ` not explicitly imported`);
|
514
|
+
zeroImportFiles.forEach((importFile) => {
|
515
|
+
this._console.info(` ${fs.getOriginalFilePath(importFile.getFilePath())}`);
|
516
|
+
});
|
517
|
+
}
|
518
|
+
}
|
519
|
+
writeTypeStub(targetImportPath, targetIsSingleFile, stubPath, token) {
|
520
|
+
for (const sourceFileInfo of this._sourceFileList) {
|
521
|
+
(0, cancellationUtils_1.throwIfCancellationRequested)(token);
|
522
|
+
const filePath = sourceFileInfo.sourceFile.getFilePath();
|
523
|
+
// Generate type stubs only for the files within the target path,
|
524
|
+
// not any files that the target module happened to import.
|
525
|
+
const relativePath = (0, pathUtils_1.getRelativePath)(filePath, targetImportPath);
|
526
|
+
if (relativePath !== undefined) {
|
527
|
+
let typeStubPath = (0, pathUtils_1.normalizePath)((0, pathUtils_1.combinePaths)(stubPath, relativePath));
|
528
|
+
// If the target is a single file implementation, as opposed to
|
529
|
+
// a package in a directory, transform the name of the type stub
|
530
|
+
// to __init__.pyi because we're placing it in a directory.
|
531
|
+
if (targetIsSingleFile) {
|
532
|
+
typeStubPath = (0, pathUtils_1.combinePaths)((0, pathUtils_1.getDirectoryPath)(typeStubPath), '__init__.pyi');
|
533
|
+
}
|
534
|
+
else {
|
535
|
+
typeStubPath = (0, pathUtils_1.stripFileExtension)(typeStubPath) + '.pyi';
|
536
|
+
}
|
537
|
+
const typeStubDir = (0, pathUtils_1.getDirectoryPath)(typeStubPath);
|
538
|
+
try {
|
539
|
+
(0, pathUtils_1.makeDirectories)(this._fs, typeStubDir, stubPath);
|
540
|
+
}
|
541
|
+
catch (e) {
|
542
|
+
const errMsg = `Could not create directory for '${typeStubDir}'`;
|
543
|
+
throw new Error(errMsg);
|
544
|
+
}
|
545
|
+
this._bindFile(sourceFileInfo);
|
546
|
+
this._runEvaluatorWithCancellationToken(token, () => {
|
547
|
+
const writer = new typeStubWriter_1.TypeStubWriter(typeStubPath, sourceFileInfo.sourceFile, this._evaluator);
|
548
|
+
writer.write();
|
549
|
+
});
|
550
|
+
// This operation can consume significant memory, so check
|
551
|
+
// for situations where we need to discard the type cache.
|
552
|
+
this._handleMemoryHighUsage();
|
553
|
+
}
|
554
|
+
}
|
555
|
+
}
|
556
|
+
getTypeOfSymbol(symbol) {
|
557
|
+
this._handleMemoryHighUsage();
|
558
|
+
const evaluator = this._evaluator || this._createNewEvaluator();
|
559
|
+
return evaluator.getEffectiveTypeOfSymbol(symbol);
|
560
|
+
}
|
561
|
+
printType(type, expandTypeAlias) {
|
562
|
+
this._handleMemoryHighUsage();
|
563
|
+
const evaluator = this._evaluator || this._createNewEvaluator();
|
564
|
+
return evaluator.printType(type, expandTypeAlias);
|
565
|
+
}
|
566
|
+
static _getPrintTypeFlags(configOptions) {
|
567
|
+
let flags = 0 /* None */;
|
568
|
+
if (configOptions.diagnosticRuleSet.printUnknownAsAny) {
|
569
|
+
flags |= 1 /* PrintUnknownWithAny */;
|
570
|
+
}
|
571
|
+
if (configOptions.diagnosticRuleSet.omitConditionalConstraint) {
|
572
|
+
flags |= 64 /* OmitConditionalConstraint */;
|
573
|
+
}
|
574
|
+
if (configOptions.diagnosticRuleSet.omitTypeArgsIfAny) {
|
575
|
+
flags |= 2 /* OmitTypeArgumentsIfAny */;
|
576
|
+
}
|
577
|
+
if (configOptions.diagnosticRuleSet.omitUnannotatedParamType) {
|
578
|
+
flags |= 4 /* OmitUnannotatedParamType */;
|
579
|
+
}
|
580
|
+
if (configOptions.diagnosticRuleSet.pep604Printing) {
|
581
|
+
flags |= 8 /* PEP604 */;
|
582
|
+
}
|
583
|
+
return flags;
|
584
|
+
}
|
585
|
+
get _fs() {
|
586
|
+
return this._importResolver.fileSystem;
|
587
|
+
}
|
588
|
+
_getImportNameForFile(filePath) {
|
589
|
+
const moduleNameAndType = this._importResolver.getModuleNameForImport(filePath, this._configOptions.getDefaultExecEnvironment());
|
590
|
+
return moduleNameAndType.moduleName;
|
591
|
+
}
|
592
|
+
// A "shadowed" file is a python source file that has been added to the program because
|
593
|
+
// it "shadows" a type stub file for purposes of finding doc strings and definitions.
|
594
|
+
// We need to track the relationship so if the original type stub is removed from the
|
595
|
+
// program, we can remove the corresponding shadowed file and any files it imports.
|
596
|
+
_addShadowedFile(stubFile, shadowImplPath) {
|
597
|
+
let shadowFileInfo = this._getSourceFileInfoFromPath(shadowImplPath);
|
598
|
+
if (!shadowFileInfo) {
|
599
|
+
const importName = this._getImportNameForFile(shadowImplPath);
|
600
|
+
const sourceFile = new sourceFile_1.SourceFile(this._fs, shadowImplPath, importName,
|
601
|
+
/* isThirdPartyImport */ false,
|
602
|
+
/* isInPyTypedPackage */ false, this._console, this._logTracker);
|
603
|
+
shadowFileInfo = {
|
604
|
+
sourceFile,
|
605
|
+
isTracked: false,
|
606
|
+
isOpenByClient: false,
|
607
|
+
isTypeshedFile: false,
|
608
|
+
isThirdPartyImport: false,
|
609
|
+
isThirdPartyPyTypedPresent: false,
|
610
|
+
diagnosticsVersion: undefined,
|
611
|
+
imports: [],
|
612
|
+
importedBy: [],
|
613
|
+
shadows: [],
|
614
|
+
shadowedBy: [],
|
615
|
+
};
|
616
|
+
this._addToSourceFileListAndMap(shadowFileInfo);
|
617
|
+
}
|
618
|
+
if (!shadowFileInfo.shadows.includes(stubFile)) {
|
619
|
+
shadowFileInfo.shadows.push(stubFile);
|
620
|
+
}
|
621
|
+
if (!stubFile.shadowedBy.includes(shadowFileInfo)) {
|
622
|
+
stubFile.shadowedBy.push(shadowFileInfo);
|
623
|
+
}
|
624
|
+
return shadowFileInfo.sourceFile;
|
625
|
+
}
|
626
|
+
_createNewEvaluator() {
|
627
|
+
if (this._evaluator) {
|
628
|
+
// We shouldn't need to call this, but there appears to be a bug
|
629
|
+
// in the v8 garbage collector where it's unable to resolve orphaned
|
630
|
+
// objects without us giving it some assistance.
|
631
|
+
this._evaluator.disposeEvaluator();
|
632
|
+
}
|
633
|
+
this._evaluator = (0, typeEvaluatorWithTracker_1.createTypeEvaluatorWithTracker)(this._lookUpImport, {
|
634
|
+
printTypeFlags: Program._getPrintTypeFlags(this._configOptions),
|
635
|
+
logCalls: this._configOptions.logTypeEvaluationTime,
|
636
|
+
minimumLoggingThreshold: this._configOptions.typeEvaluationTimeThreshold,
|
637
|
+
analyzeUnannotatedFunctions: this._configOptions.analyzeUnannotatedFunctions,
|
638
|
+
evaluateUnknownImportsAsAny: !!this._configOptions.evaluateUnknownImportsAsAny,
|
639
|
+
verifyTypeCacheEvaluatorFlags: !!this._configOptions.internalTestMode,
|
640
|
+
}, this._logTracker, this._configOptions.logTypeEvaluationTime
|
641
|
+
? (0, tracePrinter_1.createTracePrinter)(this._importResolver.getImportRoots(this._configOptions.findExecEnvironment(this._configOptions.projectRoot)))
|
642
|
+
: undefined);
|
643
|
+
return this._evaluator;
|
644
|
+
}
|
645
|
+
_parseFile(fileToParse, content) {
|
646
|
+
if (!this._isFileNeeded(fileToParse) || !fileToParse.sourceFile.isParseRequired()) {
|
647
|
+
return;
|
648
|
+
}
|
649
|
+
if (fileToParse.sourceFile.parse(this._configOptions, this._importResolver, content)) {
|
650
|
+
this._parsedFileCount++;
|
651
|
+
this._updateSourceFileImports(fileToParse, this._configOptions);
|
652
|
+
}
|
653
|
+
if (fileToParse.sourceFile.isFileDeleted()) {
|
654
|
+
fileToParse.isTracked = false;
|
655
|
+
// Mark any files that depend on this file as dirty
|
656
|
+
// also. This will retrigger analysis of these other files.
|
657
|
+
const markDirtyMap = new Map();
|
658
|
+
this._markFileDirtyRecursive(fileToParse, markDirtyMap);
|
659
|
+
// Invalidate the import resolver's cache as well.
|
660
|
+
this._importResolver.invalidateCache();
|
661
|
+
}
|
662
|
+
}
|
663
|
+
// Binds the specified file and all of its dependencies, recursively. If
|
664
|
+
// it runs out of time, it returns true. If it completes, it returns false.
|
665
|
+
_bindFile(fileToAnalyze, content) {
|
666
|
+
var _a, _b;
|
667
|
+
if (!this._isFileNeeded(fileToAnalyze) || !fileToAnalyze.sourceFile.isBindingRequired()) {
|
668
|
+
return;
|
669
|
+
}
|
670
|
+
this._parseFile(fileToAnalyze, content);
|
671
|
+
const getScopeIfAvailable = (fileInfo) => {
|
672
|
+
if (!fileInfo || fileInfo === fileToAnalyze) {
|
673
|
+
return undefined;
|
674
|
+
}
|
675
|
+
this._bindFile(fileInfo);
|
676
|
+
if (fileInfo.sourceFile.isFileDeleted()) {
|
677
|
+
return undefined;
|
678
|
+
}
|
679
|
+
const parseResults = fileInfo.sourceFile.getParseResults();
|
680
|
+
if (!parseResults) {
|
681
|
+
return undefined;
|
682
|
+
}
|
683
|
+
const scope = AnalyzerNodeInfo.getScope(parseResults.parseTree);
|
684
|
+
(0, debug_1.assert)(scope !== undefined);
|
685
|
+
return scope;
|
686
|
+
};
|
687
|
+
let builtinsScope;
|
688
|
+
if (fileToAnalyze.builtinsImport && fileToAnalyze.builtinsImport !== fileToAnalyze) {
|
689
|
+
// If it is not builtin module itself, we need to parse and bind
|
690
|
+
// the ipython display import if required. Otherwise, get builtin module.
|
691
|
+
builtinsScope =
|
692
|
+
(_b = (_a = getScopeIfAvailable(fileToAnalyze.chainedSourceFile)) !== null && _a !== void 0 ? _a : getScopeIfAvailable(fileToAnalyze.ipythonDisplayImport)) !== null && _b !== void 0 ? _b : getScopeIfAvailable(fileToAnalyze.builtinsImport);
|
693
|
+
}
|
694
|
+
fileToAnalyze.sourceFile.bind(this._configOptions, this._lookUpImport, builtinsScope);
|
695
|
+
}
|
696
|
+
// Build a map of all modules within this program and the module-
|
697
|
+
// level scope that contains the symbol table for the module.
|
698
|
+
_buildModuleSymbolsMap(sourceFileToExclude, userFileOnly, includeIndexUserSymbols, token) {
|
699
|
+
// If we have library map, always use the map for library symbols.
|
700
|
+
return (0, autoImporter_1.buildModuleSymbolsMap)(this._sourceFileList.filter((s) => s !== sourceFileToExclude && (userFileOnly ? this._isUserCode(s) : true)), includeIndexUserSymbols, token);
|
701
|
+
}
|
702
|
+
_shouldCheckFile(fileInfo) {
|
703
|
+
// Always do a full checking for a file that's open in the editor.
|
704
|
+
if (fileInfo.isOpenByClient) {
|
705
|
+
return true;
|
706
|
+
}
|
707
|
+
// If the file isn't currently open, only perform full checking for
|
708
|
+
// files that are tracked, and only if the checkOnlyOpenFiles is disabled.
|
709
|
+
if (!this._configOptions.checkOnlyOpenFiles && fileInfo.isTracked) {
|
710
|
+
return true;
|
711
|
+
}
|
712
|
+
return false;
|
713
|
+
}
|
714
|
+
_checkTypes(fileToCheck) {
|
715
|
+
return this._logTracker.log(`analyzing: ${fileToCheck.sourceFile.getFilePath()}`, (logState) => {
|
716
|
+
// If the file isn't needed because it was eliminated from the
|
717
|
+
// transitive closure or deleted, skip the file rather than wasting
|
718
|
+
// time on it.
|
719
|
+
if (!this._isFileNeeded(fileToCheck)) {
|
720
|
+
logState.suppress();
|
721
|
+
return false;
|
722
|
+
}
|
723
|
+
if (!fileToCheck.sourceFile.isCheckingRequired()) {
|
724
|
+
logState.suppress();
|
725
|
+
return false;
|
726
|
+
}
|
727
|
+
if (!this._shouldCheckFile(fileToCheck)) {
|
728
|
+
logState.suppress();
|
729
|
+
return false;
|
730
|
+
}
|
731
|
+
this._bindFile(fileToCheck);
|
732
|
+
if (this._preCheckCallback) {
|
733
|
+
const parseResults = fileToCheck.sourceFile.getParseResults();
|
734
|
+
if (parseResults) {
|
735
|
+
this._preCheckCallback(parseResults, this._evaluator);
|
736
|
+
}
|
737
|
+
}
|
738
|
+
if (!this._disableChecker) {
|
739
|
+
fileToCheck.sourceFile.check(this._importResolver, this._evaluator);
|
740
|
+
}
|
741
|
+
// For very large programs, we may need to discard the evaluator and
|
742
|
+
// its cached types to avoid running out of heap space.
|
743
|
+
this._handleMemoryHighUsage();
|
744
|
+
// Detect import cycles that involve the file.
|
745
|
+
if (this._configOptions.diagnosticRuleSet.reportImportCycles !== 'none') {
|
746
|
+
// Don't detect import cycles when doing type stub generation. Some
|
747
|
+
// third-party modules are pretty convoluted.
|
748
|
+
if (!this._allowedThirdPartyImports) {
|
749
|
+
// We need to force all of the files to be parsed and build
|
750
|
+
// a closure map for the files.
|
751
|
+
const closureMap = new Map();
|
752
|
+
this._getImportsRecursive(fileToCheck, closureMap, 0);
|
753
|
+
closureMap.forEach((file) => {
|
754
|
+
timing_1.timingStats.cycleDetectionTime.timeOperation(() => {
|
755
|
+
const filesVisitedMap = new Map();
|
756
|
+
if (!this._detectAndReportImportCycles(file, filesVisitedMap)) {
|
757
|
+
// If no cycles were reported, set a flag in all of the visited files
|
758
|
+
// so we don't need to visit them again on subsequent cycle checks.
|
759
|
+
filesVisitedMap.forEach((sourceFileInfo) => {
|
760
|
+
sourceFileInfo.sourceFile.setNoCircularDependencyConfirmed();
|
761
|
+
});
|
762
|
+
}
|
763
|
+
});
|
764
|
+
});
|
765
|
+
}
|
766
|
+
}
|
767
|
+
return true;
|
768
|
+
});
|
769
|
+
}
|
770
|
+
// Builds a map of files that includes the specified file and all of the files
|
771
|
+
// it imports (recursively) and ensures that all such files. If any of these files
|
772
|
+
// have already been checked (they and their recursive imports have completed the
|
773
|
+
// check phase), they are not included in the results.
|
774
|
+
_getImportsRecursive(file, closureMap, recursionCount) {
|
775
|
+
// If the file is already in the closure map, we found a cyclical
|
776
|
+
// dependency. Don't recur further.
|
777
|
+
const filePath = (0, pathUtils_1.normalizePathCase)(this._fs, file.sourceFile.getFilePath());
|
778
|
+
if (closureMap.has(filePath)) {
|
779
|
+
return;
|
780
|
+
}
|
781
|
+
// If the import chain is too long, emit an error. Otherwise we
|
782
|
+
// risk blowing the stack.
|
783
|
+
if (recursionCount > _maxImportDepth) {
|
784
|
+
file.sourceFile.setHitMaxImportDepth(_maxImportDepth);
|
785
|
+
return;
|
786
|
+
}
|
787
|
+
// Add the file to the closure map.
|
788
|
+
closureMap.set(filePath, file);
|
789
|
+
// Recursively add the file's imports.
|
790
|
+
for (const importedFileInfo of file.imports) {
|
791
|
+
this._getImportsRecursive(importedFileInfo, closureMap, recursionCount + 1);
|
792
|
+
}
|
793
|
+
}
|
794
|
+
_detectAndReportImportCycles(sourceFileInfo, filesVisited, dependencyChain = [], dependencyMap = new Map()) {
|
795
|
+
// Don't bother checking for typestub files or third-party files.
|
796
|
+
if (sourceFileInfo.sourceFile.isStubFile() || sourceFileInfo.isThirdPartyImport) {
|
797
|
+
return false;
|
798
|
+
}
|
799
|
+
// If we've already confirmed that this source file isn't part of a
|
800
|
+
// cycle, we can skip it entirely.
|
801
|
+
if (sourceFileInfo.sourceFile.isNoCircularDependencyConfirmed()) {
|
802
|
+
return false;
|
803
|
+
}
|
804
|
+
filesVisited.set(sourceFileInfo.sourceFile.getFilePath(), sourceFileInfo);
|
805
|
+
let detectedCycle = false;
|
806
|
+
const filePath = (0, pathUtils_1.normalizePathCase)(this._fs, sourceFileInfo.sourceFile.getFilePath());
|
807
|
+
if (dependencyMap.has(filePath)) {
|
808
|
+
// Look for chains at least two in length. A file that contains
|
809
|
+
// an "import . from X" will technically create a cycle with
|
810
|
+
// itself, but those are not interesting to report.
|
811
|
+
if (dependencyChain.length > 1 && sourceFileInfo === dependencyChain[0]) {
|
812
|
+
this._logImportCycle(dependencyChain);
|
813
|
+
detectedCycle = true;
|
814
|
+
}
|
815
|
+
}
|
816
|
+
else {
|
817
|
+
// If we've already checked this dependency along
|
818
|
+
// some other path, we can skip it.
|
819
|
+
if (dependencyMap.has(filePath)) {
|
820
|
+
return false;
|
821
|
+
}
|
822
|
+
// We use both a map (for fast lookups) and a list
|
823
|
+
// (for ordering information). Set the dependency map
|
824
|
+
// entry to true to indicate that we're actively exploring
|
825
|
+
// that dependency.
|
826
|
+
dependencyMap.set(filePath, true);
|
827
|
+
dependencyChain.push(sourceFileInfo);
|
828
|
+
for (const imp of sourceFileInfo.imports) {
|
829
|
+
if (this._detectAndReportImportCycles(imp, filesVisited, dependencyChain, dependencyMap)) {
|
830
|
+
detectedCycle = true;
|
831
|
+
}
|
832
|
+
}
|
833
|
+
// Set the dependencyMap entry to false to indicate that we have
|
834
|
+
// already explored this file and don't need to explore it again.
|
835
|
+
dependencyMap.set(filePath, false);
|
836
|
+
dependencyChain.pop();
|
837
|
+
}
|
838
|
+
return detectedCycle;
|
839
|
+
}
|
840
|
+
_logImportCycle(dependencyChain) {
|
841
|
+
const circDep = new circularDependency_1.CircularDependency();
|
842
|
+
dependencyChain.forEach((sourceFileInfo) => {
|
843
|
+
circDep.appendPath(sourceFileInfo.sourceFile.getFilePath());
|
844
|
+
});
|
845
|
+
circDep.normalizeOrder();
|
846
|
+
const firstFilePath = circDep.getPaths()[0];
|
847
|
+
const firstSourceFile = this._getSourceFileInfoFromPath(firstFilePath);
|
848
|
+
(0, debug_1.assert)(firstSourceFile !== undefined);
|
849
|
+
firstSourceFile.sourceFile.addCircularDependency(circDep);
|
850
|
+
}
|
851
|
+
_markFileDirtyRecursive(sourceFileInfo, markMap, forceRebinding = false) {
|
852
|
+
const filePath = (0, pathUtils_1.normalizePathCase)(this._fs, sourceFileInfo.sourceFile.getFilePath());
|
853
|
+
// Don't mark it again if it's already been visited.
|
854
|
+
if (!markMap.has(filePath)) {
|
855
|
+
sourceFileInfo.sourceFile.markReanalysisRequired(forceRebinding);
|
856
|
+
markMap.set(filePath, true);
|
857
|
+
sourceFileInfo.importedBy.forEach((dep) => {
|
858
|
+
// Changes on chained source file can change symbols in the symbol table and
|
859
|
+
// dependencies on the dependent file. Force rebinding.
|
860
|
+
const forceRebinding = dep.chainedSourceFile === sourceFileInfo;
|
861
|
+
this._markFileDirtyRecursive(dep, markMap, forceRebinding);
|
862
|
+
});
|
863
|
+
}
|
864
|
+
}
|
865
|
+
getTextOnRange(filePath, range, token) {
|
866
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
867
|
+
if (!sourceFileInfo) {
|
868
|
+
return undefined;
|
869
|
+
}
|
870
|
+
const sourceFile = sourceFileInfo.sourceFile;
|
871
|
+
const fileContents = sourceFile.getOpenFileContents();
|
872
|
+
if (fileContents === undefined) {
|
873
|
+
// this only works with opened file
|
874
|
+
return undefined;
|
875
|
+
}
|
876
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
877
|
+
this._parseFile(sourceFileInfo);
|
878
|
+
const parseTree = sourceFile.getParseResults();
|
879
|
+
const textRange = (0, positionUtils_1.convertRangeToTextRange)(range, parseTree.tokenizerOutput.lines);
|
880
|
+
if (!textRange) {
|
881
|
+
return undefined;
|
882
|
+
}
|
883
|
+
return fileContents.substr(textRange.start, textRange.length);
|
884
|
+
});
|
885
|
+
}
|
886
|
+
getAutoImports(filePath, range, similarityLimit, nameMap, libraryMap, lazyEdit, allowVariableInAll, token) {
|
887
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
888
|
+
if (!sourceFileInfo) {
|
889
|
+
return [];
|
890
|
+
}
|
891
|
+
const sourceFile = sourceFileInfo.sourceFile;
|
892
|
+
const fileContents = sourceFile.getOpenFileContents();
|
893
|
+
if (fileContents === undefined) {
|
894
|
+
// this only works with opened file
|
895
|
+
return [];
|
896
|
+
}
|
897
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
898
|
+
this._bindFile(sourceFileInfo);
|
899
|
+
const parseTree = sourceFile.getParseResults();
|
900
|
+
const textRange = (0, positionUtils_1.convertRangeToTextRange)(range, parseTree.tokenizerOutput.lines);
|
901
|
+
if (!textRange) {
|
902
|
+
return [];
|
903
|
+
}
|
904
|
+
const currentNode = (0, parseTreeUtils_1.findNodeByOffset)(parseTree.parseTree, textRange.start);
|
905
|
+
if (!currentNode) {
|
906
|
+
return [];
|
907
|
+
}
|
908
|
+
const writtenWord = fileContents.substr(textRange.start, textRange.length);
|
909
|
+
const map = this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
|
910
|
+
/* includeIndexUserSymbols */ true, token);
|
911
|
+
const autoImporter = new autoImporter_1.AutoImporter(this._configOptions.findExecEnvironment(filePath), this._importResolver, parseTree, range.start, new completionProvider_1.CompletionMap(), map, {
|
912
|
+
lazyEdit,
|
913
|
+
allowVariableInAll,
|
914
|
+
libraryMap,
|
915
|
+
patternMatcher: (p, t) => (0, stringUtils_1.computeCompletionSimilarity)(p, t) > similarityLimit,
|
916
|
+
});
|
917
|
+
// Filter out any name that is already defined in the current scope.
|
918
|
+
const results = [];
|
919
|
+
const currentScope = (0, scopeUtils_1.getScopeForNode)(currentNode);
|
920
|
+
if (currentScope) {
|
921
|
+
const info = nameMap === null || nameMap === void 0 ? void 0 : nameMap.get(writtenWord);
|
922
|
+
if (info) {
|
923
|
+
// No scope filter is needed since we only do exact match.
|
924
|
+
(0, collectionUtils_1.appendArray)(results, autoImporter.getAutoImportCandidatesForAbbr(writtenWord, info, token));
|
925
|
+
}
|
926
|
+
results.push(...autoImporter
|
927
|
+
.getAutoImportCandidates(writtenWord, similarityLimit, /* abbrFromUsers */ undefined, token)
|
928
|
+
.filter((r) => !currentScope.lookUpSymbolRecursive(r.name)));
|
929
|
+
}
|
930
|
+
return results;
|
931
|
+
});
|
932
|
+
}
|
933
|
+
getDiagnostics(options) {
|
934
|
+
const fileDiagnostics = this._removeUnneededFiles();
|
935
|
+
this._sourceFileList.forEach((sourceFileInfo) => {
|
936
|
+
if (this._shouldCheckFile(sourceFileInfo)) {
|
937
|
+
const diagnostics = sourceFileInfo.sourceFile.getDiagnostics(options, sourceFileInfo.diagnosticsVersion);
|
938
|
+
if (diagnostics !== undefined) {
|
939
|
+
fileDiagnostics.push({
|
940
|
+
filePath: sourceFileInfo.sourceFile.getFilePath(),
|
941
|
+
version: sourceFileInfo.sourceFile.getClientVersion(),
|
942
|
+
diagnostics,
|
943
|
+
});
|
944
|
+
// Update the cached diagnosticsVersion so we can determine
|
945
|
+
// whether there are any updates next time we call getDiagnostics.
|
946
|
+
sourceFileInfo.diagnosticsVersion = sourceFileInfo.sourceFile.getDiagnosticVersion();
|
947
|
+
}
|
948
|
+
}
|
949
|
+
else if (!sourceFileInfo.isOpenByClient &&
|
950
|
+
options.checkOnlyOpenFiles &&
|
951
|
+
sourceFileInfo.diagnosticsVersion !== undefined) {
|
952
|
+
// This condition occurs when the user switches from workspace to
|
953
|
+
// "open files only" mode. Clear all diagnostics for this file.
|
954
|
+
fileDiagnostics.push({
|
955
|
+
filePath: sourceFileInfo.sourceFile.getFilePath(),
|
956
|
+
version: sourceFileInfo.sourceFile.getClientVersion(),
|
957
|
+
diagnostics: [],
|
958
|
+
});
|
959
|
+
sourceFileInfo.diagnosticsVersion = undefined;
|
960
|
+
}
|
961
|
+
});
|
962
|
+
return fileDiagnostics;
|
963
|
+
}
|
964
|
+
getDiagnosticsForRange(filePath, range) {
|
965
|
+
const sourceFile = this.getSourceFile(filePath);
|
966
|
+
if (!sourceFile) {
|
967
|
+
return [];
|
968
|
+
}
|
969
|
+
const unfilteredDiagnostics = sourceFile.getDiagnostics(this._configOptions);
|
970
|
+
if (!unfilteredDiagnostics) {
|
971
|
+
return [];
|
972
|
+
}
|
973
|
+
return unfilteredDiagnostics.filter((diag) => {
|
974
|
+
return (0, textRange_1.doRangesIntersect)(diag.range, range);
|
975
|
+
});
|
976
|
+
}
|
977
|
+
getDefinitionsForPosition(filePath, position, filter, token) {
|
978
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
979
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
980
|
+
if (!sourceFileInfo) {
|
981
|
+
return undefined;
|
982
|
+
}
|
983
|
+
this._bindFile(sourceFileInfo);
|
984
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
985
|
+
return sourceFileInfo.sourceFile.getDefinitionsForPosition(this._createSourceMapper(execEnv), position, filter, this._evaluator, token);
|
986
|
+
});
|
987
|
+
}
|
988
|
+
getTypeDefinitionsForPosition(filePath, position, token) {
|
989
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
990
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
991
|
+
if (!sourceFileInfo) {
|
992
|
+
return undefined;
|
993
|
+
}
|
994
|
+
this._bindFile(sourceFileInfo);
|
995
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
996
|
+
return sourceFileInfo.sourceFile.getTypeDefinitionsForPosition(this._createSourceMapper(execEnv, /* mapCompiled */ false, /* preferStubs */ true), position, this._evaluator, filePath, token);
|
997
|
+
});
|
998
|
+
}
|
999
|
+
reportReferencesForPosition(filePath, position, includeDeclaration, reporter, token) {
|
1000
|
+
this._runEvaluatorWithCancellationToken(token, () => {
|
1001
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1002
|
+
if (!sourceFileInfo) {
|
1003
|
+
return;
|
1004
|
+
}
|
1005
|
+
const invokedFromUserFile = this._isUserCode(sourceFileInfo);
|
1006
|
+
this._bindFile(sourceFileInfo);
|
1007
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1008
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv), position, this._evaluator, reporter, token);
|
1009
|
+
if (!referencesResult) {
|
1010
|
+
return;
|
1011
|
+
}
|
1012
|
+
// Do we need to do a global search as well?
|
1013
|
+
if (referencesResult.requiresGlobalSearch) {
|
1014
|
+
for (const curSourceFileInfo of this._sourceFileList) {
|
1015
|
+
(0, cancellationUtils_1.throwIfCancellationRequested)(token);
|
1016
|
+
// "Find all references" will only include references from user code
|
1017
|
+
// unless the file is explicitly opened in the editor or it is invoked from non user files.
|
1018
|
+
if (curSourceFileInfo.isOpenByClient ||
|
1019
|
+
!invokedFromUserFile ||
|
1020
|
+
this._isUserCode(curSourceFileInfo)) {
|
1021
|
+
// See if the reference symbol's string is located somewhere within the file.
|
1022
|
+
// If not, we can skip additional processing for the file.
|
1023
|
+
const fileContents = curSourceFileInfo.sourceFile.getFileContent();
|
1024
|
+
if (!fileContents || fileContents.search(referencesResult.symbolName) >= 0) {
|
1025
|
+
this._bindFile(curSourceFileInfo);
|
1026
|
+
curSourceFileInfo.sourceFile.addReferences(referencesResult, includeDeclaration, this._evaluator, token);
|
1027
|
+
}
|
1028
|
+
// This operation can consume significant memory, so check
|
1029
|
+
// for situations where we need to discard the type cache.
|
1030
|
+
this._handleMemoryHighUsage();
|
1031
|
+
}
|
1032
|
+
}
|
1033
|
+
// Make sure to include declarations regardless where they are defined
|
1034
|
+
// if includeDeclaration is set.
|
1035
|
+
if (includeDeclaration) {
|
1036
|
+
for (const decl of referencesResult.declarations) {
|
1037
|
+
(0, cancellationUtils_1.throwIfCancellationRequested)(token);
|
1038
|
+
if (referencesResult.locations.some((l) => l.path === decl.path)) {
|
1039
|
+
// Already included.
|
1040
|
+
continue;
|
1041
|
+
}
|
1042
|
+
const declFileInfo = this._getSourceFileInfoFromPath(decl.path);
|
1043
|
+
if (!declFileInfo) {
|
1044
|
+
// The file the declaration belongs to doesn't belong to the program.
|
1045
|
+
continue;
|
1046
|
+
}
|
1047
|
+
const tempResult = new referencesProvider_1.ReferencesResult(referencesResult.requiresGlobalSearch, referencesResult.nodeAtOffset, referencesResult.symbolName, referencesResult.declarations);
|
1048
|
+
declFileInfo.sourceFile.addReferences(tempResult, includeDeclaration, this._evaluator, token);
|
1049
|
+
for (const loc of tempResult.locations) {
|
1050
|
+
// Include declarations only. And throw away any references
|
1051
|
+
if (loc.path === decl.path && (0, textRange_1.doesRangeContain)(decl.range, loc.range)) {
|
1052
|
+
referencesResult.addLocations(loc);
|
1053
|
+
}
|
1054
|
+
}
|
1055
|
+
}
|
1056
|
+
}
|
1057
|
+
}
|
1058
|
+
else {
|
1059
|
+
sourceFileInfo.sourceFile.addReferences(referencesResult, includeDeclaration, this._evaluator, token);
|
1060
|
+
}
|
1061
|
+
});
|
1062
|
+
}
|
1063
|
+
getFileIndex(filePath, options, token) {
|
1064
|
+
if (options.indexingForAutoImportMode) {
|
1065
|
+
// Memory optimization. We only want to hold onto symbols
|
1066
|
+
// usable outside when importSymbolsOnly is on.
|
1067
|
+
const name = (0, pathUtils_1.stripFileExtension)((0, pathUtils_1.getFileName)(filePath));
|
1068
|
+
if ((0, symbolNameUtils_1.isPrivateOrProtectedName)(name)) {
|
1069
|
+
return undefined;
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
this._handleMemoryHighUsage();
|
1073
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1074
|
+
var _a;
|
1075
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1076
|
+
if (!sourceFileInfo) {
|
1077
|
+
return undefined;
|
1078
|
+
}
|
1079
|
+
const content = (_a = sourceFileInfo.sourceFile.getFileContent()) !== null && _a !== void 0 ? _a : '';
|
1080
|
+
if (options.indexingForAutoImportMode &&
|
1081
|
+
!options.forceIndexing &&
|
1082
|
+
!sourceFileInfo.sourceFile.isStubFile() &&
|
1083
|
+
!sourceFileInfo.sourceFile.isThirdPartyPyTypedPresent()) {
|
1084
|
+
// Perf optimization. if py file doesn't contain __all__
|
1085
|
+
// No need to parse and bind.
|
1086
|
+
if (content.indexOf('__all__') < 0) {
|
1087
|
+
return undefined;
|
1088
|
+
}
|
1089
|
+
}
|
1090
|
+
this._bindFile(sourceFileInfo, content);
|
1091
|
+
return sourceFileInfo.sourceFile.index(options, token);
|
1092
|
+
});
|
1093
|
+
}
|
1094
|
+
addSymbolsForDocument(filePath, symbolList, token) {
|
1095
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1096
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1097
|
+
if (sourceFileInfo) {
|
1098
|
+
if (!sourceFileInfo.sourceFile.getCachedIndexResults()) {
|
1099
|
+
// If we already have cached index for this file, no need to bind this file.
|
1100
|
+
this._bindFile(sourceFileInfo);
|
1101
|
+
}
|
1102
|
+
sourceFileInfo.sourceFile.addHierarchicalSymbolsForDocument(symbolList, token);
|
1103
|
+
}
|
1104
|
+
});
|
1105
|
+
}
|
1106
|
+
reportSymbolsForWorkspace(query, reporter, token) {
|
1107
|
+
this._runEvaluatorWithCancellationToken(token, () => {
|
1108
|
+
// Don't do a search if the query is empty. We'll return
|
1109
|
+
// too many results in this case.
|
1110
|
+
if (!query) {
|
1111
|
+
return;
|
1112
|
+
}
|
1113
|
+
// "Workspace symbols" searches symbols only from user code.
|
1114
|
+
for (const sourceFileInfo of this._sourceFileList) {
|
1115
|
+
if (!this._isUserCode(sourceFileInfo)) {
|
1116
|
+
continue;
|
1117
|
+
}
|
1118
|
+
if (!sourceFileInfo.sourceFile.getCachedIndexResults()) {
|
1119
|
+
// If we already have cached index for this file, no need to bind this file.
|
1120
|
+
this._bindFile(sourceFileInfo);
|
1121
|
+
}
|
1122
|
+
const symbolList = sourceFileInfo.sourceFile.getSymbolsForDocument(query, token);
|
1123
|
+
if (symbolList.length > 0) {
|
1124
|
+
reporter(symbolList);
|
1125
|
+
}
|
1126
|
+
// This operation can consume significant memory, so check
|
1127
|
+
// for situations where we need to discard the type cache.
|
1128
|
+
this._handleMemoryHighUsage();
|
1129
|
+
}
|
1130
|
+
});
|
1131
|
+
}
|
1132
|
+
getHoverForPosition(filePath, position, format, token) {
|
1133
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1134
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1135
|
+
if (!sourceFileInfo) {
|
1136
|
+
return undefined;
|
1137
|
+
}
|
1138
|
+
this._bindFile(sourceFileInfo);
|
1139
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1140
|
+
return sourceFileInfo.sourceFile.getHoverForPosition(this._createSourceMapper(execEnv, /* mapCompiled */ true), position, format, this._evaluator, token);
|
1141
|
+
});
|
1142
|
+
}
|
1143
|
+
getDocumentHighlight(filePath, position, token) {
|
1144
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1145
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1146
|
+
if (!sourceFileInfo) {
|
1147
|
+
return undefined;
|
1148
|
+
}
|
1149
|
+
this._bindFile(sourceFileInfo);
|
1150
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1151
|
+
return sourceFileInfo.sourceFile.getDocumentHighlight(this._createSourceMapper(execEnv), position, this._evaluator, token);
|
1152
|
+
});
|
1153
|
+
}
|
1154
|
+
getSignatureHelpForPosition(filePath, position, format, token) {
|
1155
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1156
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1157
|
+
if (!sourceFileInfo) {
|
1158
|
+
return undefined;
|
1159
|
+
}
|
1160
|
+
this._bindFile(sourceFileInfo);
|
1161
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1162
|
+
return sourceFileInfo.sourceFile.getSignatureHelpForPosition(position, this._createSourceMapper(execEnv, /* mapCompiled */ true), this._evaluator, format, token);
|
1163
|
+
});
|
1164
|
+
}
|
1165
|
+
async getCompletionsForPosition(filePath, position, workspacePath, options, nameMap, libraryMap, token) {
|
1166
|
+
var _a, _b;
|
1167
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1168
|
+
if (!sourceFileInfo) {
|
1169
|
+
return undefined;
|
1170
|
+
}
|
1171
|
+
const completionResult = this._logTracker.log(`completion at ${filePath}:${position.line}:${position.character}`, (ls) => {
|
1172
|
+
var _a, _b;
|
1173
|
+
const result = this._runEvaluatorWithCancellationToken(token, () => {
|
1174
|
+
this._bindFile(sourceFileInfo);
|
1175
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1176
|
+
return sourceFileInfo.sourceFile.getCompletionsForPosition(position, workspacePath, this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
|
1177
|
+
/* includeIndexUserSymbols */ false, token), token);
|
1178
|
+
});
|
1179
|
+
ls.add(`found ${(_b = (_a = result === null || result === void 0 ? void 0 : result.completionMap) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 'null'} items`);
|
1180
|
+
return result;
|
1181
|
+
});
|
1182
|
+
const completionResultsList = {
|
1183
|
+
completionList: vscode_languageserver_types_1.CompletionList.create((_a = completionResult === null || completionResult === void 0 ? void 0 : completionResult.completionMap) === null || _a === void 0 ? void 0 : _a.toArray()),
|
1184
|
+
memberAccessInfo: completionResult === null || completionResult === void 0 ? void 0 : completionResult.memberAccessInfo,
|
1185
|
+
autoImportInfo: completionResult === null || completionResult === void 0 ? void 0 : completionResult.autoImportInfo,
|
1186
|
+
extensionInfo: completionResult === null || completionResult === void 0 ? void 0 : completionResult.extensionInfo,
|
1187
|
+
};
|
1188
|
+
if (!(completionResult === null || completionResult === void 0 ? void 0 : completionResult.completionMap) || !((_b = this._extension) === null || _b === void 0 ? void 0 : _b.completionListExtension)) {
|
1189
|
+
return completionResultsList;
|
1190
|
+
}
|
1191
|
+
const parseResults = sourceFileInfo.sourceFile.getParseResults();
|
1192
|
+
if ((parseResults === null || parseResults === void 0 ? void 0 : parseResults.parseTree) && (parseResults === null || parseResults === void 0 ? void 0 : parseResults.text)) {
|
1193
|
+
const offset = (0, positionUtils_1.convertPositionToOffset)(position, parseResults.tokenizerOutput.lines);
|
1194
|
+
if (offset !== undefined) {
|
1195
|
+
await this._extension.completionListExtension.updateCompletionResults(completionResultsList, parseResults, offset, token);
|
1196
|
+
}
|
1197
|
+
}
|
1198
|
+
return completionResultsList;
|
1199
|
+
}
|
1200
|
+
resolveCompletionItem(filePath, completionItem, options, nameMap, libraryMap, token) {
|
1201
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1202
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1203
|
+
if (!sourceFileInfo) {
|
1204
|
+
return;
|
1205
|
+
}
|
1206
|
+
this._bindFile(sourceFileInfo);
|
1207
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1208
|
+
sourceFileInfo.sourceFile.resolveCompletionItem(this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
|
1209
|
+
/* includeIndexUserSymbols */ false, token), completionItem, token);
|
1210
|
+
});
|
1211
|
+
}
|
1212
|
+
renameModule(path, newPath, token) {
|
1213
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1214
|
+
if ((0, pathUtils_1.isFile)(this._fs, path)) {
|
1215
|
+
const fileInfo = this._getSourceFileInfoFromPath(path);
|
1216
|
+
if (!fileInfo) {
|
1217
|
+
return undefined;
|
1218
|
+
}
|
1219
|
+
}
|
1220
|
+
const renameModuleProvider = renameModuleProvider_1.RenameModuleProvider.createForModule(this._importResolver, this._configOptions, this._evaluator, path, newPath, token);
|
1221
|
+
if (!renameModuleProvider) {
|
1222
|
+
return undefined;
|
1223
|
+
}
|
1224
|
+
this._processModuleReferences(renameModuleProvider, renameModuleProvider.lastModuleName, path);
|
1225
|
+
return { edits: renameModuleProvider.getEdits(), fileOperations: [] };
|
1226
|
+
});
|
1227
|
+
}
|
1228
|
+
moveSymbolAtPosition(filePath, newFilePath, position, token) {
|
1229
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1230
|
+
const fileInfo = this._getSourceFileInfoFromPath(filePath);
|
1231
|
+
if (!fileInfo) {
|
1232
|
+
return undefined;
|
1233
|
+
}
|
1234
|
+
this._bindFile(fileInfo);
|
1235
|
+
const parseResults = fileInfo.sourceFile.getParseResults();
|
1236
|
+
if (!parseResults) {
|
1237
|
+
return undefined;
|
1238
|
+
}
|
1239
|
+
const offset = (0, positionUtils_1.convertPositionToOffset)(position, parseResults.tokenizerOutput.lines);
|
1240
|
+
if (offset === undefined) {
|
1241
|
+
return undefined;
|
1242
|
+
}
|
1243
|
+
const node = (0, parseTreeUtils_1.findNodeByOffset)(parseResults.parseTree, offset);
|
1244
|
+
if (node === undefined) {
|
1245
|
+
return undefined;
|
1246
|
+
}
|
1247
|
+
// If this isn't a name node, there are no references to be found.
|
1248
|
+
if (node.nodeType !== 38 /* Name */) {
|
1249
|
+
return undefined;
|
1250
|
+
}
|
1251
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1252
|
+
const declarations = documentSymbolCollector_1.DocumentSymbolCollector.getDeclarationsForNode(node, this._evaluator,
|
1253
|
+
/* resolveLocalNames */ false, token, this._createSourceMapper(execEnv));
|
1254
|
+
const renameModuleProvider = renameModuleProvider_1.RenameModuleProvider.createForSymbol(this._importResolver, this._configOptions, this._evaluator, filePath, newFilePath, declarations, token);
|
1255
|
+
if (!renameModuleProvider) {
|
1256
|
+
return undefined;
|
1257
|
+
}
|
1258
|
+
this._processModuleReferences(renameModuleProvider, node.value, filePath);
|
1259
|
+
return { edits: renameModuleProvider.getEdits(), fileOperations: [] };
|
1260
|
+
});
|
1261
|
+
}
|
1262
|
+
canRenameSymbolAtPosition(filePath, position, isDefaultWorkspace, allowModuleRename, token) {
|
1263
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1264
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1265
|
+
if (!sourceFileInfo) {
|
1266
|
+
return undefined;
|
1267
|
+
}
|
1268
|
+
this._bindFile(sourceFileInfo);
|
1269
|
+
const referencesResult = this._getReferenceResult(sourceFileInfo, filePath, position, allowModuleRename, token);
|
1270
|
+
if (!referencesResult) {
|
1271
|
+
return undefined;
|
1272
|
+
}
|
1273
|
+
if (referencesResult.containsOnlyImportDecls &&
|
1274
|
+
!this._supportRenameModule(referencesResult.declarations, isDefaultWorkspace)) {
|
1275
|
+
return undefined;
|
1276
|
+
}
|
1277
|
+
const renameMode = this._getRenameSymbolMode(sourceFileInfo, referencesResult, isDefaultWorkspace);
|
1278
|
+
if (renameMode === 'none') {
|
1279
|
+
return undefined;
|
1280
|
+
}
|
1281
|
+
// Return the range of the symbol.
|
1282
|
+
const parseResult = sourceFileInfo.sourceFile.getParseResults();
|
1283
|
+
return (0, positionUtils_1.convertTextRangeToRange)(referencesResult.nodeAtOffset, parseResult.tokenizerOutput.lines);
|
1284
|
+
});
|
1285
|
+
}
|
1286
|
+
renameSymbolAtPosition(filePath, position, newName, isDefaultWorkspace, allowModuleRename, token) {
|
1287
|
+
return this._runEvaluatorWithCancellationToken(token, () => {
|
1288
|
+
var _a;
|
1289
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1290
|
+
if (!sourceFileInfo) {
|
1291
|
+
return undefined;
|
1292
|
+
}
|
1293
|
+
this._bindFile(sourceFileInfo);
|
1294
|
+
const referencesResult = this._getReferenceResult(sourceFileInfo, filePath, position, allowModuleRename, token);
|
1295
|
+
if (!referencesResult) {
|
1296
|
+
return undefined;
|
1297
|
+
}
|
1298
|
+
if (referencesResult.containsOnlyImportDecls) {
|
1299
|
+
// All decls must be on a user file.
|
1300
|
+
if (!this._supportRenameModule(referencesResult.declarations, isDefaultWorkspace)) {
|
1301
|
+
return undefined;
|
1302
|
+
}
|
1303
|
+
const moduleInfo = renameModuleProvider_1.RenameModuleProvider.getRenameModulePathInfo(renameModuleProvider_1.RenameModuleProvider.getRenameModulePath(referencesResult.declarations), newName);
|
1304
|
+
if (!moduleInfo) {
|
1305
|
+
// Can't figure out module to rename.
|
1306
|
+
return undefined;
|
1307
|
+
}
|
1308
|
+
const editActions = this.renameModule(moduleInfo.filePath, moduleInfo.newFilePath, token);
|
1309
|
+
// Add file system rename.
|
1310
|
+
editActions === null || editActions === void 0 ? void 0 : editActions.fileOperations.push({
|
1311
|
+
kind: 'rename',
|
1312
|
+
oldFilePath: moduleInfo.filePath,
|
1313
|
+
newFilePath: moduleInfo.newFilePath,
|
1314
|
+
});
|
1315
|
+
if ((0, sourceMapper_1.isStubFile)(moduleInfo.filePath)) {
|
1316
|
+
const matchingFiles = this._importResolver.getSourceFilesFromStub(moduleInfo.filePath, this._configOptions.findExecEnvironment(filePath),
|
1317
|
+
/* mapCompiled */ false);
|
1318
|
+
for (const matchingFile of matchingFiles) {
|
1319
|
+
const matchingFileInfo = renameModuleProvider_1.RenameModuleProvider.getRenameModulePathInfo(matchingFile, newName);
|
1320
|
+
if (matchingFileInfo) {
|
1321
|
+
editActions === null || editActions === void 0 ? void 0 : editActions.fileOperations.push({
|
1322
|
+
kind: 'rename',
|
1323
|
+
oldFilePath: matchingFileInfo.filePath,
|
1324
|
+
newFilePath: matchingFileInfo.newFilePath,
|
1325
|
+
});
|
1326
|
+
}
|
1327
|
+
}
|
1328
|
+
}
|
1329
|
+
return editActions;
|
1330
|
+
}
|
1331
|
+
const renameMode = this._getRenameSymbolMode(sourceFileInfo, referencesResult, isDefaultWorkspace);
|
1332
|
+
switch (renameMode) {
|
1333
|
+
case 'singleFileMode':
|
1334
|
+
sourceFileInfo.sourceFile.addReferences(referencesResult, true, this._evaluator, token);
|
1335
|
+
break;
|
1336
|
+
case 'multiFileMode': {
|
1337
|
+
for (const curSourceFileInfo of this._sourceFileList) {
|
1338
|
+
// Make sure we only add user code to the references to prevent us
|
1339
|
+
// from accidentally changing third party library or type stub.
|
1340
|
+
if (this._isUserCode(curSourceFileInfo)) {
|
1341
|
+
// Make sure searching symbol name exists in the file.
|
1342
|
+
const content = (_a = curSourceFileInfo.sourceFile.getFileContent()) !== null && _a !== void 0 ? _a : '';
|
1343
|
+
if (content.indexOf(referencesResult.symbolName) < 0) {
|
1344
|
+
continue;
|
1345
|
+
}
|
1346
|
+
this._bindFile(curSourceFileInfo, content);
|
1347
|
+
curSourceFileInfo.sourceFile.addReferences(referencesResult, true, this._evaluator, token);
|
1348
|
+
}
|
1349
|
+
// This operation can consume significant memory, so check
|
1350
|
+
// for situations where we need to discard the type cache.
|
1351
|
+
this._handleMemoryHighUsage();
|
1352
|
+
}
|
1353
|
+
break;
|
1354
|
+
}
|
1355
|
+
case 'none':
|
1356
|
+
// Rename is not allowed.
|
1357
|
+
// ex) rename symbols from libraries.
|
1358
|
+
return undefined;
|
1359
|
+
default:
|
1360
|
+
(0, debug_1.assertNever)(renameMode);
|
1361
|
+
}
|
1362
|
+
const edits = [];
|
1363
|
+
referencesResult.locations.forEach((loc) => {
|
1364
|
+
edits.push({
|
1365
|
+
filePath: loc.path,
|
1366
|
+
range: loc.range,
|
1367
|
+
replacementText: newName,
|
1368
|
+
});
|
1369
|
+
});
|
1370
|
+
return { edits, fileOperations: [] };
|
1371
|
+
});
|
1372
|
+
}
|
1373
|
+
getCallForPosition(filePath, position, token) {
|
1374
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1375
|
+
if (!sourceFileInfo) {
|
1376
|
+
return undefined;
|
1377
|
+
}
|
1378
|
+
this._bindFile(sourceFileInfo);
|
1379
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1380
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv), position, this._evaluator, undefined, token);
|
1381
|
+
if (!referencesResult || referencesResult.declarations.length === 0) {
|
1382
|
+
return undefined;
|
1383
|
+
}
|
1384
|
+
const targetDecl = callHierarchyProvider_1.CallHierarchyProvider.getTargetDeclaration(referencesResult.declarations, referencesResult.nodeAtOffset);
|
1385
|
+
return callHierarchyProvider_1.CallHierarchyProvider.getCallForDeclaration(referencesResult.symbolName, targetDecl, this._evaluator, token);
|
1386
|
+
}
|
1387
|
+
getIncomingCallsForPosition(filePath, position, token) {
|
1388
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1389
|
+
if (!sourceFileInfo) {
|
1390
|
+
return undefined;
|
1391
|
+
}
|
1392
|
+
this._bindFile(sourceFileInfo);
|
1393
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1394
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv), position, this._evaluator, undefined, token);
|
1395
|
+
if (!referencesResult || referencesResult.declarations.length === 0) {
|
1396
|
+
return undefined;
|
1397
|
+
}
|
1398
|
+
const targetDecl = callHierarchyProvider_1.CallHierarchyProvider.getTargetDeclaration(referencesResult.declarations, referencesResult.nodeAtOffset);
|
1399
|
+
let items = [];
|
1400
|
+
for (const curSourceFileInfo of this._sourceFileList) {
|
1401
|
+
if (this._isUserCode(curSourceFileInfo) || curSourceFileInfo.isOpenByClient) {
|
1402
|
+
this._bindFile(curSourceFileInfo);
|
1403
|
+
const itemsToAdd = callHierarchyProvider_1.CallHierarchyProvider.getIncomingCallsForDeclaration(curSourceFileInfo.sourceFile.getFilePath(), referencesResult.symbolName, targetDecl, curSourceFileInfo.sourceFile.getParseResults(), this._evaluator, token);
|
1404
|
+
if (itemsToAdd) {
|
1405
|
+
items = items.concat(...itemsToAdd);
|
1406
|
+
}
|
1407
|
+
// This operation can consume significant memory, so check
|
1408
|
+
// for situations where we need to discard the type cache.
|
1409
|
+
this._handleMemoryHighUsage();
|
1410
|
+
}
|
1411
|
+
}
|
1412
|
+
return items;
|
1413
|
+
}
|
1414
|
+
getOutgoingCallsForPosition(filePath, position, token) {
|
1415
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1416
|
+
if (!sourceFileInfo) {
|
1417
|
+
return undefined;
|
1418
|
+
}
|
1419
|
+
this._bindFile(sourceFileInfo);
|
1420
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1421
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv), position, this._evaluator, undefined, token);
|
1422
|
+
if (!referencesResult || referencesResult.declarations.length === 0) {
|
1423
|
+
return undefined;
|
1424
|
+
}
|
1425
|
+
const targetDecl = callHierarchyProvider_1.CallHierarchyProvider.getTargetDeclaration(referencesResult.declarations, referencesResult.nodeAtOffset);
|
1426
|
+
return callHierarchyProvider_1.CallHierarchyProvider.getOutgoingCallsForDeclaration(targetDecl, sourceFileInfo.sourceFile.getParseResults(), this._evaluator, token);
|
1427
|
+
}
|
1428
|
+
performQuickAction(filePath, command, args, token) {
|
1429
|
+
const sourceFileInfo = this._getSourceFileInfoFromPath(filePath);
|
1430
|
+
if (!sourceFileInfo) {
|
1431
|
+
return undefined;
|
1432
|
+
}
|
1433
|
+
this._bindFile(sourceFileInfo);
|
1434
|
+
return sourceFileInfo.sourceFile.performQuickAction(command, args, token);
|
1435
|
+
}
|
1436
|
+
test_createSourceMapper(execEnv) {
|
1437
|
+
return this._createSourceMapper(execEnv, /* mapCompiled */ false);
|
1438
|
+
}
|
1439
|
+
_getRenameSymbolMode(sourceFileInfo, referencesResult, isDefaultWorkspace) {
|
1440
|
+
// We have 2 different cases
|
1441
|
+
// Single file mode.
|
1442
|
+
// 1. rename on default workspace (ex, standalone file mode).
|
1443
|
+
// 2. rename local symbols.
|
1444
|
+
// 3. rename symbols defined in the non user open file.
|
1445
|
+
//
|
1446
|
+
// and Multi file mode.
|
1447
|
+
// 1. rename public symbols defined in user files on regular workspace (ex, open folder mode).
|
1448
|
+
const userFile = this._isUserCode(sourceFileInfo);
|
1449
|
+
if (isDefaultWorkspace ||
|
1450
|
+
(userFile && !referencesResult.requiresGlobalSearch) ||
|
1451
|
+
(!userFile &&
|
1452
|
+
sourceFileInfo.isOpenByClient &&
|
1453
|
+
referencesResult.declarations.every((d) => this._getSourceFileInfoFromPath(d.path) === sourceFileInfo))) {
|
1454
|
+
return 'singleFileMode';
|
1455
|
+
}
|
1456
|
+
if (referencesResult.declarations.every((d) => this._isUserCode(this._getSourceFileInfoFromPath(d.path)))) {
|
1457
|
+
return 'multiFileMode';
|
1458
|
+
}
|
1459
|
+
// Rename is not allowed.
|
1460
|
+
// ex) rename symbols from libraries.
|
1461
|
+
return 'none';
|
1462
|
+
}
|
1463
|
+
_supportRenameModule(declarations, isDefaultWorkspace) {
|
1464
|
+
// Rename module is not supported for standalone file and all decls must be on a user file.
|
1465
|
+
return (!isDefaultWorkspace && declarations.every((d) => this._isUserCode(this._getSourceFileInfoFromPath(d.path))));
|
1466
|
+
}
|
1467
|
+
_getReferenceResult(sourceFileInfo, filePath, position, allowModuleRename, token) {
|
1468
|
+
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1469
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv), position, this._evaluator, undefined, token);
|
1470
|
+
if (!referencesResult) {
|
1471
|
+
return undefined;
|
1472
|
+
}
|
1473
|
+
if (allowModuleRename && referencesResult.containsOnlyImportDecls) {
|
1474
|
+
return referencesResult;
|
1475
|
+
}
|
1476
|
+
if (referencesResult.nonImportDeclarations.length === 0) {
|
1477
|
+
// There is no symbol we can rename.
|
1478
|
+
return undefined;
|
1479
|
+
}
|
1480
|
+
// Use declarations that doesn't contain import decls.
|
1481
|
+
return new referencesProvider_1.ReferencesResult(referencesResult.requiresGlobalSearch, referencesResult.nodeAtOffset, referencesResult.symbolName, referencesResult.nonImportDeclarations);
|
1482
|
+
}
|
1483
|
+
_processModuleReferences(renameModuleProvider, filteringText, currentFilePath) {
|
1484
|
+
var _a;
|
1485
|
+
// _sourceFileList contains every user files that match "include" pattern including
|
1486
|
+
// py file even if corresponding pyi exists.
|
1487
|
+
for (const currentFileInfo of this._sourceFileList) {
|
1488
|
+
// Make sure we only touch user code to prevent us
|
1489
|
+
// from accidentally changing third party library or type stub.
|
1490
|
+
if (!this._isUserCode(currentFileInfo)) {
|
1491
|
+
continue;
|
1492
|
+
}
|
1493
|
+
// If module name isn't mentioned in the current file, skip the file
|
1494
|
+
// except the file that got actually renamed/moved.
|
1495
|
+
// The file that got moved might have relative import paths we need to update.
|
1496
|
+
const filePath = currentFileInfo.sourceFile.getFilePath();
|
1497
|
+
const content = (_a = currentFileInfo.sourceFile.getFileContent()) !== null && _a !== void 0 ? _a : '';
|
1498
|
+
if (filePath !== currentFilePath && content.indexOf(filteringText) < 0) {
|
1499
|
+
continue;
|
1500
|
+
}
|
1501
|
+
this._bindFile(currentFileInfo, content);
|
1502
|
+
const parseResult = currentFileInfo.sourceFile.getParseResults();
|
1503
|
+
if (!parseResult) {
|
1504
|
+
continue;
|
1505
|
+
}
|
1506
|
+
renameModuleProvider.renameReferences(filePath, parseResult);
|
1507
|
+
// This operation can consume significant memory, so check
|
1508
|
+
// for situations where we need to discard the type cache.
|
1509
|
+
this._handleMemoryHighUsage();
|
1510
|
+
}
|
1511
|
+
}
|
1512
|
+
_handleMemoryHighUsage() {
|
1513
|
+
const typeCacheEntryCount = this._evaluator.getTypeCacheEntryCount();
|
1514
|
+
const convertToMB = (bytes) => {
|
1515
|
+
return `${Math.round(bytes / (1024 * 1024))}MB`;
|
1516
|
+
};
|
1517
|
+
// If the type cache size has exceeded a high-water mark, query the heap usage.
|
1518
|
+
// Don't bother doing this until we hit this point because the heap usage may not
|
1519
|
+
// drop immediately after we empty the cache due to garbage collection timing.
|
1520
|
+
if (typeCacheEntryCount > 750000 || this._parsedFileCount > 1000) {
|
1521
|
+
const heapStats = (0, v8_1.getHeapStatistics)();
|
1522
|
+
if (this._configOptions.verboseOutput) {
|
1523
|
+
this._console.info(`Heap stats: ` +
|
1524
|
+
`total_heap_size=${convertToMB(heapStats.total_heap_size)}, ` +
|
1525
|
+
`used_heap_size=${convertToMB(heapStats.used_heap_size)}, ` +
|
1526
|
+
`total_physical_size=${convertToMB(heapStats.total_physical_size)}, ` +
|
1527
|
+
`total_available_size=${convertToMB(heapStats.total_available_size)}, ` +
|
1528
|
+
`heap_size_limit=${convertToMB(heapStats.heap_size_limit)}`);
|
1529
|
+
}
|
1530
|
+
// The type cache uses a Map, which has an absolute limit of 2^24 entries
|
1531
|
+
// before it will fail. If we cross the 95% mark, we'll empty the cache.
|
1532
|
+
const absoluteMaxCacheEntryCount = (1 << 24) * 0.9;
|
1533
|
+
// If we use more than 90% of the heap size limit, avoid a crash
|
1534
|
+
// by emptying the type cache.
|
1535
|
+
if (typeCacheEntryCount > absoluteMaxCacheEntryCount ||
|
1536
|
+
heapStats.used_heap_size > heapStats.heap_size_limit * 0.9) {
|
1537
|
+
this._console.info(`Emptying type cache to avoid heap overflow. Used ${convertToMB(heapStats.used_heap_size)} out of ${convertToMB(heapStats.heap_size_limit)} (${typeCacheEntryCount} cache entries).`);
|
1538
|
+
this._createNewEvaluator();
|
1539
|
+
this._discardCachedParseResults();
|
1540
|
+
this._parsedFileCount = 0;
|
1541
|
+
}
|
1542
|
+
}
|
1543
|
+
}
|
1544
|
+
// Discards all cached parse results and file contents to free up memory.
|
1545
|
+
// It does not discard cached index results or diagnostics for files.
|
1546
|
+
_discardCachedParseResults() {
|
1547
|
+
for (const sourceFileInfo of this._sourceFileList) {
|
1548
|
+
sourceFileInfo.sourceFile.dropParseAndBindInfo();
|
1549
|
+
}
|
1550
|
+
}
|
1551
|
+
_isUserCode(fileInfo) {
|
1552
|
+
return fileInfo && fileInfo.isTracked && !fileInfo.isThirdPartyImport && !fileInfo.isTypeshedFile;
|
1553
|
+
}
|
1554
|
+
// Wrapper function that should be used when invoking this._evaluator
|
1555
|
+
// with a cancellation token. It handles cancellation exceptions and
|
1556
|
+
// any other unexpected exceptions.
|
1557
|
+
_runEvaluatorWithCancellationToken(token, callback) {
|
1558
|
+
try {
|
1559
|
+
if (token) {
|
1560
|
+
return this._evaluator.runWithCancellationToken(token, callback);
|
1561
|
+
}
|
1562
|
+
else {
|
1563
|
+
return callback();
|
1564
|
+
}
|
1565
|
+
}
|
1566
|
+
catch (e) {
|
1567
|
+
// An unexpected exception occurred, potentially leaving the current evaluator
|
1568
|
+
// in an inconsistent state. Discard it and replace it with a fresh one. It is
|
1569
|
+
// Cancellation exceptions are known to handle this correctly.
|
1570
|
+
if (!(e instanceof cancellationUtils_1.OperationCanceledException)) {
|
1571
|
+
this._createNewEvaluator();
|
1572
|
+
}
|
1573
|
+
throw e;
|
1574
|
+
}
|
1575
|
+
}
|
1576
|
+
// Returns a list of empty file diagnostic entries for the files
|
1577
|
+
// that have been removed. This is needed to clear out the
|
1578
|
+
// errors for files that have been deleted or closed.
|
1579
|
+
_removeUnneededFiles() {
|
1580
|
+
const fileDiagnostics = [];
|
1581
|
+
// If a file is no longer tracked, opened or shadowed, it can
|
1582
|
+
// be removed from the program.
|
1583
|
+
for (let i = 0; i < this._sourceFileList.length;) {
|
1584
|
+
const fileInfo = this._sourceFileList[i];
|
1585
|
+
if (!this._isFileNeeded(fileInfo)) {
|
1586
|
+
fileDiagnostics.push({
|
1587
|
+
filePath: fileInfo.sourceFile.getFilePath(),
|
1588
|
+
version: fileInfo.sourceFile.getClientVersion(),
|
1589
|
+
diagnostics: [],
|
1590
|
+
});
|
1591
|
+
fileInfo.sourceFile.prepareForClose();
|
1592
|
+
this._removeSourceFileFromListAndMap(fileInfo.sourceFile.getFilePath(), i);
|
1593
|
+
// Unlink any imports and remove them from the list if
|
1594
|
+
// they are no longer referenced.
|
1595
|
+
fileInfo.imports.forEach((importedFile) => {
|
1596
|
+
const indexToRemove = importedFile.importedBy.findIndex((fi) => fi === fileInfo);
|
1597
|
+
if (indexToRemove < 0) {
|
1598
|
+
return;
|
1599
|
+
}
|
1600
|
+
importedFile.importedBy.splice(indexToRemove, 1);
|
1601
|
+
// See if we need to remove the imported file because it
|
1602
|
+
// is no longer needed. If its index is >= i, it will be
|
1603
|
+
// removed when we get to it.
|
1604
|
+
if (!this._isFileNeeded(importedFile)) {
|
1605
|
+
const indexToRemove = this._sourceFileList.findIndex((fi) => fi === importedFile);
|
1606
|
+
if (indexToRemove >= 0 && indexToRemove < i) {
|
1607
|
+
fileDiagnostics.push({
|
1608
|
+
filePath: importedFile.sourceFile.getFilePath(),
|
1609
|
+
version: importedFile.sourceFile.getClientVersion(),
|
1610
|
+
diagnostics: [],
|
1611
|
+
});
|
1612
|
+
importedFile.sourceFile.prepareForClose();
|
1613
|
+
this._removeSourceFileFromListAndMap(importedFile.sourceFile.getFilePath(), indexToRemove);
|
1614
|
+
i--;
|
1615
|
+
}
|
1616
|
+
}
|
1617
|
+
});
|
1618
|
+
// Remove any shadowed files corresponding to this file.
|
1619
|
+
fileInfo.shadowedBy.forEach((shadowedFile) => {
|
1620
|
+
shadowedFile.shadows = shadowedFile.shadows.filter((f) => f !== fileInfo);
|
1621
|
+
});
|
1622
|
+
fileInfo.shadowedBy = [];
|
1623
|
+
}
|
1624
|
+
else {
|
1625
|
+
// If we're showing the user errors only for open files, clear
|
1626
|
+
// out the errors for the now-closed file.
|
1627
|
+
if (!this._shouldCheckFile(fileInfo) && fileInfo.diagnosticsVersion !== undefined) {
|
1628
|
+
fileDiagnostics.push({
|
1629
|
+
filePath: fileInfo.sourceFile.getFilePath(),
|
1630
|
+
version: fileInfo.sourceFile.getClientVersion(),
|
1631
|
+
diagnostics: [],
|
1632
|
+
});
|
1633
|
+
fileInfo.diagnosticsVersion = undefined;
|
1634
|
+
}
|
1635
|
+
i++;
|
1636
|
+
}
|
1637
|
+
}
|
1638
|
+
return fileDiagnostics;
|
1639
|
+
}
|
1640
|
+
_isFileNeeded(fileInfo) {
|
1641
|
+
if (fileInfo.sourceFile.isFileDeleted()) {
|
1642
|
+
return false;
|
1643
|
+
}
|
1644
|
+
if (fileInfo.isTracked || fileInfo.isOpenByClient) {
|
1645
|
+
return true;
|
1646
|
+
}
|
1647
|
+
if (fileInfo.shadows.length > 0) {
|
1648
|
+
return true;
|
1649
|
+
}
|
1650
|
+
if (fileInfo.importedBy.length === 0) {
|
1651
|
+
return false;
|
1652
|
+
}
|
1653
|
+
// It's possible for a cycle of files to be imported
|
1654
|
+
// by a tracked file but then abandoned. The import cycle
|
1655
|
+
// will keep the entire group "alive" if we don't detect
|
1656
|
+
// the condition and garbage collect them.
|
1657
|
+
return this._isImportNeededRecursive(fileInfo, new Map());
|
1658
|
+
}
|
1659
|
+
_isImportNeededRecursive(fileInfo, recursionMap) {
|
1660
|
+
if (fileInfo.isTracked || fileInfo.isOpenByClient || fileInfo.shadows.length > 0) {
|
1661
|
+
return true;
|
1662
|
+
}
|
1663
|
+
const filePath = (0, pathUtils_1.normalizePathCase)(this._fs, fileInfo.sourceFile.getFilePath());
|
1664
|
+
// Avoid infinite recursion.
|
1665
|
+
if (recursionMap.has(filePath)) {
|
1666
|
+
return false;
|
1667
|
+
}
|
1668
|
+
recursionMap.set(filePath, true);
|
1669
|
+
for (const importerInfo of fileInfo.importedBy) {
|
1670
|
+
if (this._isImportNeededRecursive(importerInfo, recursionMap)) {
|
1671
|
+
return true;
|
1672
|
+
}
|
1673
|
+
}
|
1674
|
+
return false;
|
1675
|
+
}
|
1676
|
+
_createSourceMapper(execEnv, mapCompiled, preferStubs) {
|
1677
|
+
const sourceMapper = new sourceMapper_1.SourceMapper(this._importResolver, execEnv, this._evaluator, (stubFilePath, implFilePath) => {
|
1678
|
+
const stubFileInfo = this._getSourceFileInfoFromPath(stubFilePath);
|
1679
|
+
if (!stubFileInfo) {
|
1680
|
+
return undefined;
|
1681
|
+
}
|
1682
|
+
this._addShadowedFile(stubFileInfo, implFilePath);
|
1683
|
+
return this.getBoundSourceFile(implFilePath);
|
1684
|
+
}, (f) => this.getBoundSourceFile(f), mapCompiled !== null && mapCompiled !== void 0 ? mapCompiled : false, preferStubs !== null && preferStubs !== void 0 ? preferStubs : false);
|
1685
|
+
return sourceMapper;
|
1686
|
+
}
|
1687
|
+
_isImportAllowed(importer, importResult, isImportStubFile) {
|
1688
|
+
// Don't import native libs. We don't want to track these files,
|
1689
|
+
// and we definitely don't want to attempt to parse them.
|
1690
|
+
if (importResult.isNativeLib) {
|
1691
|
+
return false;
|
1692
|
+
}
|
1693
|
+
let thirdPartyImportAllowed = this._configOptions.useLibraryCodeForTypes ||
|
1694
|
+
(importResult.importType === 1 /* ThirdParty */ && !!importResult.pyTypedInfo) ||
|
1695
|
+
(importResult.importType === 2 /* Local */ && importer.isThirdPartyPyTypedPresent);
|
1696
|
+
if (importResult.importType === 1 /* ThirdParty */ ||
|
1697
|
+
(importer.isThirdPartyImport && importResult.importType === 2 /* Local */)) {
|
1698
|
+
if (this._allowedThirdPartyImports) {
|
1699
|
+
if (importResult.isRelative) {
|
1700
|
+
// If it's a relative import, we'll allow it because the
|
1701
|
+
// importer was already deemed to be allowed.
|
1702
|
+
thirdPartyImportAllowed = true;
|
1703
|
+
}
|
1704
|
+
else if (this._allowedThirdPartyImports.some((importName) => {
|
1705
|
+
// If this import name is the one that was explicitly
|
1706
|
+
// allowed or is a child of that import name,
|
1707
|
+
// it's considered allowed.
|
1708
|
+
if (importResult.importName === importName) {
|
1709
|
+
return true;
|
1710
|
+
}
|
1711
|
+
if (importResult.importName.startsWith(importName + '.')) {
|
1712
|
+
return true;
|
1713
|
+
}
|
1714
|
+
return false;
|
1715
|
+
})) {
|
1716
|
+
thirdPartyImportAllowed = true;
|
1717
|
+
}
|
1718
|
+
}
|
1719
|
+
// Some libraries ship with stub files that import from non-stubs. Don't
|
1720
|
+
// explore those.
|
1721
|
+
// Don't explore any third-party files unless they're type stub files
|
1722
|
+
// or we've been told explicitly that third-party imports are OK.
|
1723
|
+
if (!isImportStubFile) {
|
1724
|
+
return thirdPartyImportAllowed;
|
1725
|
+
}
|
1726
|
+
}
|
1727
|
+
return true;
|
1728
|
+
}
|
1729
|
+
_updateSourceFileImports(sourceFileInfo, options) {
|
1730
|
+
const filesAdded = [];
|
1731
|
+
// Get the new list of imports and see if it changed from the last
|
1732
|
+
// list of imports for this file.
|
1733
|
+
const imports = sourceFileInfo.sourceFile.getImports();
|
1734
|
+
// Create a local function that determines whether the import should
|
1735
|
+
// be considered a "third-party import" and whether it is coming from
|
1736
|
+
// a third-party package that claims to be typed. An import is
|
1737
|
+
// considered third-party if it is external to the importer
|
1738
|
+
// or is internal but the importer is itself a third-party package.
|
1739
|
+
const getThirdPartyImportInfo = (importResult) => {
|
1740
|
+
let isThirdPartyImport = false;
|
1741
|
+
let isPyTypedPresent = false;
|
1742
|
+
if (importResult.importType === 1 /* ThirdParty */) {
|
1743
|
+
isThirdPartyImport = true;
|
1744
|
+
if (importResult.pyTypedInfo) {
|
1745
|
+
isPyTypedPresent = true;
|
1746
|
+
}
|
1747
|
+
}
|
1748
|
+
else if (sourceFileInfo.isThirdPartyImport && importResult.importType === 2 /* Local */) {
|
1749
|
+
isThirdPartyImport = true;
|
1750
|
+
if (sourceFileInfo.isThirdPartyPyTypedPresent) {
|
1751
|
+
isPyTypedPresent = true;
|
1752
|
+
}
|
1753
|
+
}
|
1754
|
+
return {
|
1755
|
+
isThirdPartyImport,
|
1756
|
+
isPyTypedPresent,
|
1757
|
+
};
|
1758
|
+
};
|
1759
|
+
// Create a map of unique imports, since imports can appear more than once.
|
1760
|
+
const newImportPathMap = new Map();
|
1761
|
+
// Add chained source file as import if it exists.
|
1762
|
+
if (sourceFileInfo.chainedSourceFile) {
|
1763
|
+
if (sourceFileInfo.chainedSourceFile.sourceFile.isFileDeleted()) {
|
1764
|
+
sourceFileInfo.chainedSourceFile = undefined;
|
1765
|
+
}
|
1766
|
+
else {
|
1767
|
+
const filePath = sourceFileInfo.chainedSourceFile.sourceFile.getFilePath();
|
1768
|
+
newImportPathMap.set((0, pathUtils_1.normalizePathCase)(this._fs, filePath), {
|
1769
|
+
path: filePath,
|
1770
|
+
isTypeshedFile: false,
|
1771
|
+
isThirdPartyImport: false,
|
1772
|
+
isPyTypedPresent: false,
|
1773
|
+
});
|
1774
|
+
}
|
1775
|
+
}
|
1776
|
+
imports.forEach((importResult) => {
|
1777
|
+
if (importResult.isImportFound) {
|
1778
|
+
if (this._isImportAllowed(sourceFileInfo, importResult, importResult.isStubFile)) {
|
1779
|
+
if (importResult.resolvedPaths.length > 0) {
|
1780
|
+
const filePath = importResult.resolvedPaths[importResult.resolvedPaths.length - 1];
|
1781
|
+
if (filePath) {
|
1782
|
+
const thirdPartyTypeInfo = getThirdPartyImportInfo(importResult);
|
1783
|
+
newImportPathMap.set((0, pathUtils_1.normalizePathCase)(this._fs, filePath), {
|
1784
|
+
path: filePath,
|
1785
|
+
isTypeshedFile: !!importResult.isTypeshedFile,
|
1786
|
+
isThirdPartyImport: thirdPartyTypeInfo.isThirdPartyImport,
|
1787
|
+
isPyTypedPresent: thirdPartyTypeInfo.isPyTypedPresent,
|
1788
|
+
});
|
1789
|
+
}
|
1790
|
+
}
|
1791
|
+
}
|
1792
|
+
importResult.filteredImplicitImports.forEach((implicitImport) => {
|
1793
|
+
if (this._isImportAllowed(sourceFileInfo, importResult, implicitImport.isStubFile)) {
|
1794
|
+
if (!implicitImport.isNativeLib) {
|
1795
|
+
const thirdPartyTypeInfo = getThirdPartyImportInfo(importResult);
|
1796
|
+
newImportPathMap.set((0, pathUtils_1.normalizePathCase)(this._fs, implicitImport.path), {
|
1797
|
+
path: implicitImport.path,
|
1798
|
+
isTypeshedFile: !!importResult.isTypeshedFile,
|
1799
|
+
isThirdPartyImport: thirdPartyTypeInfo.isThirdPartyImport,
|
1800
|
+
isPyTypedPresent: thirdPartyTypeInfo.isPyTypedPresent,
|
1801
|
+
});
|
1802
|
+
}
|
1803
|
+
}
|
1804
|
+
});
|
1805
|
+
}
|
1806
|
+
else if (options.verboseOutput) {
|
1807
|
+
this._console.info(`Could not import '${importResult.importName}' ` +
|
1808
|
+
`in file '${sourceFileInfo.sourceFile.getFilePath()}'`);
|
1809
|
+
if (importResult.importFailureInfo) {
|
1810
|
+
importResult.importFailureInfo.forEach((diag) => {
|
1811
|
+
this._console.info(` ${diag}`);
|
1812
|
+
});
|
1813
|
+
}
|
1814
|
+
}
|
1815
|
+
});
|
1816
|
+
const updatedImportMap = new Map();
|
1817
|
+
sourceFileInfo.imports.forEach((importInfo) => {
|
1818
|
+
const oldFilePath = (0, pathUtils_1.normalizePathCase)(this._fs, importInfo.sourceFile.getFilePath());
|
1819
|
+
// A previous import was removed.
|
1820
|
+
if (!newImportPathMap.has(oldFilePath)) {
|
1821
|
+
importInfo.importedBy = importInfo.importedBy.filter((fi) => (0, pathUtils_1.normalizePathCase)(this._fs, fi.sourceFile.getFilePath()) !==
|
1822
|
+
(0, pathUtils_1.normalizePathCase)(this._fs, sourceFileInfo.sourceFile.getFilePath()));
|
1823
|
+
}
|
1824
|
+
else {
|
1825
|
+
updatedImportMap.set(oldFilePath, importInfo);
|
1826
|
+
}
|
1827
|
+
});
|
1828
|
+
// See if there are any new imports to be added.
|
1829
|
+
newImportPathMap.forEach((importInfo, normalizedImportPath) => {
|
1830
|
+
if (!updatedImportMap.has(normalizedImportPath)) {
|
1831
|
+
// We found a new import to add. See if it's already part
|
1832
|
+
// of the program.
|
1833
|
+
let importedFileInfo;
|
1834
|
+
if (this._getSourceFileInfoFromPath(importInfo.path)) {
|
1835
|
+
importedFileInfo = this._getSourceFileInfoFromPath(importInfo.path);
|
1836
|
+
}
|
1837
|
+
else {
|
1838
|
+
const importName = this._getImportNameForFile(importInfo.path);
|
1839
|
+
const sourceFile = new sourceFile_1.SourceFile(this._fs, importInfo.path, importName, importInfo.isThirdPartyImport, importInfo.isPyTypedPresent, this._console, this._logTracker);
|
1840
|
+
importedFileInfo = {
|
1841
|
+
sourceFile,
|
1842
|
+
isTracked: false,
|
1843
|
+
isOpenByClient: false,
|
1844
|
+
isTypeshedFile: importInfo.isTypeshedFile,
|
1845
|
+
isThirdPartyImport: importInfo.isThirdPartyImport,
|
1846
|
+
isThirdPartyPyTypedPresent: importInfo.isPyTypedPresent,
|
1847
|
+
diagnosticsVersion: undefined,
|
1848
|
+
imports: [],
|
1849
|
+
importedBy: [],
|
1850
|
+
shadows: [],
|
1851
|
+
shadowedBy: [],
|
1852
|
+
};
|
1853
|
+
this._addToSourceFileListAndMap(importedFileInfo);
|
1854
|
+
filesAdded.push(importedFileInfo);
|
1855
|
+
}
|
1856
|
+
importedFileInfo.importedBy.push(sourceFileInfo);
|
1857
|
+
updatedImportMap.set(normalizedImportPath, importedFileInfo);
|
1858
|
+
}
|
1859
|
+
});
|
1860
|
+
// Update the imports list. It should now map the set of imports
|
1861
|
+
// specified by the source file.
|
1862
|
+
sourceFileInfo.imports = [];
|
1863
|
+
newImportPathMap.forEach((_, path) => {
|
1864
|
+
if (this._getSourceFileInfoFromPath(path)) {
|
1865
|
+
sourceFileInfo.imports.push(this._getSourceFileInfoFromPath(path));
|
1866
|
+
}
|
1867
|
+
});
|
1868
|
+
// Resolve the builtins import for the file. This needs to be
|
1869
|
+
// analyzed before the file can be analyzed.
|
1870
|
+
sourceFileInfo.builtinsImport = undefined;
|
1871
|
+
const builtinsImport = sourceFileInfo.sourceFile.getBuiltinsImport();
|
1872
|
+
if (builtinsImport && builtinsImport.isImportFound) {
|
1873
|
+
const resolvedBuiltinsPath = builtinsImport.resolvedPaths[builtinsImport.resolvedPaths.length - 1];
|
1874
|
+
sourceFileInfo.builtinsImport = this._getSourceFileInfoFromPath(resolvedBuiltinsPath);
|
1875
|
+
}
|
1876
|
+
// Resolve the ipython display import for the file. This needs to be
|
1877
|
+
// analyzed before the file can be analyzed.
|
1878
|
+
sourceFileInfo.ipythonDisplayImport = undefined;
|
1879
|
+
const ipythonDisplayImport = sourceFileInfo.sourceFile.getIPythonDisplayImport();
|
1880
|
+
if (ipythonDisplayImport && ipythonDisplayImport.isImportFound) {
|
1881
|
+
const resolvedIPythonDisplayPath = ipythonDisplayImport.resolvedPaths[ipythonDisplayImport.resolvedPaths.length - 1];
|
1882
|
+
sourceFileInfo.ipythonDisplayImport = this._getSourceFileInfoFromPath(resolvedIPythonDisplayPath);
|
1883
|
+
}
|
1884
|
+
return filesAdded;
|
1885
|
+
}
|
1886
|
+
_getSourceFileInfoFromPath(filePath) {
|
1887
|
+
return this._sourceFileMap.get((0, pathUtils_1.normalizePathCase)(this._fs, filePath));
|
1888
|
+
}
|
1889
|
+
_removeSourceFileFromListAndMap(filePath, indexToRemove) {
|
1890
|
+
this._sourceFileMap.delete((0, pathUtils_1.normalizePathCase)(this._fs, filePath));
|
1891
|
+
this._sourceFileList.splice(indexToRemove, 1);
|
1892
|
+
}
|
1893
|
+
_addToSourceFileListAndMap(fileInfo) {
|
1894
|
+
const filePath = (0, pathUtils_1.normalizePathCase)(this._fs, fileInfo.sourceFile.getFilePath());
|
1895
|
+
// We should never add a file with the same path twice.
|
1896
|
+
(0, debug_1.assert)(!this._sourceFileMap.has(filePath));
|
1897
|
+
this._sourceFileList.push(fileInfo);
|
1898
|
+
this._sourceFileMap.set(filePath, fileInfo);
|
1899
|
+
}
|
1900
|
+
}
|
1901
|
+
exports.Program = Program;
|
1902
|
+
//# sourceMappingURL=program.js.map
|