@zzzen/pyright-internal 1.2.0-dev.20260816 → 1.2.0-dev.20260830
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 +123 -24
- package/dist/analyzer/analyzerNodeInfo.js +429 -89
- package/dist/analyzer/analyzerNodeInfo.js.map +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +2 -1
- package/dist/analyzer/backgroundAnalysisProgram.js +4 -8
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.d.ts +6 -3
- package/dist/analyzer/binder.js +70 -69
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.d.ts +4 -2
- package/dist/analyzer/checker.js +86 -59
- 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/constructorTransform.js +8 -0
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/dataClasses.d.ts +5 -4
- package/dist/analyzer/dataClasses.js +30 -59
- 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 +20 -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 +238 -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/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 +3 -2
- package/dist/analyzer/sentinel.js +4 -5
- package/dist/analyzer/sentinel.js.map +1 -1
- package/dist/analyzer/service.d.ts +5 -10
- package/dist/analyzer/service.js +36 -96
- 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 +74 -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/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/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 +418 -229
- 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 +159 -35
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typeStubGeneration.d.ts +64 -0
- package/dist/analyzer/typeStubGeneration.js +226 -0
- package/dist/analyzer/typeStubGeneration.js.map +1 -0
- package/dist/analyzer/typeStubMessages.d.ts +4 -0
- package/dist/analyzer/typeStubMessages.js +25 -0
- package/dist/analyzer/typeStubMessages.js.map +1 -0
- package/dist/analyzer/typeStubOutput.d.ts +9 -0
- package/dist/analyzer/typeStubOutput.js +52 -0
- package/dist/analyzer/typeStubOutput.js.map +1 -0
- package/dist/analyzer/typeStubRenderer.d.ts +5 -0
- package/dist/analyzer/{typeStubWriter.js → typeStubRenderer.js} +20 -99
- package/dist/analyzer/typeStubRenderer.js.map +1 -0
- package/dist/analyzer/typeUtils.d.ts +1 -0
- package/dist/analyzer/typeUtils.js +115 -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 +2 -0
- package/dist/analyzer/types.js +84 -58
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +5 -4
- package/dist/backgroundAnalysisBase.js +11 -19
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/commands/createTypeStub.d.ts +2 -6
- package/dist/commands/createTypeStub.js +14 -27
- package/dist/commands/createTypeStub.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 -1
- 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/languageServerBase.d.ts +1 -1
- package/dist/languageServerBase.js +2 -2
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/analyzerServiceExecutor.d.ts +1 -3
- package/dist/languageService/analyzerServiceExecutor.js +10 -29
- 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 +6 -0
- package/dist/localization/localize.js +10 -0
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.cs.json +15 -0
- package/dist/localization/package.nls.de.json +15 -0
- package/dist/localization/package.nls.en-us.json +5 -0
- package/dist/localization/package.nls.es.json +15 -0
- package/dist/localization/package.nls.fr.json +15 -0
- package/dist/localization/package.nls.it.json +15 -0
- package/dist/localization/package.nls.ja.json +15 -0
- package/dist/localization/package.nls.ko.json +15 -0
- package/dist/localization/package.nls.pl.json +15 -0
- package/dist/localization/package.nls.pt-br.json +15 -0
- package/dist/localization/package.nls.qps-ploc.json +15 -0
- package/dist/localization/package.nls.ru.json +15 -0
- package/dist/localization/package.nls.tr.json +15 -0
- package/dist/localization/package.nls.zh-cn.json +16 -1
- package/dist/localization/package.nls.zh-tw.json +17 -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/pyright.js +30 -17
- package/dist/pyright.js.map +1 -1
- 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 +145 -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 -7
- 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.docFromSrc.stubs-package.fourslash.js +0 -1
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
- 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/pyrightCli.test.d.ts +1 -0
- package/dist/tests/pyrightCli.test.js +205 -0
- package/dist/tests/pyrightCli.test.js.map +1 -0
- package/dist/tests/pyrightFileSystem.test.js +41 -0
- package/dist/tests/pyrightFileSystem.test.js.map +1 -1
- package/dist/tests/service.test.js +183 -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/typeEquality.test.d.ts +1 -0
- package/dist/tests/typeEquality.test.js +95 -0
- package/dist/tests/typeEquality.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/typeEvaluator2.test.js +4 -0
- package/dist/tests/typeEvaluator2.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 +8 -0
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +1 -1
- package/dist/tests/typeEvaluator6.test.js +5 -1
- package/dist/tests/typeEvaluator6.test.js.map +1 -1
- package/dist/tests/typeEvaluator7.test.js +4 -0
- package/dist/tests/typeEvaluator7.test.js.map +1 -1
- package/dist/tests/typeEvaluator8.test.js +4 -0
- 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/typeStubGeneration.test.d.ts +1 -0
- package/dist/tests/typeStubGeneration.test.js +397 -0
- package/dist/tests/typeStubGeneration.test.js.map +1 -0
- package/dist/tests/typeStubOutput.test.d.ts +1 -0
- package/dist/tests/typeStubOutput.test.js +136 -0
- package/dist/tests/typeStubOutput.test.js.map +1 -0
- package/dist/tests/typeUtils.test.d.ts +1 -0
- package/dist/tests/typeUtils.test.js +133 -0
- package/dist/tests/typeUtils.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/typeGuards.js +3 -4
- package/dist/typeServer/typeGuards.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 +0 -65
- package/dist/analyzer/parseTreeCleaner.js.map +0 -1
- package/dist/analyzer/typeStubWriter.d.ts +0 -17
- package/dist/analyzer/typeStubWriter.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,10 @@ 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.dropParseAndBindInfo();
|
|
1020
|
+
const parseTree = sourceFileInfo.sourceFile.dropParseAndBindInfo();
|
|
1021
|
+
if (parseTree) {
|
|
1022
|
+
this._analyzerNodeInfoContext.retainRemovedStore(parseTree);
|
|
1023
|
+
}
|
|
941
1024
|
}
|
|
942
1025
|
}
|
|
943
1026
|
_runEvaluatorWithCancellationToken(token, callback) {
|
|
@@ -1072,7 +1155,7 @@ class Program {
|
|
|
1072
1155
|
return false;
|
|
1073
1156
|
}
|
|
1074
1157
|
_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) => {
|
|
1158
|
+
const sourceMapper = new sourceMapper_1.SourceMapper(this._importResolver, execEnv, this._evaluator, this._analyzerNodeInfoContext, (stubFileUri, implFileUri) => this.bindShadowFile(stubFileUri, implFileUri), (f) => {
|
|
1076
1159
|
let fileInfo = this.getBoundSourceFileInfo(f);
|
|
1077
1160
|
if (!fileInfo) {
|
|
1078
1161
|
// make sure uri exits before adding interimFile
|
|
@@ -1314,9 +1397,20 @@ class Program {
|
|
|
1314
1397
|
return filesAdded;
|
|
1315
1398
|
}
|
|
1316
1399
|
_removeSourceFileFromListAndMap(fileUri, indexToRemove) {
|
|
1400
|
+
const sourceFileInfo = this._sourceFileMap.get(fileUri.key);
|
|
1401
|
+
if (sourceFileInfo) {
|
|
1402
|
+
this._dropParseAndBindInfo(sourceFileInfo.sourceFile);
|
|
1403
|
+
}
|
|
1404
|
+
this._unindexRealpathAlias(fileUri);
|
|
1317
1405
|
this._sourceFileMap.delete(fileUri.key);
|
|
1318
1406
|
this._sourceFileList.splice(indexToRemove, 1);
|
|
1319
1407
|
}
|
|
1408
|
+
_dropParseAndBindInfo(sourceFile) {
|
|
1409
|
+
const parseTree = sourceFile.dropParseAndBindInfo();
|
|
1410
|
+
if (parseTree) {
|
|
1411
|
+
this._analyzerNodeInfoContext.remove(parseTree);
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1320
1414
|
_addToSourceFileListAndMap(fileInfo) {
|
|
1321
1415
|
const fileUri = fileInfo.uri;
|
|
1322
1416
|
// We should never add a file with the same path twice.
|
|
@@ -1325,6 +1419,121 @@ class Program {
|
|
|
1325
1419
|
(0, debug_1.assert)(!fileUri.isEmpty());
|
|
1326
1420
|
this._sourceFileList.push(fileInfo);
|
|
1327
1421
|
this._sourceFileMap.set(fileUri.key, fileInfo);
|
|
1422
|
+
this._indexRealpathAlias(fileInfo);
|
|
1423
|
+
}
|
|
1424
|
+
// Record the file's realpath so symlink twins can co-invalidate each other.
|
|
1425
|
+
// Only user-code files participate: library/typeshed files are resolved to
|
|
1426
|
+
// their real paths during import resolution and are not diagnostic-checked,
|
|
1427
|
+
// so indexing them would only add realpath syscalls without benefit.
|
|
1428
|
+
_indexRealpathAlias(fileInfo) {
|
|
1429
|
+
if (!(0, sourceFileInfoUtils_1.isUserCode)(fileInfo)) {
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
const fileUri = fileInfo.uri;
|
|
1433
|
+
// Cache hit: this URI's realpath is already indexed, so skip the
|
|
1434
|
+
// filesystem syscall and redundant group bookkeeping. This matters
|
|
1435
|
+
// because `addTrackedFile` re-indexes already-tracked files (e.g. the
|
|
1436
|
+
// untracked -> tracked flip). Watcher-driven changes remove the file
|
|
1437
|
+
// first (clearing this cache via `_unindexRealpathAlias`) before
|
|
1438
|
+
// re-adding, so a genuinely retargeted symlink is recomputed on re-add.
|
|
1439
|
+
if (this._realpathByUriKey.has(fileUri.key)) {
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
const realpathUri = (0, uriUtils_1.tryRealpath)(this.fileSystem, fileUri) ?? fileUri;
|
|
1443
|
+
const realpathKey = realpathUri.key;
|
|
1444
|
+
this._realpathByUriKey.set(fileUri.key, realpathKey);
|
|
1445
|
+
// Add this file to its realpath group when it is either reached through a
|
|
1446
|
+
// symlink (its realpath differs from its own URI) or a realpath target
|
|
1447
|
+
// that already has aliases pointing at it. The latter lets a re-add of
|
|
1448
|
+
// only the realpath target rebuild the group instead of orphaning the
|
|
1449
|
+
// aliases that still reference it.
|
|
1450
|
+
const existingGroup = this._realpathAliasMap.get(realpathKey);
|
|
1451
|
+
if (realpathKey !== fileUri.key || existingGroup) {
|
|
1452
|
+
let aliasKeys = existingGroup;
|
|
1453
|
+
if (!aliasKeys) {
|
|
1454
|
+
aliasKeys = new Set();
|
|
1455
|
+
this._realpathAliasMap.set(realpathKey, aliasKeys);
|
|
1456
|
+
}
|
|
1457
|
+
aliasKeys.add(fileUri.key);
|
|
1458
|
+
aliasKeys.add(realpathKey);
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
_unindexRealpathAlias(fileUri) {
|
|
1462
|
+
const realpathKey = this._realpathByUriKey.get(fileUri.key);
|
|
1463
|
+
if (realpathKey === undefined) {
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
this._realpathByUriKey.delete(fileUri.key);
|
|
1467
|
+
const aliasKeys = this._realpathAliasMap.get(realpathKey);
|
|
1468
|
+
if (!aliasKeys) {
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
aliasKeys.delete(fileUri.key);
|
|
1472
|
+
// Retain the group only while at least one member is still indexed
|
|
1473
|
+
// (present in _realpathByUriKey). Keeping a lingering group that still
|
|
1474
|
+
// holds an indexed member lets a later re-add of the realpath target
|
|
1475
|
+
// (or another alias) rebuild the twin relationship instead of orphaning
|
|
1476
|
+
// it. But when the only keys left are unindexed seeds — e.g. a realpath
|
|
1477
|
+
// target that was never added because it resolves outside the workspace
|
|
1478
|
+
// — drop the group so such single-entry remnants can't accumulate over a
|
|
1479
|
+
// long session that churns those links.
|
|
1480
|
+
let hasIndexedMember = false;
|
|
1481
|
+
for (const key of aliasKeys) {
|
|
1482
|
+
if (this._realpathByUriKey.has(key)) {
|
|
1483
|
+
hasIndexedMember = true;
|
|
1484
|
+
break;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
if (!hasIndexedMember) {
|
|
1488
|
+
this._realpathAliasMap.delete(realpathKey);
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
// Predicate used by the primary `markFilesDirty`/`markAllFilesDirty` loops
|
|
1492
|
+
// (and, with evenIfContentsAreSame fixed to false, by twin invalidation).
|
|
1493
|
+
// When !evenIfContentsAreSame, only invalidate a file whose on-disk contents
|
|
1494
|
+
// actually changed and that isn't open by the client (open docs receive their
|
|
1495
|
+
// content directly from the client via the normal update path). When
|
|
1496
|
+
// evenIfContentsAreSame is set, always invalidate.
|
|
1497
|
+
_shouldContentInvalidate(fileInfo, evenIfContentsAreSame) {
|
|
1498
|
+
return evenIfContentsAreSame || (!fileInfo.isOpenByClient && fileInfo.sourceFile.didContentsChangeOnDisk());
|
|
1499
|
+
}
|
|
1500
|
+
// Content-invalidate the realpath twin(s) of the given file and re-check their
|
|
1501
|
+
// dependents. The twin must be marked dirty at the CONTENT level (markDirty),
|
|
1502
|
+
// not merely re-check-required, so its symbol table is re-parsed from the
|
|
1503
|
+
// updated backing file before consumers re-resolve against it.
|
|
1504
|
+
//
|
|
1505
|
+
// Twin fan-out ALWAYS uses the disk-change predicate (never the primary's
|
|
1506
|
+
// evenIfContentsAreSame flag): a twin only needs re-parsing when its own
|
|
1507
|
+
// backing file actually changed on disk. In particular, an in-memory edit to
|
|
1508
|
+
// one open alias (updateOpenFileContents -> markFilesDirty(evenIfContentsAreSame=true))
|
|
1509
|
+
// must NOT force the twin and its importer subtree to be re-checked on every
|
|
1510
|
+
// keystroke, since the twin's on-disk contents are unchanged.
|
|
1511
|
+
_markRealpathAliasesDirty(sourceFileInfo, markDirtySet) {
|
|
1512
|
+
const realpathKey = this._realpathByUriKey.get(sourceFileInfo.uri.key);
|
|
1513
|
+
if (realpathKey === undefined) {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
const aliasKeys = this._realpathAliasMap.get(realpathKey);
|
|
1517
|
+
if (!aliasKeys || aliasKeys.size <= 1) {
|
|
1518
|
+
return;
|
|
1519
|
+
}
|
|
1520
|
+
aliasKeys.forEach((aliasKey) => {
|
|
1521
|
+
if (aliasKey === sourceFileInfo.uri.key || markDirtySet.has(aliasKey)) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
const aliasInfo = this._sourceFileMap.get(aliasKey);
|
|
1525
|
+
if (!aliasInfo) {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
// Only invalidate the twin when its own backing file changed on disk
|
|
1529
|
+
// (and it isn't open by the client). This deliberately ignores the
|
|
1530
|
+
// primary file's evenIfContentsAreSame flag so unsaved edits to one
|
|
1531
|
+
// alias don't repeatedly re-check the other alias's dependents.
|
|
1532
|
+
if (this._shouldContentInvalidate(aliasInfo, /* evenIfContentsAreSame */ false)) {
|
|
1533
|
+
aliasInfo.sourceFile.markDirty();
|
|
1534
|
+
this._markFileDirtyRecursive(aliasInfo, markDirtySet);
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1328
1537
|
}
|
|
1329
1538
|
_getModuleName(fileUri) {
|
|
1330
1539
|
const moduleInfo = this._getModuleImportInfoForFile(fileUri);
|
|
@@ -1381,8 +1590,9 @@ class Program {
|
|
|
1381
1590
|
minimumLoggingThreshold: this._configOptions.typeEvaluationTimeThreshold,
|
|
1382
1591
|
evaluateUnknownImportsAsAny: !!this._configOptions.evaluateUnknownImportsAsAny,
|
|
1383
1592
|
verifyTypeCacheEvaluatorFlags: !!this._configOptions.internalTestMode,
|
|
1593
|
+
nodeInfoReader: this._analyzerNodeInfoContext,
|
|
1384
1594
|
}, this._logTracker, this._configOptions.logTypeEvaluationTime
|
|
1385
|
-
? (0, tracePrinter_1.createTracePrinter)(this._importResolver.getImportRoots(this._configOptions.findExecEnvironment(this._configOptions.projectRoot)))
|
|
1595
|
+
? (0, tracePrinter_1.createTracePrinter)(this._importResolver.getImportRoots(this._configOptions.findExecEnvironment(this._configOptions.projectRoot)), this._analyzerNodeInfoContext)
|
|
1386
1596
|
: undefined);
|
|
1387
1597
|
return this._evaluator;
|
|
1388
1598
|
}
|
|
@@ -1468,7 +1678,7 @@ class Program {
|
|
|
1468
1678
|
return undefined;
|
|
1469
1679
|
}
|
|
1470
1680
|
// File should already be bound because of the chained file binding above.
|
|
1471
|
-
const scope = AnalyzerNodeInfo.getScope(parseResults.parseTree);
|
|
1681
|
+
const scope = AnalyzerNodeInfo.getScope(parseResults.parseTree, this._analyzerNodeInfoContext);
|
|
1472
1682
|
return scope;
|
|
1473
1683
|
};
|
|
1474
1684
|
let builtinsScope;
|
|
@@ -1496,8 +1706,7 @@ class Program {
|
|
|
1496
1706
|
futureImports = this._getEffectiveFutureImports(futureImports, fileToBind.chainedSourceFile);
|
|
1497
1707
|
}
|
|
1498
1708
|
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;
|
|
1709
|
+
return fileToBind.sourceFile.bind(this._configOptions, this._lookUpImport, builtinsScope, futureImports, fileToBind.ipythonMode === sourceFile_1.IPythonMode.CellDocs ? this._cellChainIndex : undefined, this._analyzerNodeInfoContext);
|
|
1501
1710
|
}
|
|
1502
1711
|
_getEffectiveFutureImports(futureImports, chainedSourceFile) {
|
|
1503
1712
|
const effectiveFutureImports = new Set(futureImports);
|
|
@@ -1556,7 +1765,7 @@ class Program {
|
|
|
1556
1765
|
}
|
|
1557
1766
|
}
|
|
1558
1767
|
if (boundFile) {
|
|
1559
|
-
fileToCheck.sourceFile.check(this.configOptions, this._lookUpImport, this._importResolver, this._evaluator, dependentFiles);
|
|
1768
|
+
fileToCheck.sourceFile.check(this.configOptions, this._lookUpImport, this._importResolver, this._evaluator, dependentFiles, this._analyzerNodeInfoContext);
|
|
1560
1769
|
}
|
|
1561
1770
|
}
|
|
1562
1771
|
// Detect import cycles that involve the file.
|
|
@@ -1632,7 +1841,7 @@ class Program {
|
|
|
1632
1841
|
if (file.sourceFile.isBindingRequired()) {
|
|
1633
1842
|
continue;
|
|
1634
1843
|
}
|
|
1635
|
-
const fileInfo = AnalyzerNodeInfo.getFileInfo(parseResults.parseTree);
|
|
1844
|
+
const fileInfo = AnalyzerNodeInfo.getFileInfo(parseResults.parseTree, this._analyzerNodeInfoContext);
|
|
1636
1845
|
if (fileInfo.accessedSymbolSet) {
|
|
1637
1846
|
dependentFiles.push(parseResults);
|
|
1638
1847
|
}
|
|
@@ -1738,7 +1947,7 @@ class Program {
|
|
|
1738
1947
|
if (markSet.has(fileUri.key)) {
|
|
1739
1948
|
return;
|
|
1740
1949
|
}
|
|
1741
|
-
sourceFileInfo.sourceFile.markReanalysisRequired(forceRebinding);
|
|
1950
|
+
sourceFileInfo.sourceFile.markReanalysisRequired(forceRebinding, this._analyzerNodeInfoContext);
|
|
1742
1951
|
markSet.add(fileUri.key);
|
|
1743
1952
|
sourceFileInfo.importedBy.forEach((dep) => {
|
|
1744
1953
|
// Changes on chained source file can change symbols in the symbol table and
|
|
@@ -1759,7 +1968,7 @@ class Program {
|
|
|
1759
1968
|
}
|
|
1760
1969
|
reevaluationRequired = true;
|
|
1761
1970
|
chainedSourceFile.sourceFile.markReanalysisRequired(
|
|
1762
|
-
/* forceRebinding */ sourceFileInfo.ipythonMode === sourceFile_1.IPythonMode.CellDocs);
|
|
1971
|
+
/* forceRebinding */ sourceFileInfo.ipythonMode === sourceFile_1.IPythonMode.CellDocs, this._analyzerNodeInfoContext);
|
|
1763
1972
|
chainedSourceFile = chainedSourceFile.chainedSourceFile;
|
|
1764
1973
|
}
|
|
1765
1974
|
// If the checker is going to run again, we have to recreate the type evaluator so
|