@zzzen/pyright-internal 1.2.0-dev.20260809 → 1.2.0-dev.20260823
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/analyzerNodeInfo.d.ts +119 -24
- package/dist/analyzer/analyzerNodeInfo.js +408 -89
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/binder.d.ts +6 -3
- package/dist/analyzer/binder.js +157 -70
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.d.ts +5 -2
- package/dist/analyzer/checker.js +92 -34
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +2 -1
- package/dist/analyzer/codeFlowEngine.js +12 -10
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/codeFlowUtils.d.ts +2 -1
- package/dist/analyzer/codeFlowUtils.js +2 -3
- package/dist/analyzer/codeFlowUtils.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +47 -7
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructors.js +18 -8
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.d.ts +6 -4
- package/dist/analyzer/dataClasses.js +119 -75
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declarationUtils.d.ts +2 -1
- package/dist/analyzer/declarationUtils.js +2 -2
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/decorators.d.ts +5 -4
- package/dist/analyzer/decorators.js +38 -21
- package/dist/analyzer/decorators.js.map +1 -1
- package/dist/analyzer/enums.d.ts +5 -4
- package/dist/analyzer/enums.js +11 -10
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +1 -1
- package/dist/analyzer/importResolver.js +5 -3
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importStatementUtils.d.ts +3 -1
- package/dist/analyzer/importStatementUtils.js +14 -7
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/namedTuples.d.ts +2 -1
- package/dist/analyzer/namedTuples.js +3 -4
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/operations.d.ts +3 -2
- package/dist/analyzer/operations.js +8 -8
- package/dist/analyzer/operations.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +2 -2
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +13 -11
- package/dist/analyzer/parseTreeUtils.js +62 -36
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/parseTreeWalker.d.ts +7 -2
- package/dist/analyzer/parseTreeWalker.js +29 -175
- package/dist/analyzer/parseTreeWalker.js.map +1 -1
- package/dist/analyzer/patternMatching.d.ts +4 -3
- package/dist/analyzer/patternMatching.js +47 -43
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +12 -0
- package/dist/analyzer/program.js +235 -29
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.d.ts +4 -3
- package/dist/analyzer/properties.js +7 -8
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +14 -2
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/scope.d.ts +3 -0
- package/dist/analyzer/scope.js +10 -0
- package/dist/analyzer/scope.js.map +1 -1
- package/dist/analyzer/scopeUtils.d.ts +4 -3
- package/dist/analyzer/scopeUtils.js +8 -8
- package/dist/analyzer/scopeUtils.js.map +1 -1
- package/dist/analyzer/sentinel.d.ts +2 -1
- package/dist/analyzer/sentinel.js +2 -3
- package/dist/analyzer/sentinel.js.map +1 -1
- package/dist/analyzer/service.js +28 -10
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceEnumerator.d.ts +5 -0
- package/dist/analyzer/sourceEnumerator.js +57 -3
- package/dist/analyzer/sourceEnumerator.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +12 -6
- package/dist/analyzer/sourceFile.js +73 -50
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceFileInfoUtils.d.ts +1 -0
- package/dist/analyzer/sourceFileInfoUtils.js +8 -0
- package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
- package/dist/analyzer/sourceMapper.d.ts +4 -1
- package/dist/analyzer/sourceMapper.js +14 -8
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/symbol.d.ts +4 -1
- package/dist/analyzer/symbol.js +8 -0
- package/dist/analyzer/symbol.js.map +1 -1
- package/dist/analyzer/testWalker.js +2 -1
- package/dist/analyzer/testWalker.js.map +1 -1
- package/dist/analyzer/tracePrinter.d.ts +2 -1
- package/dist/analyzer/tracePrinter.js +2 -2
- package/dist/analyzer/tracePrinter.js.map +1 -1
- package/dist/analyzer/tuples.d.ts +3 -2
- package/dist/analyzer/tuples.js +5 -5
- package/dist/analyzer/tuples.js.map +1 -1
- package/dist/analyzer/typeCacheUtils.d.ts +6 -2
- package/dist/analyzer/typeCacheUtils.js +16 -37
- package/dist/analyzer/typeCacheUtils.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.d.ts +5 -7
- package/dist/analyzer/typeDocStringUtils.js +229 -132
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.d.ts +2 -0
- package/dist/analyzer/typeEvaluator.js +1280 -302
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +2 -0
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.d.ts +3 -2
- package/dist/analyzer/typeGuards.js +37 -33
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typeStubWriter.js +12 -9
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.js +3 -1
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.d.ts +4 -3
- package/dist/analyzer/typedDicts.js +15 -14
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +11 -1
- package/dist/analyzer/types.js +48 -0
- package/dist/analyzer/types.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/common/collectionUtils.js +15 -6
- package/dist/common/collectionUtils.js.map +1 -1
- package/dist/common/commandLineOptions.d.ts +1 -0
- package/dist/common/commandLineOptions.js.map +1 -1
- package/dist/common/configOptions.d.ts +4 -1
- package/dist/common/configOptions.js +68 -12
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/envVarUtils.d.ts +1 -0
- package/dist/common/envVarUtils.js +41 -10
- package/dist/common/envVarUtils.js.map +1 -1
- package/dist/common/extensibility.d.ts +3 -1
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/extraPathGlob.d.ts +12 -0
- package/dist/common/extraPathGlob.js +315 -0
- package/dist/common/extraPathGlob.js.map +1 -0
- package/dist/common/host.d.ts +2 -0
- package/dist/common/host.js.map +1 -1
- package/dist/common/languageServerInterface.d.ts +2 -1
- package/dist/common/languageServerInterface.js.map +1 -1
- package/dist/common/pathConsts.d.ts +1 -0
- package/dist/common/pathConsts.js +11 -1
- package/dist/common/pathConsts.js.map +1 -1
- package/dist/common/processUtils.d.ts +4 -2
- package/dist/common/processUtils.js +3 -0
- package/dist/common/processUtils.js.map +1 -1
- package/dist/common/stringUtils.d.ts +6 -0
- package/dist/common/stringUtils.js +87 -5
- package/dist/common/stringUtils.js.map +1 -1
- package/dist/common/textEditTracker.d.ts +3 -1
- package/dist/common/textEditTracker.js +8 -6
- package/dist/common/textEditTracker.js.map +1 -1
- package/dist/common/textRangeCollection.d.ts +1 -0
- package/dist/common/textRangeCollection.js +32 -1
- package/dist/common/textRangeCollection.js.map +1 -1
- package/dist/common/uri/uriUtils.d.ts +3 -0
- package/dist/common/uri/uriUtils.js +65 -15
- package/dist/common/uri/uriUtils.js.map +1 -1
- package/dist/fileSystemMapping.d.ts +10 -0
- package/dist/fileSystemMapping.js +176 -0
- package/dist/fileSystemMapping.js.map +1 -0
- package/dist/languageService/analyzerServiceExecutor.js +2 -1
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
- package/dist/languageService/autoImporter.d.ts +1 -0
- package/dist/languageService/autoImporter.js +32 -5
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.d.ts +7 -0
- package/dist/languageService/callHierarchyProvider.js +97 -11
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +30 -8
- package/dist/languageService/completionProvider.js +298 -93
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/definitionProvider.js +7 -6
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentHighlightProvider.js +2 -1
- package/dist/languageService/documentHighlightProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.d.ts +3 -1
- package/dist/languageService/documentSymbolCollector.js +78 -14
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.js +3 -2
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/fileWatcherDynamicFeature.js +28 -1
- package/dist/languageService/fileWatcherDynamicFeature.js.map +1 -1
- package/dist/languageService/hoverProvider.d.ts +2 -1
- package/dist/languageService/hoverProvider.js +48 -16
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/importSorter.d.ts +3 -1
- package/dist/languageService/importSorter.js +4 -2
- package/dist/languageService/importSorter.js.map +1 -1
- package/dist/languageService/importStatementCandidates.js +4 -2
- package/dist/languageService/importStatementCandidates.js.map +1 -1
- package/dist/languageService/quickActions.js +2 -1
- package/dist/languageService/quickActions.js.map +1 -1
- package/dist/languageService/referencesProvider.js +12 -5
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.d.ts +3 -0
- package/dist/languageService/signatureHelpProvider.js +56 -18
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.d.ts +2 -1
- package/dist/languageService/symbolIndexer.js +7 -7
- package/dist/languageService/symbolIndexer.js.map +1 -1
- package/dist/languageService/tooltipUtils.d.ts +1 -1
- package/dist/languageService/tooltipUtils.js +103 -35
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/languageService/workspaceSymbolProvider.js +3 -2
- package/dist/languageService/workspaceSymbolProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +12 -0
- package/dist/localization/localize.js +14 -0
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +11 -0
- package/dist/localization/package.nls.de.json +11 -0
- package/dist/localization/package.nls.en-us.json +18 -0
- package/dist/localization/package.nls.es.json +11 -0
- package/dist/localization/package.nls.fr.json +11 -0
- package/dist/localization/package.nls.it.json +11 -0
- package/dist/localization/package.nls.ja.json +11 -0
- package/dist/localization/package.nls.ko.json +11 -0
- package/dist/localization/package.nls.pl.json +11 -0
- package/dist/localization/package.nls.pt-br.json +11 -0
- package/dist/localization/package.nls.qps-ploc.json +11 -0
- package/dist/localization/package.nls.ru.json +11 -0
- package/dist/localization/package.nls.tr.json +11 -0
- package/dist/localization/package.nls.zh-cn.json +12 -1
- package/dist/localization/package.nls.zh-tw.json +13 -2
- package/dist/parser/parseNodes.d.ts +85 -80
- package/dist/parser/parseNodes.js +182 -159
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parseTreeUtils.d.ts +3 -0
- package/dist/parser/parseTreeUtils.js +209 -0
- package/dist/parser/parseTreeUtils.js.map +1 -0
- package/dist/parser/parser.d.ts +16 -6
- package/dist/parser/parser.js +210 -144
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/stringAnnotationInfo.d.ts +16 -0
- package/dist/parser/stringAnnotationInfo.js +26 -0
- package/dist/parser/stringAnnotationInfo.js.map +1 -0
- package/dist/readonlyAugmentedFileSystem.d.ts +2 -9
- package/dist/readonlyAugmentedFileSystem.js +17 -144
- package/dist/readonlyAugmentedFileSystem.js.map +1 -1
- package/dist/server.js +2 -2
- package/dist/server.js.map +1 -1
- package/dist/tests/analyzerNodeInfo.test.d.ts +1 -0
- package/dist/tests/analyzerNodeInfo.test.js +113 -0
- package/dist/tests/analyzerNodeInfo.test.js.map +1 -0
- package/dist/tests/collectionUtils.test.js +46 -0
- package/dist/tests/collectionUtils.test.js.map +1 -1
- package/dist/tests/completions.test.js +34 -0
- package/dist/tests/completions.test.js.map +1 -1
- package/dist/tests/config.test.js +131 -6
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/extraPathGlob.test.d.ts +1 -0
- package/dist/tests/extraPathGlob.test.js +434 -0
- package/dist/tests/extraPathGlob.test.js.map +1 -0
- package/dist/tests/fileSystemMapping.test.d.ts +1 -0
- package/dist/tests/fileSystemMapping.test.js +458 -0
- package/dist/tests/fileSystemMapping.test.js.map +1 -0
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.js +23 -0
- package/dist/tests/fourslash/completions.call.typedDict.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js +14 -0
- package/dist/tests/fourslash/completions.call.typedDict.list.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js +7 -0
- package/dist/tests/fourslash/completions.call.typedDict.states.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.callSite.isinstanceNarrowing.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.callSite.isinstanceNarrowing.fourslash.js +41 -0
- package/dist/tests/fourslash/completions.callSite.isinstanceNarrowing.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js +2 -0
- package/dist/tests/fourslash/completions.dictionary.keys.literalTypes.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js +5 -0
- package/dist/tests/fourslash/completions.fstring.stringLiteral.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.js +4 -0
- package/dist/tests/fourslash/completions.stringLiteral.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findallreferences.protocolMemberVariable.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findallreferences.protocolMemberVariable.fourslash.js +48 -0
- package/dist/tests/fourslash/findallreferences.protocolMemberVariable.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js +8 -2
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js +5 -2
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js +2 -2
- package/dist/tests/fourslash/signature.docstrings.overloaded.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.js +1 -1
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/hoverProvider.test.js +38 -0
- package/dist/tests/hoverProvider.test.js.map +1 -1
- package/dist/tests/importStatementUtils.test.js +6 -3
- package/dist/tests/importStatementUtils.test.js.map +1 -1
- package/dist/tests/ipythonMode.test.js +38 -0
- package/dist/tests/ipythonMode.test.js.map +1 -1
- package/dist/tests/parseTreeUtils.test.js +88 -0
- package/dist/tests/parseTreeUtils.test.js.map +1 -1
- package/dist/tests/parser.test.js +60 -3
- package/dist/tests/parser.test.js.map +1 -1
- package/dist/tests/positionUtils.test.js +23 -0
- package/dist/tests/positionUtils.test.js.map +1 -1
- package/dist/tests/pyrightFileSystem.test.js +41 -0
- package/dist/tests/pyrightFileSystem.test.js.map +1 -1
- package/dist/tests/service.test.js +77 -0
- package/dist/tests/service.test.js.map +1 -1
- package/dist/tests/sourceEnumeratorSymlink.test.d.ts +1 -0
- package/dist/tests/sourceEnumeratorSymlink.test.js +203 -0
- package/dist/tests/sourceEnumeratorSymlink.test.js.map +1 -0
- package/dist/tests/stringUtils.test.js +84 -0
- package/dist/tests/stringUtils.test.js.map +1 -1
- package/dist/tests/symlinkAliasInvalidation.test.d.ts +1 -0
- package/dist/tests/symlinkAliasInvalidation.test.js +471 -0
- package/dist/tests/symlinkAliasInvalidation.test.js.map +1 -0
- package/dist/tests/testUtils.d.ts +2 -0
- package/dist/tests/testUtils.js +7 -1
- package/dist/tests/testUtils.js.map +1 -1
- package/dist/tests/textEditUtil.test.js +2 -2
- package/dist/tests/textEditUtil.test.js.map +1 -1
- package/dist/tests/textRangeCollection.test.d.ts +1 -0
- package/dist/tests/textRangeCollection.test.js +137 -0
- package/dist/tests/textRangeCollection.test.js.map +1 -0
- package/dist/tests/typeCacheUtils.test.d.ts +1 -0
- package/dist/tests/typeCacheUtils.test.js +69 -0
- package/dist/tests/typeCacheUtils.test.js.map +1 -0
- package/dist/tests/typeEvaluator1.test.js +24 -3
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +8 -0
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +4 -0
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +12 -0
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typeEvaluator6.test.js +33 -1
- package/dist/tests/typeEvaluator6.test.js.map +1 -1
- package/dist/tests/typeEvaluator7.test.js +29 -0
- package/dist/tests/typeEvaluator7.test.js.map +1 -1
- package/dist/tests/typeEvaluator8.test.js +318 -4
- package/dist/tests/typeEvaluator8.test.js.map +1 -1
- package/dist/tests/typeServer/typeCache.test.d.ts +1 -0
- package/dist/tests/typeServer/typeCache.test.js +69 -0
- package/dist/tests/typeServer/typeCache.test.js.map +1 -0
- package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.js +18 -0
- package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.js.map +1 -1
- package/dist/tests/types.test.d.ts +1 -0
- package/dist/{analyzer/parseTreeCleaner.js → tests/types.test.js} +23 -25
- package/dist/tests/types.test.js.map +1 -0
- package/dist/tests/uri.test.js +51 -0
- package/dist/tests/uri.test.js.map +1 -1
- package/dist/typeServer/notebookDocumentHandler.d.ts +9 -2
- package/dist/typeServer/notebookDocumentHandler.js +16 -6
- package/dist/typeServer/notebookDocumentHandler.js.map +1 -1
- package/dist/typeServer/programWrapper.d.ts +1 -0
- package/dist/typeServer/programWrapper.js +28 -15
- package/dist/typeServer/programWrapper.js.map +1 -1
- package/dist/typeServer/protocol/tspSupplemental.d.ts +1 -1
- package/dist/typeServer/protocol/tspSupplemental.js +2 -2
- package/dist/typeServer/server.d.ts +13 -2
- package/dist/typeServer/server.js +36 -23
- package/dist/typeServer/server.js.map +1 -1
- package/dist/typeServer/typeCache.d.ts +8 -4
- package/dist/typeServer/typeCache.js +33 -5
- package/dist/typeServer/typeCache.js.map +1 -1
- package/dist/typeServer/typeEvalUtils.d.ts +2 -1
- package/dist/typeServer/typeEvalUtils.js +7 -3
- package/dist/typeServer/typeEvalUtils.js.map +1 -1
- package/dist/typeServer/typeServerFileSystem.d.ts +10 -9
- package/dist/typeServer/typeServerFileSystem.js +16 -12
- package/dist/typeServer/typeServerFileSystem.js.map +1 -1
- package/package.json +7 -5
- package/dist/analyzer/parseTreeCleaner.d.ts +0 -8
- package/dist/analyzer/parseTreeCleaner.js.map +0 -1
package/dist/analyzer/program.js
CHANGED
|
@@ -58,6 +58,7 @@ require("../common/serviceProviderExtensions");
|
|
|
58
58
|
const textRange_1 = require("../common/textRange");
|
|
59
59
|
const timing_1 = require("../common/timing");
|
|
60
60
|
const uri_1 = require("../common/uri/uri");
|
|
61
|
+
const uriUtils_1 = require("../common/uri/uriUtils");
|
|
61
62
|
const cellChainIndex_1 = require("./cellChainIndex");
|
|
62
63
|
const AnalyzerNodeInfo = __importStar(require("./analyzerNodeInfo"));
|
|
63
64
|
const cacheManager_1 = require("./cacheManager");
|
|
@@ -81,15 +82,23 @@ function isTaggedHintDiagnostic(diag) {
|
|
|
81
82
|
// Track edit mode related information.
|
|
82
83
|
class EditModeTracker {
|
|
83
84
|
constructor() {
|
|
85
|
+
this.analysisContextOwner = this;
|
|
84
86
|
this._isEditMode = false;
|
|
87
|
+
this._isClonedProgram = false;
|
|
85
88
|
this._mutatedFiles = [];
|
|
86
89
|
}
|
|
87
90
|
get isEditMode() {
|
|
88
91
|
return this._isEditMode;
|
|
89
92
|
}
|
|
93
|
+
get isClonedProgram() {
|
|
94
|
+
return this._isClonedProgram;
|
|
95
|
+
}
|
|
90
96
|
addMutatedFiles(file) {
|
|
91
97
|
this._mutatedFiles.push(file);
|
|
92
98
|
}
|
|
99
|
+
markClonedProgram() {
|
|
100
|
+
this._isClonedProgram = true;
|
|
101
|
+
}
|
|
93
102
|
enable() {
|
|
94
103
|
this._isEditMode = true;
|
|
95
104
|
this._mutatedFiles = [];
|
|
@@ -113,6 +122,16 @@ class Program {
|
|
|
113
122
|
this._disableChecker = _disableChecker;
|
|
114
123
|
this._sourceFileList = [];
|
|
115
124
|
this._sourceFileMap = new Map();
|
|
125
|
+
// A filesystem symlink and its target are tracked as separate SourceFileInfo
|
|
126
|
+
// entries (the source-file map is keyed by uri.key with no realpath dedup).
|
|
127
|
+
// These indexes let invalidation bridge such aliases so a change routed to one
|
|
128
|
+
// alias also re-checks consumers of the other.
|
|
129
|
+
// _realpathAliasMap groups uri.keys that share a realpath (only populated for
|
|
130
|
+
// symlink-involved groups); _realpathByUriKey caches each user file's realpath
|
|
131
|
+
// key so removal/lookup don't recompute it.
|
|
132
|
+
this._realpathAliasMap = new Map();
|
|
133
|
+
this._realpathByUriKey = new Map();
|
|
134
|
+
this._analyzerNodeInfoContext = new AnalyzerNodeInfo.AnalyzerNodeInfoContextImpl();
|
|
116
135
|
this._cellChainIndex = new cellChainIndex_1.CellChainIndex(() => this._sourceFileList, (uri) => this.getSourceFileInfo(uri));
|
|
117
136
|
this._disposed = false;
|
|
118
137
|
this._parsedFileCount = 0;
|
|
@@ -174,8 +193,8 @@ class Program {
|
|
|
174
193
|
}
|
|
175
194
|
const parseResults = sourceFileInfo.sourceFile.getParserOutput();
|
|
176
195
|
const moduleNode = parseResults.parseTree;
|
|
177
|
-
const fileInfo = AnalyzerNodeInfo.getFileInfo(moduleNode);
|
|
178
|
-
const dunderAllInfo = AnalyzerNodeInfo.getDunderAllInfo(parseResults.parseTree);
|
|
196
|
+
const fileInfo = AnalyzerNodeInfo.getFileInfo(moduleNode, this._analyzerNodeInfoContext);
|
|
197
|
+
const dunderAllInfo = AnalyzerNodeInfo.getDunderAllInfo(parseResults.parseTree, this._analyzerNodeInfoContext);
|
|
179
198
|
return {
|
|
180
199
|
symbolTable,
|
|
181
200
|
dunderAllNames: dunderAllInfo?.names,
|
|
@@ -227,13 +246,21 @@ class Program {
|
|
|
227
246
|
get cellChainIndex() {
|
|
228
247
|
return this._cellChainIndex;
|
|
229
248
|
}
|
|
249
|
+
get analyzerNodeInfoContext() {
|
|
250
|
+
return this._analyzerNodeInfoContext;
|
|
251
|
+
}
|
|
252
|
+
get analyzerNodeInfoReader() {
|
|
253
|
+
return this._analyzerNodeInfoContext;
|
|
254
|
+
}
|
|
230
255
|
dispose() {
|
|
231
256
|
this.disposeInternal(this._disposed);
|
|
257
|
+
this._analyzerNodeInfoContext.dispose();
|
|
232
258
|
this._cacheManager.unregisterCacheOwner(this);
|
|
233
259
|
this._disposed = true;
|
|
234
260
|
}
|
|
235
261
|
enterEditMode() {
|
|
236
262
|
this._editModeTracker.enable();
|
|
263
|
+
this._analyzerNodeInfoContext.enterOverlay();
|
|
237
264
|
}
|
|
238
265
|
exitEditMode() {
|
|
239
266
|
// Stop applying edit mode to new source files.
|
|
@@ -278,6 +305,14 @@ class Program {
|
|
|
278
305
|
// All cache is invalid now.
|
|
279
306
|
this._createNewEvaluator();
|
|
280
307
|
}
|
|
308
|
+
// Keep overlay-produced bindings only for parse trees that survived source-file restoration.
|
|
309
|
+
for (const info of this._sourceFileList) {
|
|
310
|
+
const parseTree = info.sourceFile.getParserOutput()?.parseTree;
|
|
311
|
+
if (parseTree) {
|
|
312
|
+
this._analyzerNodeInfoContext.promoteToPreviousLayer(parseTree);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
this._analyzerNodeInfoContext.discardOverlay();
|
|
281
316
|
return edits;
|
|
282
317
|
}
|
|
283
318
|
setConfigOptions(configOptions) {
|
|
@@ -349,6 +384,10 @@ class Program {
|
|
|
349
384
|
// search paths. Clear any cached module name so it is recomputed.
|
|
350
385
|
sourceFileInfo.sourceFile.clearCachedModuleName();
|
|
351
386
|
sourceFileInfo.isTracked = true;
|
|
387
|
+
// The file may have first been added as an untracked referenced import
|
|
388
|
+
// (skipped by the user-code-only realpath alias index). Now that it is
|
|
389
|
+
// tracked, (re-)index it so symlink-twin co-invalidation applies.
|
|
390
|
+
this._indexRealpathAlias(sourceFileInfo);
|
|
352
391
|
return sourceFileInfo.sourceFile;
|
|
353
392
|
}
|
|
354
393
|
// Detect py.typed status if not explicitly provided. This ensures that
|
|
@@ -441,9 +480,21 @@ class Program {
|
|
|
441
480
|
// We need to mark the file dirty so we can re-analyze next time.
|
|
442
481
|
// This won't matter much for OpenFileOnly users, but it will matter for
|
|
443
482
|
// people who use diagnosticMode Workspace.
|
|
483
|
+
const markDirtySet = new Set();
|
|
444
484
|
if (sourceFileInfo.sourceFile.didContentsChangeOnDisk()) {
|
|
445
485
|
sourceFileInfo.sourceFile.markDirty();
|
|
446
|
-
this._markFileDirtyRecursive(sourceFileInfo,
|
|
486
|
+
this._markFileDirtyRecursive(sourceFileInfo, markDirtySet);
|
|
487
|
+
}
|
|
488
|
+
// Co-invalidate symlink twins so consumers that imported the other
|
|
489
|
+
// alias get re-checked as well.
|
|
490
|
+
this._markRealpathAliasesDirty(sourceFileInfo, markDirtySet);
|
|
491
|
+
// If anything was marked dirty (the closed file's own dependency
|
|
492
|
+
// subtree or a symlink twin's), recreate the evaluator so the
|
|
493
|
+
// re-checked consumers re-resolve against fresh types instead of the
|
|
494
|
+
// stale type cache. This mirrors markFilesDirty's markDirtySet.size
|
|
495
|
+
// check so the close path cannot silently diverge from it.
|
|
496
|
+
if (markDirtySet.size > 0) {
|
|
497
|
+
this._createNewEvaluator();
|
|
447
498
|
}
|
|
448
499
|
}
|
|
449
500
|
return this._removeUnneededFiles();
|
|
@@ -480,13 +531,19 @@ class Program {
|
|
|
480
531
|
// If !evenIfContentsAreSame, see if the on-disk contents have
|
|
481
532
|
// changed. If the file is open, the on-disk contents don't matter
|
|
482
533
|
// because we'll receive updates directly from the client.
|
|
483
|
-
if (evenIfContentsAreSame
|
|
484
|
-
(!sourceFileInfo.isOpenByClient && sourceFileInfo.sourceFile.didContentsChangeOnDisk())) {
|
|
534
|
+
if (this._shouldContentInvalidate(sourceFileInfo, evenIfContentsAreSame)) {
|
|
485
535
|
sourceFileInfo.sourceFile.markDirty();
|
|
486
536
|
// Mark any files that depend on this file as dirty
|
|
487
537
|
// also. This will retrigger analysis of these other files.
|
|
488
538
|
this._markFileDirtyRecursive(sourceFileInfo, markDirtySet);
|
|
489
539
|
}
|
|
540
|
+
// A filesystem symlink and its target are tracked as separate
|
|
541
|
+
// SourceFileInfo entries. A change routed to one alias (e.g. the fs
|
|
542
|
+
// watcher fires for the real target path) must also re-parse the
|
|
543
|
+
// other alias(es) sharing the same realpath and re-check their
|
|
544
|
+
// dependents; otherwise stale diagnostics persist on consumers
|
|
545
|
+
// that imported the twin.
|
|
546
|
+
this._markRealpathAliasesDirty(sourceFileInfo, markDirtySet);
|
|
490
547
|
}
|
|
491
548
|
});
|
|
492
549
|
if (markDirtySet.size > 0) {
|
|
@@ -859,22 +916,28 @@ class Program {
|
|
|
859
916
|
}
|
|
860
917
|
clone() {
|
|
861
918
|
const program = new Program(this._importResolver, this._configOptions, this.serviceProvider, new logTracker_1.LogTracker(this._console, 'Cloned'), this._disableChecker);
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
for (const fileInfo of
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
919
|
+
program._editModeTracker.markClonedProgram();
|
|
920
|
+
// Clone user and open files in their original order. Open files must be created
|
|
921
|
+
// with their full construction metadata before they are marked as tracked;
|
|
922
|
+
// precreating them as plain tracked files loses virtual-document and IPython state.
|
|
923
|
+
const filesToClone = this._sourceFileList.filter((fileInfo) => (0, sourceFileInfoUtils_1.isUserCode)(fileInfo) || fileInfo.isOpenByClient);
|
|
924
|
+
for (const fileInfo of filesToClone) {
|
|
925
|
+
if (fileInfo.isOpenByClient) {
|
|
926
|
+
program._addClonedOpenFile(fileInfo);
|
|
927
|
+
}
|
|
928
|
+
else {
|
|
929
|
+
program.addTrackedFile(fileInfo.uri);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
program.setTrackedFiles(filesToClone.filter((fileInfo) => fileInfo.isTracked).map((fileInfo) => fileInfo.uri));
|
|
933
|
+
// Restore chains only after every source exists, since a predecessor can appear
|
|
934
|
+
// later in source-file order.
|
|
935
|
+
for (const fileInfo of filesToClone) {
|
|
936
|
+
if (fileInfo.isOpenByClient && fileInfo.chainedSourceFile) {
|
|
937
|
+
program.updateChainedUri(fileInfo.uri, fileInfo.chainedSourceFile.uri);
|
|
871
938
|
}
|
|
872
|
-
program.setFileOpened(fileInfo.uri, version, fileInfo.sourceFile.getOpenFileContents() ?? '', {
|
|
873
|
-
chainedFileUri: fileInfo.chainedSourceFile?.uri,
|
|
874
|
-
ipythonMode: fileInfo.ipythonMode,
|
|
875
|
-
isVirtual: fileInfo.isVirtual,
|
|
876
|
-
});
|
|
877
939
|
}
|
|
940
|
+
program.markAllFilesDirty(/* evenIfContentsAreSame */ true);
|
|
878
941
|
return program;
|
|
879
942
|
}
|
|
880
943
|
// Returns a value from 0 to 1 (or more) indicating how "full" the cache is
|
|
@@ -914,6 +977,23 @@ class Program {
|
|
|
914
977
|
createNewEvaluatorInternal() {
|
|
915
978
|
// Empty
|
|
916
979
|
}
|
|
980
|
+
_addClonedOpenFile(originalFileInfo) {
|
|
981
|
+
const version = originalFileInfo.sourceFile.getClientVersion();
|
|
982
|
+
if (version === undefined) {
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
const sourceFile = this._sourceFileFactory.createSourceFile(this.serviceProvider, originalFileInfo.uri, (uri) => this._getModuleName(uri), originalFileInfo.isThirdPartyImport, originalFileInfo.isThirdPartyPyTypedPresent, this._editModeTracker, this._console, this._logTracker, originalFileInfo.ipythonMode);
|
|
986
|
+
const sourceFileInfo = new sourceFileInfo_1.SourceFileInfo(sourceFile, originalFileInfo.isTypeshedFile, originalFileInfo.isThirdPartyImport, originalFileInfo.isThirdPartyPyTypedPresent, this._editModeTracker, {
|
|
987
|
+
isTracked: originalFileInfo.isTracked,
|
|
988
|
+
isVirtual: originalFileInfo.isVirtual,
|
|
989
|
+
isOpenByClient: true,
|
|
990
|
+
});
|
|
991
|
+
this._addToSourceFileListAndMap(sourceFileInfo);
|
|
992
|
+
if (sourceFileInfo.ipythonMode === sourceFile_1.IPythonMode.CellDocs) {
|
|
993
|
+
this._cellChainIndex.invalidate();
|
|
994
|
+
}
|
|
995
|
+
sourceFile.setClientVersion(version, originalFileInfo.sourceFile.getOpenFileContents() ?? '');
|
|
996
|
+
}
|
|
917
997
|
_handleMemoryHighUsage() {
|
|
918
998
|
const cacheUsage = this._cacheManager.getCacheUsage();
|
|
919
999
|
const usedHeapRatio = this._cacheManager.getUsedHeapRatio(this._configOptions.verboseOutput ? this._console : undefined);
|
|
@@ -937,7 +1017,7 @@ class Program {
|
|
|
937
1017
|
// It does not discard cached index results or diagnostics for files.
|
|
938
1018
|
_discardCachedParseResults() {
|
|
939
1019
|
for (const sourceFileInfo of this._sourceFileList) {
|
|
940
|
-
sourceFileInfo.sourceFile
|
|
1020
|
+
this._dropParseAndBindInfo(sourceFileInfo.sourceFile);
|
|
941
1021
|
}
|
|
942
1022
|
}
|
|
943
1023
|
_runEvaluatorWithCancellationToken(token, callback) {
|
|
@@ -1072,7 +1152,7 @@ class Program {
|
|
|
1072
1152
|
return false;
|
|
1073
1153
|
}
|
|
1074
1154
|
_createSourceMapper(execEnv, token, from, mapCompiled, preferStubs) {
|
|
1075
|
-
const sourceMapper = new sourceMapper_1.SourceMapper(this._importResolver, execEnv, this._evaluator, (stubFileUri, implFileUri) => this.bindShadowFile(stubFileUri, implFileUri), (f) => {
|
|
1155
|
+
const sourceMapper = new sourceMapper_1.SourceMapper(this._importResolver, execEnv, this._evaluator, this._analyzerNodeInfoContext, (stubFileUri, implFileUri) => this.bindShadowFile(stubFileUri, implFileUri), (f) => {
|
|
1076
1156
|
let fileInfo = this.getBoundSourceFileInfo(f);
|
|
1077
1157
|
if (!fileInfo) {
|
|
1078
1158
|
// make sure uri exits before adding interimFile
|
|
@@ -1314,9 +1394,20 @@ class Program {
|
|
|
1314
1394
|
return filesAdded;
|
|
1315
1395
|
}
|
|
1316
1396
|
_removeSourceFileFromListAndMap(fileUri, indexToRemove) {
|
|
1397
|
+
const sourceFileInfo = this._sourceFileMap.get(fileUri.key);
|
|
1398
|
+
if (sourceFileInfo) {
|
|
1399
|
+
this._dropParseAndBindInfo(sourceFileInfo.sourceFile);
|
|
1400
|
+
}
|
|
1401
|
+
this._unindexRealpathAlias(fileUri);
|
|
1317
1402
|
this._sourceFileMap.delete(fileUri.key);
|
|
1318
1403
|
this._sourceFileList.splice(indexToRemove, 1);
|
|
1319
1404
|
}
|
|
1405
|
+
_dropParseAndBindInfo(sourceFile) {
|
|
1406
|
+
const parseTree = sourceFile.dropParseAndBindInfo();
|
|
1407
|
+
if (parseTree) {
|
|
1408
|
+
this._analyzerNodeInfoContext.remove(parseTree);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1320
1411
|
_addToSourceFileListAndMap(fileInfo) {
|
|
1321
1412
|
const fileUri = fileInfo.uri;
|
|
1322
1413
|
// We should never add a file with the same path twice.
|
|
@@ -1325,6 +1416,121 @@ class Program {
|
|
|
1325
1416
|
(0, debug_1.assert)(!fileUri.isEmpty());
|
|
1326
1417
|
this._sourceFileList.push(fileInfo);
|
|
1327
1418
|
this._sourceFileMap.set(fileUri.key, fileInfo);
|
|
1419
|
+
this._indexRealpathAlias(fileInfo);
|
|
1420
|
+
}
|
|
1421
|
+
// Record the file's realpath so symlink twins can co-invalidate each other.
|
|
1422
|
+
// Only user-code files participate: library/typeshed files are resolved to
|
|
1423
|
+
// their real paths during import resolution and are not diagnostic-checked,
|
|
1424
|
+
// so indexing them would only add realpath syscalls without benefit.
|
|
1425
|
+
_indexRealpathAlias(fileInfo) {
|
|
1426
|
+
if (!(0, sourceFileInfoUtils_1.isUserCode)(fileInfo)) {
|
|
1427
|
+
return;
|
|
1428
|
+
}
|
|
1429
|
+
const fileUri = fileInfo.uri;
|
|
1430
|
+
// Cache hit: this URI's realpath is already indexed, so skip the
|
|
1431
|
+
// filesystem syscall and redundant group bookkeeping. This matters
|
|
1432
|
+
// because `addTrackedFile` re-indexes already-tracked files (e.g. the
|
|
1433
|
+
// untracked -> tracked flip). Watcher-driven changes remove the file
|
|
1434
|
+
// first (clearing this cache via `_unindexRealpathAlias`) before
|
|
1435
|
+
// re-adding, so a genuinely retargeted symlink is recomputed on re-add.
|
|
1436
|
+
if (this._realpathByUriKey.has(fileUri.key)) {
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
const realpathUri = (0, uriUtils_1.tryRealpath)(this.fileSystem, fileUri) ?? fileUri;
|
|
1440
|
+
const realpathKey = realpathUri.key;
|
|
1441
|
+
this._realpathByUriKey.set(fileUri.key, realpathKey);
|
|
1442
|
+
// Add this file to its realpath group when it is either reached through a
|
|
1443
|
+
// symlink (its realpath differs from its own URI) or a realpath target
|
|
1444
|
+
// that already has aliases pointing at it. The latter lets a re-add of
|
|
1445
|
+
// only the realpath target rebuild the group instead of orphaning the
|
|
1446
|
+
// aliases that still reference it.
|
|
1447
|
+
const existingGroup = this._realpathAliasMap.get(realpathKey);
|
|
1448
|
+
if (realpathKey !== fileUri.key || existingGroup) {
|
|
1449
|
+
let aliasKeys = existingGroup;
|
|
1450
|
+
if (!aliasKeys) {
|
|
1451
|
+
aliasKeys = new Set();
|
|
1452
|
+
this._realpathAliasMap.set(realpathKey, aliasKeys);
|
|
1453
|
+
}
|
|
1454
|
+
aliasKeys.add(fileUri.key);
|
|
1455
|
+
aliasKeys.add(realpathKey);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
_unindexRealpathAlias(fileUri) {
|
|
1459
|
+
const realpathKey = this._realpathByUriKey.get(fileUri.key);
|
|
1460
|
+
if (realpathKey === undefined) {
|
|
1461
|
+
return;
|
|
1462
|
+
}
|
|
1463
|
+
this._realpathByUriKey.delete(fileUri.key);
|
|
1464
|
+
const aliasKeys = this._realpathAliasMap.get(realpathKey);
|
|
1465
|
+
if (!aliasKeys) {
|
|
1466
|
+
return;
|
|
1467
|
+
}
|
|
1468
|
+
aliasKeys.delete(fileUri.key);
|
|
1469
|
+
// Retain the group only while at least one member is still indexed
|
|
1470
|
+
// (present in _realpathByUriKey). Keeping a lingering group that still
|
|
1471
|
+
// holds an indexed member lets a later re-add of the realpath target
|
|
1472
|
+
// (or another alias) rebuild the twin relationship instead of orphaning
|
|
1473
|
+
// it. But when the only keys left are unindexed seeds — e.g. a realpath
|
|
1474
|
+
// target that was never added because it resolves outside the workspace
|
|
1475
|
+
// — drop the group so such single-entry remnants can't accumulate over a
|
|
1476
|
+
// long session that churns those links.
|
|
1477
|
+
let hasIndexedMember = false;
|
|
1478
|
+
for (const key of aliasKeys) {
|
|
1479
|
+
if (this._realpathByUriKey.has(key)) {
|
|
1480
|
+
hasIndexedMember = true;
|
|
1481
|
+
break;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
if (!hasIndexedMember) {
|
|
1485
|
+
this._realpathAliasMap.delete(realpathKey);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
// Predicate used by the primary `markFilesDirty`/`markAllFilesDirty` loops
|
|
1489
|
+
// (and, with evenIfContentsAreSame fixed to false, by twin invalidation).
|
|
1490
|
+
// When !evenIfContentsAreSame, only invalidate a file whose on-disk contents
|
|
1491
|
+
// actually changed and that isn't open by the client (open docs receive their
|
|
1492
|
+
// content directly from the client via the normal update path). When
|
|
1493
|
+
// evenIfContentsAreSame is set, always invalidate.
|
|
1494
|
+
_shouldContentInvalidate(fileInfo, evenIfContentsAreSame) {
|
|
1495
|
+
return evenIfContentsAreSame || (!fileInfo.isOpenByClient && fileInfo.sourceFile.didContentsChangeOnDisk());
|
|
1496
|
+
}
|
|
1497
|
+
// Content-invalidate the realpath twin(s) of the given file and re-check their
|
|
1498
|
+
// dependents. The twin must be marked dirty at the CONTENT level (markDirty),
|
|
1499
|
+
// not merely re-check-required, so its symbol table is re-parsed from the
|
|
1500
|
+
// updated backing file before consumers re-resolve against it.
|
|
1501
|
+
//
|
|
1502
|
+
// Twin fan-out ALWAYS uses the disk-change predicate (never the primary's
|
|
1503
|
+
// evenIfContentsAreSame flag): a twin only needs re-parsing when its own
|
|
1504
|
+
// backing file actually changed on disk. In particular, an in-memory edit to
|
|
1505
|
+
// one open alias (updateOpenFileContents -> markFilesDirty(evenIfContentsAreSame=true))
|
|
1506
|
+
// must NOT force the twin and its importer subtree to be re-checked on every
|
|
1507
|
+
// keystroke, since the twin's on-disk contents are unchanged.
|
|
1508
|
+
_markRealpathAliasesDirty(sourceFileInfo, markDirtySet) {
|
|
1509
|
+
const realpathKey = this._realpathByUriKey.get(sourceFileInfo.uri.key);
|
|
1510
|
+
if (realpathKey === undefined) {
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
const aliasKeys = this._realpathAliasMap.get(realpathKey);
|
|
1514
|
+
if (!aliasKeys || aliasKeys.size <= 1) {
|
|
1515
|
+
return;
|
|
1516
|
+
}
|
|
1517
|
+
aliasKeys.forEach((aliasKey) => {
|
|
1518
|
+
if (aliasKey === sourceFileInfo.uri.key || markDirtySet.has(aliasKey)) {
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
const aliasInfo = this._sourceFileMap.get(aliasKey);
|
|
1522
|
+
if (!aliasInfo) {
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
// Only invalidate the twin when its own backing file changed on disk
|
|
1526
|
+
// (and it isn't open by the client). This deliberately ignores the
|
|
1527
|
+
// primary file's evenIfContentsAreSame flag so unsaved edits to one
|
|
1528
|
+
// alias don't repeatedly re-check the other alias's dependents.
|
|
1529
|
+
if (this._shouldContentInvalidate(aliasInfo, /* evenIfContentsAreSame */ false)) {
|
|
1530
|
+
aliasInfo.sourceFile.markDirty();
|
|
1531
|
+
this._markFileDirtyRecursive(aliasInfo, markDirtySet);
|
|
1532
|
+
}
|
|
1533
|
+
});
|
|
1328
1534
|
}
|
|
1329
1535
|
_getModuleName(fileUri) {
|
|
1330
1536
|
const moduleInfo = this._getModuleImportInfoForFile(fileUri);
|
|
@@ -1381,8 +1587,9 @@ class Program {
|
|
|
1381
1587
|
minimumLoggingThreshold: this._configOptions.typeEvaluationTimeThreshold,
|
|
1382
1588
|
evaluateUnknownImportsAsAny: !!this._configOptions.evaluateUnknownImportsAsAny,
|
|
1383
1589
|
verifyTypeCacheEvaluatorFlags: !!this._configOptions.internalTestMode,
|
|
1590
|
+
nodeInfoReader: this._analyzerNodeInfoContext,
|
|
1384
1591
|
}, this._logTracker, this._configOptions.logTypeEvaluationTime
|
|
1385
|
-
? (0, tracePrinter_1.createTracePrinter)(this._importResolver.getImportRoots(this._configOptions.findExecEnvironment(this._configOptions.projectRoot)))
|
|
1592
|
+
? (0, tracePrinter_1.createTracePrinter)(this._importResolver.getImportRoots(this._configOptions.findExecEnvironment(this._configOptions.projectRoot)), this._analyzerNodeInfoContext)
|
|
1386
1593
|
: undefined);
|
|
1387
1594
|
return this._evaluator;
|
|
1388
1595
|
}
|
|
@@ -1468,7 +1675,7 @@ class Program {
|
|
|
1468
1675
|
return undefined;
|
|
1469
1676
|
}
|
|
1470
1677
|
// File should already be bound because of the chained file binding above.
|
|
1471
|
-
const scope = AnalyzerNodeInfo.getScope(parseResults.parseTree);
|
|
1678
|
+
const scope = AnalyzerNodeInfo.getScope(parseResults.parseTree, this._analyzerNodeInfoContext);
|
|
1472
1679
|
return scope;
|
|
1473
1680
|
};
|
|
1474
1681
|
let builtinsScope;
|
|
@@ -1496,8 +1703,7 @@ class Program {
|
|
|
1496
1703
|
futureImports = this._getEffectiveFutureImports(futureImports, fileToBind.chainedSourceFile);
|
|
1497
1704
|
}
|
|
1498
1705
|
fileToBind.effectiveFutureImports = futureImports.size > 0 ? futureImports : undefined;
|
|
1499
|
-
fileToBind.sourceFile.bind(this._configOptions, this._lookUpImport, builtinsScope, futureImports, fileToBind.ipythonMode === sourceFile_1.IPythonMode.CellDocs ? this._cellChainIndex : undefined);
|
|
1500
|
-
return true;
|
|
1706
|
+
return fileToBind.sourceFile.bind(this._configOptions, this._lookUpImport, builtinsScope, futureImports, fileToBind.ipythonMode === sourceFile_1.IPythonMode.CellDocs ? this._cellChainIndex : undefined, this._analyzerNodeInfoContext);
|
|
1501
1707
|
}
|
|
1502
1708
|
_getEffectiveFutureImports(futureImports, chainedSourceFile) {
|
|
1503
1709
|
const effectiveFutureImports = new Set(futureImports);
|
|
@@ -1556,7 +1762,7 @@ class Program {
|
|
|
1556
1762
|
}
|
|
1557
1763
|
}
|
|
1558
1764
|
if (boundFile) {
|
|
1559
|
-
fileToCheck.sourceFile.check(this.configOptions, this._lookUpImport, this._importResolver, this._evaluator, dependentFiles);
|
|
1765
|
+
fileToCheck.sourceFile.check(this.configOptions, this._lookUpImport, this._importResolver, this._evaluator, dependentFiles, this._analyzerNodeInfoContext);
|
|
1560
1766
|
}
|
|
1561
1767
|
}
|
|
1562
1768
|
// Detect import cycles that involve the file.
|
|
@@ -1632,7 +1838,7 @@ class Program {
|
|
|
1632
1838
|
if (file.sourceFile.isBindingRequired()) {
|
|
1633
1839
|
continue;
|
|
1634
1840
|
}
|
|
1635
|
-
const fileInfo = AnalyzerNodeInfo.getFileInfo(parseResults.parseTree);
|
|
1841
|
+
const fileInfo = AnalyzerNodeInfo.getFileInfo(parseResults.parseTree, this._analyzerNodeInfoContext);
|
|
1636
1842
|
if (fileInfo.accessedSymbolSet) {
|
|
1637
1843
|
dependentFiles.push(parseResults);
|
|
1638
1844
|
}
|
|
@@ -1738,7 +1944,7 @@ class Program {
|
|
|
1738
1944
|
if (markSet.has(fileUri.key)) {
|
|
1739
1945
|
return;
|
|
1740
1946
|
}
|
|
1741
|
-
sourceFileInfo.sourceFile.markReanalysisRequired(forceRebinding);
|
|
1947
|
+
sourceFileInfo.sourceFile.markReanalysisRequired(forceRebinding, this._analyzerNodeInfoContext);
|
|
1742
1948
|
markSet.add(fileUri.key);
|
|
1743
1949
|
sourceFileInfo.importedBy.forEach((dep) => {
|
|
1744
1950
|
// Changes on chained source file can change symbols in the symbol table and
|
|
@@ -1759,7 +1965,7 @@ class Program {
|
|
|
1759
1965
|
}
|
|
1760
1966
|
reevaluationRequired = true;
|
|
1761
1967
|
chainedSourceFile.sourceFile.markReanalysisRequired(
|
|
1762
|
-
/* forceRebinding */ sourceFileInfo.ipythonMode === sourceFile_1.IPythonMode.CellDocs);
|
|
1968
|
+
/* forceRebinding */ sourceFileInfo.ipythonMode === sourceFile_1.IPythonMode.CellDocs, this._analyzerNodeInfoContext);
|
|
1763
1969
|
chainedSourceFile = chainedSourceFile.chainedSourceFile;
|
|
1764
1970
|
}
|
|
1765
1971
|
// If the checker is going to run again, we have to recreate the type evaluator so
|