@zzzen/pyright-internal 1.2.0-dev.20221016 → 1.2.0-dev.20221204
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/backgroundAnalysisProgram.d.ts +7 -9
- package/dist/analyzer/backgroundAnalysisProgram.js +14 -52
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.js +43 -32
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.d.ts +15 -3
- package/dist/analyzer/checker.js +260 -143
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.d.ts +2 -2
- package/dist/analyzer/codeFlowEngine.js +85 -88
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/codeFlowTypes.d.ts +1 -0
- package/dist/analyzer/codeFlowTypes.js +3 -1
- package/dist/analyzer/codeFlowTypes.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +11 -1
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/dataClasses.d.ts +3 -3
- package/dist/analyzer/dataClasses.js +92 -59
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.d.ts +1 -1
- package/dist/analyzer/declarationUtils.js +6 -4
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/docStringConversion.js +7 -5
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +3 -0
- package/dist/analyzer/importResolver.js +50 -8
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importResult.d.ts +1 -0
- package/dist/analyzer/namedTuples.js +1 -1
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.d.ts +2 -1
- package/dist/analyzer/packageTypeVerifier.js +16 -10
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +2 -1
- package/dist/analyzer/parseTreeUtils.js +38 -3
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/parseTreeWalker.d.ts +86 -79
- package/dist/analyzer/parseTreeWalker.js +384 -201
- package/dist/analyzer/parseTreeWalker.js.map +1 -1
- package/dist/analyzer/program.d.ts +4 -7
- package/dist/analyzer/program.js +84 -79
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js +10 -3
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +1 -1
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/regions.d.ts +11 -0
- package/dist/analyzer/regions.js +57 -0
- package/dist/analyzer/regions.js.map +1 -0
- package/dist/analyzer/service.d.ts +11 -6
- package/dist/analyzer/service.js +127 -65
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +5 -2
- package/dist/analyzer/sourceFile.js +23 -10
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceFileInfoUtils.d.ts +1 -1
- package/dist/analyzer/sourceFileInfoUtils.js +1 -1
- package/dist/analyzer/sourceFileInfoUtils.js.map +1 -1
- package/dist/analyzer/sourceMapper.d.ts +6 -1
- package/dist/analyzer/sourceMapper.js +28 -5
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/sourceMapperUtils.d.ts +2 -1
- package/dist/analyzer/sourceMapperUtils.js +17 -5
- package/dist/analyzer/sourceMapperUtils.js.map +1 -1
- package/dist/analyzer/staticExpressions.js +19 -9
- package/dist/analyzer/staticExpressions.js.map +1 -1
- package/dist/analyzer/symbolUtils.d.ts +1 -0
- package/dist/analyzer/symbolUtils.js +5 -1
- package/dist/analyzer/symbolUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +664 -257
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +16 -4
- package/dist/analyzer/typeGuards.js +9 -0
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.d.ts +3 -1
- package/dist/analyzer/typePrinter.js +143 -28
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeStubWriter.js +5 -1
- package/dist/analyzer/typeStubWriter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +4 -2
- package/dist/analyzer/typeUtils.js +114 -20
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.js +8 -6
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +7 -5
- package/dist/analyzer/types.js +45 -20
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +6 -4
- package/dist/backgroundAnalysisBase.js +30 -9
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/backgroundThreadBase.d.ts +2 -1
- package/dist/backgroundThreadBase.js +4 -0
- package/dist/backgroundThreadBase.js.map +1 -1
- package/dist/commands/createTypeStub.js +3 -1
- package/dist/commands/createTypeStub.js.map +1 -1
- package/dist/common/configOptions.d.ts +1 -0
- package/dist/common/configOptions.js +4 -0
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/core.d.ts +2 -0
- package/dist/common/core.js +24 -3
- package/dist/common/core.js.map +1 -1
- package/dist/common/diagnostic.d.ts +8 -0
- package/dist/common/diagnostic.js +5 -1
- package/dist/common/diagnostic.js.map +1 -1
- package/dist/common/diagnosticRules.d.ts +2 -1
- package/dist/common/diagnosticRules.js +1 -0
- package/dist/common/diagnosticRules.js.map +1 -1
- package/dist/common/fileSystem.d.ts +1 -0
- package/dist/common/fileSystem.js.map +1 -1
- package/dist/common/pathUtils.d.ts +1 -0
- package/dist/common/pathUtils.js +17 -4
- package/dist/common/pathUtils.js.map +1 -1
- package/dist/common/pythonVersion.d.ts +1 -1
- package/dist/common/pythonVersion.js +1 -1
- package/dist/common/realFileSystem.js +12 -3
- package/dist/common/realFileSystem.js.map +1 -1
- package/dist/common/workspaceEditUtils.d.ts +6 -1
- package/dist/common/workspaceEditUtils.js +72 -1
- package/dist/common/workspaceEditUtils.js.map +1 -1
- package/dist/languageServerBase.d.ts +16 -8
- package/dist/languageServerBase.js +76 -32
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/analyzerServiceExecutor.d.ts +6 -2
- package/dist/languageService/analyzerServiceExecutor.js +8 -6
- package/dist/languageService/analyzerServiceExecutor.js.map +1 -1
- package/dist/languageService/autoImporter.js +2 -1
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/codeActionProvider.js +30 -0
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +2 -0
- package/dist/languageService/completionProvider.js +84 -32
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/definitionProvider.d.ts +2 -0
- package/dist/languageService/definitionProvider.js +3 -0
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.js +7 -3
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.js +1 -1
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.d.ts +1 -1
- package/dist/languageService/hoverProvider.js +73 -38
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/indentationUtils.d.ts +3 -0
- package/dist/languageService/indentationUtils.js +4 -3
- package/dist/languageService/indentationUtils.js.map +1 -1
- package/dist/languageService/referencesProvider.js +2 -1
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.js +1 -2
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/tooltipUtils.js +30 -19
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/localization/localize.d.ts +29 -4
- package/dist/localization/localize.js +20 -5
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.en-us.json +18 -3
- package/dist/parser/parseNodes.d.ts +2 -1
- package/dist/parser/parseNodes.js +6 -1
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.js +29 -15
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/tokenizer.js +19 -9
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/pyright.js +4 -4
- package/dist/pyright.js.map +1 -1
- package/dist/pyrightFileSystem.d.ts +1 -0
- package/dist/pyrightFileSystem.js +3 -0
- package/dist/pyrightFileSystem.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.d.ts +1 -0
- package/dist/readonlyAugmentedFileSystem.js +3 -0
- package/dist/readonlyAugmentedFileSystem.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/tests/chainedSourceFiles.test.js +2 -0
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +26 -3
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/config.test.js +11 -0
- package/dist/tests/config.test.js.map +1 -1
- package/dist/tests/diagnostics.test.d.ts +1 -0
- package/dist/tests/diagnostics.test.js +37 -0
- package/dist/tests/diagnostics.test.js.map +1 -0
- package/dist/tests/docStringConversion.test.js +71 -12
- package/dist/tests/docStringConversion.test.js.map +1 -1
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js +1 -1
- package/dist/tests/fourslash/completions.autoimport.shadow.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js +5 -5
- package/dist/tests/fourslash/completions.builtinDocstrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.classVariable.fourslash.js +119 -24
- package/dist/tests/fourslash/completions.classVariable.fourslash.js.map +1 -1
- package/dist/tests/fourslash/{signature.paramspec.fourslash.d.ts → completions.dunderNew.Inheritance.fourslash.d.ts} +0 -0
- package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js +29 -0
- package/dist/tests/fourslash/completions.dunderNew.Inheritance.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.dunderNew.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.dunderNew.fourslash.js +20 -0
- package/dist/tests/fourslash/completions.dunderNew.fourslash.js.map +1 -0
- package/dist/tests/fourslash/completions.fourslash.js +2 -2
- package/dist/tests/fourslash/completions.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js +1 -1
- package/dist/tests/fourslash/completions.libCodeAndStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js +1 -1
- package/dist/tests/fourslash/completions.libCodeNoStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.libStub.fourslash.js +1 -1
- package/dist/tests/fourslash/completions.libStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.localCode.fourslash.js +2 -2
- package/dist/tests/fourslash/completions.localCode.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.plainText.fourslash.js +2 -2
- package/dist/tests/fourslash/completions.plainText.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.self.fourslash.js +2 -2
- package/dist/tests/fourslash/completions.self.fourslash.js.map +1 -1
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.js +1 -1
- package/dist/tests/fourslash/completions.wildcardimports.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js +2 -2
- package/dist/tests/fourslash/findDefinitions.namespaceImport.fourslash.js.map +1 -1
- package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js +32 -0
- package/dist/tests/fourslash/findDefinitions.namespaceImportWithInit.fourslash.js.map +1 -0
- package/dist/tests/fourslash/fourslash.d.ts +2 -1
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js +2 -2
- package/dist/tests/fourslash/hover.builtinDocstrings.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.js +4 -4
- package/dist/tests/fourslash/hover.docFromSrc.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module1.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.pkg-vs-module2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport1.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport2.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.relativeImport3.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js +2 -2
- package/dist/tests/fourslash/hover.docFromSrc.stubs-package.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.docFromSrc.typeshed.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.alias.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docstring.alias.fourslash.js +24 -0
- package/dist/tests/fourslash/hover.docstring.alias.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.docstring.links.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js +3 -3
- package/dist/tests/fourslash/hover.docstring.split.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js +13 -0
- package/dist/tests/fourslash/hover.dunderNew.basic.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js +15 -0
- package/dist/tests/fourslash/hover.dunderNew.inheritance.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js +21 -0
- package/dist/tests/fourslash/hover.dunderNew.inheritance2.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js +17 -0
- package/dist/tests/fourslash/hover.dunderNew.overloads.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js +15 -0
- package/dist/tests/fourslash/hover.dunderNew.withInit.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js +3 -3
- package/dist/tests/fourslash/hover.inherited.docFromSrc.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js +2 -2
- package/dist/tests/fourslash/hover.inherited.docFromSrcWithStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js +2 -2
- package/dist/tests/fourslash/hover.inherited.docFromStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.init.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.init.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.libCodeAndStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.libCodeNoStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.libStub.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.libStub.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.plainText.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.plainText.fourslash.js.map +1 -1
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.js +1 -1
- package/dist/tests/fourslash/hover.wildcardimports.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js +1 -1
- package/dist/tests/fourslash/import.pytyped.typeCheckingBasic.fourslash.js.map +1 -1
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js +1 -1
- package/dist/tests/fourslash/import.pytyped.typeCheckingOff.fourslash.js.map +1 -1
- package/dist/tests/fourslash/shadowedImports.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/shadowedImports.fourslash.js +75 -0
- package/dist/tests/fourslash/shadowedImports.fourslash.js.map +1 -0
- package/dist/tests/fourslash/signature.dunderNew.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/signature.dunderNew.fourslash.js +24 -0
- package/dist/tests/fourslash/signature.dunderNew.fourslash.js.map +1 -0
- package/dist/tests/harness/fourslash/runner.js +1 -1
- package/dist/tests/harness/fourslash/runner.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.d.ts +3 -1
- package/dist/tests/harness/fourslash/testLanguageService.js +5 -4
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.d.ts +7 -7
- package/dist/tests/harness/fourslash/testState.js +79 -163
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.d.ts +16 -0
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js +159 -0
- package/dist/tests/harness/fourslash/workspaceEditTestUtils.js.map +1 -0
- package/dist/tests/harness/vfs/filesystem.d.ts +1 -0
- package/dist/tests/harness/vfs/filesystem.js +3 -0
- package/dist/tests/harness/vfs/filesystem.js.map +1 -1
- package/dist/tests/indentationUtils.ptvs.test.js +1 -1
- package/dist/tests/indentationUtils.test.js +4 -4
- package/dist/tests/ipythonMode.test.js +39 -0
- package/dist/tests/ipythonMode.test.js.map +1 -1
- package/dist/tests/logger.test.js +3 -1
- package/dist/tests/logger.test.js.map +1 -1
- package/dist/tests/parser.test.js +3 -3
- package/dist/tests/pathUtils.test.js +7 -0
- package/dist/tests/pathUtils.test.js.map +1 -1
- package/dist/tests/service.test.d.ts +1 -0
- package/dist/tests/service.test.js +159 -0
- package/dist/tests/service.test.js.map +1 -0
- package/dist/tests/sourceFile.test.js +34 -1
- package/dist/tests/sourceFile.test.js.map +1 -1
- package/dist/tests/sourceMapperUtils.test.js +39 -4
- package/dist/tests/sourceMapperUtils.test.js.map +1 -1
- package/dist/tests/tokenizer.test.js +6 -2
- package/dist/tests/tokenizer.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +16 -6
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +15 -3
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +51 -11
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +11 -7
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +48 -0
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/typePrinter.test.d.ts +1 -0
- package/dist/tests/typePrinter.test.js +148 -0
- package/dist/tests/typePrinter.test.js.map +1 -0
- package/dist/tests/workspaceEditUtils.test.d.ts +1 -0
- package/dist/tests/workspaceEditUtils.test.js +167 -0
- package/dist/tests/workspaceEditUtils.test.js.map +1 -0
- package/dist/workspaceMap.d.ts +4 -1
- package/dist/workspaceMap.js +64 -16
- package/dist/workspaceMap.js.map +1 -1
- package/package.json +3 -3
- package/dist/tests/fourslash/signature.paramspec.fourslash.js +0 -30
- package/dist/tests/fourslash/signature.paramspec.fourslash.js.map +0 -1
package/dist/analyzer/program.js
CHANGED
@@ -78,7 +78,7 @@ class Program {
|
|
78
78
|
var _a;
|
79
79
|
let sourceFileInfo;
|
80
80
|
if (typeof filePathOrModule === 'string') {
|
81
|
-
sourceFileInfo = this.
|
81
|
+
sourceFileInfo = this.getSourceFileInfo(filePathOrModule);
|
82
82
|
}
|
83
83
|
else {
|
84
84
|
// Resolve the import.
|
@@ -91,12 +91,12 @@ class Program {
|
|
91
91
|
let resolvedPath = importResult.resolvedPaths[importResult.resolvedPaths.length - 1];
|
92
92
|
if (resolvedPath) {
|
93
93
|
// See if the source file already exists in the program.
|
94
|
-
sourceFileInfo = this.
|
94
|
+
sourceFileInfo = this.getSourceFileInfo(resolvedPath);
|
95
95
|
if (!sourceFileInfo) {
|
96
96
|
resolvedPath = (0, pathUtils_1.normalizePathCase)(this._fs, resolvedPath);
|
97
97
|
// Start tracking the source file.
|
98
98
|
this.addTrackedFile(resolvedPath);
|
99
|
-
sourceFileInfo = this.
|
99
|
+
sourceFileInfo = this.getSourceFileInfo(resolvedPath);
|
100
100
|
}
|
101
101
|
}
|
102
102
|
}
|
@@ -193,7 +193,7 @@ class Program {
|
|
193
193
|
});
|
194
194
|
}
|
195
195
|
addTrackedFile(filePath, isThirdPartyImport = false, isInPyTypedPackage = false) {
|
196
|
-
let sourceFileInfo = this.
|
196
|
+
let sourceFileInfo = this.getSourceFileInfo(filePath);
|
197
197
|
const importName = this._getImportNameForFile(filePath);
|
198
198
|
if (sourceFileInfo) {
|
199
199
|
// The module name may have changed based on updates to the
|
@@ -221,7 +221,7 @@ class Program {
|
|
221
221
|
}
|
222
222
|
setFileOpened(filePath, version, contents, options) {
|
223
223
|
var _a, _b;
|
224
|
-
let sourceFileInfo = this.
|
224
|
+
let sourceFileInfo = this.getSourceFileInfo(filePath);
|
225
225
|
if (!sourceFileInfo) {
|
226
226
|
const importName = this._getImportNameForFile(filePath);
|
227
227
|
const sourceFile = new sourceFile_1.SourceFile(this._fs, filePath, importName,
|
@@ -231,7 +231,7 @@ class Program {
|
|
231
231
|
sourceFileInfo = {
|
232
232
|
sourceFile,
|
233
233
|
isTracked: (_b = options === null || options === void 0 ? void 0 : options.isTracked) !== null && _b !== void 0 ? _b : false,
|
234
|
-
chainedSourceFile: chainedFilePath ? this.
|
234
|
+
chainedSourceFile: chainedFilePath ? this.getSourceFileInfo(chainedFilePath) : undefined,
|
235
235
|
isOpenByClient: true,
|
236
236
|
isTypeshedFile: false,
|
237
237
|
isThirdPartyImport: false,
|
@@ -256,23 +256,22 @@ class Program {
|
|
256
256
|
}
|
257
257
|
getChainedFilePath(filePath) {
|
258
258
|
var _a;
|
259
|
-
const sourceFileInfo = this.
|
259
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
260
260
|
return (_a = sourceFileInfo === null || sourceFileInfo === void 0 ? void 0 : sourceFileInfo.chainedSourceFile) === null || _a === void 0 ? void 0 : _a.sourceFile.getFilePath();
|
261
261
|
}
|
262
262
|
updateChainedFilePath(filePath, chainedFilePath) {
|
263
|
-
const sourceFileInfo = this.
|
263
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
264
264
|
if (sourceFileInfo) {
|
265
|
-
sourceFileInfo.chainedSourceFile = chainedFilePath
|
266
|
-
? this._getSourceFileInfoFromPath(chainedFilePath)
|
267
|
-
: undefined;
|
265
|
+
sourceFileInfo.chainedSourceFile = chainedFilePath ? this.getSourceFileInfo(chainedFilePath) : undefined;
|
268
266
|
sourceFileInfo.sourceFile.markDirty();
|
269
267
|
this._markFileDirtyRecursive(sourceFileInfo, new Set());
|
270
268
|
}
|
271
269
|
}
|
272
|
-
setFileClosed(filePath) {
|
273
|
-
const sourceFileInfo = this.
|
270
|
+
setFileClosed(filePath, isTracked) {
|
271
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
274
272
|
if (sourceFileInfo) {
|
275
273
|
sourceFileInfo.isOpenByClient = false;
|
274
|
+
sourceFileInfo.isTracked = isTracked !== null && isTracked !== void 0 ? isTracked : sourceFileInfo.isTracked;
|
276
275
|
sourceFileInfo.sourceFile.setClientVersion(null, []);
|
277
276
|
// There is no guarantee that content is saved before the file is closed.
|
278
277
|
// We need to mark the file dirty so we can re-analyze next time.
|
@@ -285,9 +284,6 @@ class Program {
|
|
285
284
|
}
|
286
285
|
return this._removeUnneededFiles();
|
287
286
|
}
|
288
|
-
isFileOpen(filePath) {
|
289
|
-
return this._getSourceFileInfoFromPath(filePath) !== undefined;
|
290
|
-
}
|
291
287
|
markAllFilesDirty(evenIfContentsAreSame, indexingNeeded = true) {
|
292
288
|
const markDirtySet = new Set();
|
293
289
|
this._sourceFileList.forEach((sourceFileInfo) => {
|
@@ -308,7 +304,7 @@ class Program {
|
|
308
304
|
markFilesDirty(filePaths, evenIfContentsAreSame, indexingNeeded = true) {
|
309
305
|
const markDirtySet = new Set();
|
310
306
|
filePaths.forEach((filePath) => {
|
311
|
-
const sourceFileInfo = this.
|
307
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
312
308
|
if (sourceFileInfo) {
|
313
309
|
const fileName = (0, pathUtils_1.getFileName)(filePath);
|
314
310
|
// Handle builtins and __builtins__ specially. They are implicitly
|
@@ -369,7 +365,7 @@ class Program {
|
|
369
365
|
return this._sourceFileList.some((i) => i.sourceFile.getFilePath().startsWith(normalized));
|
370
366
|
}
|
371
367
|
getSourceFile(filePath) {
|
372
|
-
const sourceFileInfo = this.
|
368
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
373
369
|
if (!sourceFileInfo) {
|
374
370
|
return undefined;
|
375
371
|
}
|
@@ -379,8 +375,11 @@ class Program {
|
|
379
375
|
var _a;
|
380
376
|
return (_a = this.getBoundSourceFileInfo(filePath)) === null || _a === void 0 ? void 0 : _a.sourceFile;
|
381
377
|
}
|
378
|
+
getSourceFileInfo(filePath) {
|
379
|
+
return this._sourceFileMap.get((0, pathUtils_1.normalizePathCase)(this._fs, filePath));
|
380
|
+
}
|
382
381
|
getBoundSourceFileInfo(filePath) {
|
383
|
-
const sourceFileInfo = this.
|
382
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
384
383
|
if (!sourceFileInfo) {
|
385
384
|
return undefined;
|
386
385
|
}
|
@@ -401,7 +400,7 @@ class Program {
|
|
401
400
|
const effectiveMaxTime = maxTime ? maxTime.openFilesTimeInMs : Number.MAX_VALUE;
|
402
401
|
// Check the open files.
|
403
402
|
for (const sourceFileInfo of openFiles) {
|
404
|
-
if (this._checkTypes(sourceFileInfo)) {
|
403
|
+
if (this._checkTypes(sourceFileInfo, token)) {
|
405
404
|
if (elapsedTime.getDurationInMilliseconds() > effectiveMaxTime) {
|
406
405
|
return true;
|
407
406
|
}
|
@@ -421,7 +420,7 @@ class Program {
|
|
421
420
|
if (!(0, sourceFileInfoUtils_1.isUserCode)(sourceFileInfo)) {
|
422
421
|
continue;
|
423
422
|
}
|
424
|
-
if (this._checkTypes(sourceFileInfo)) {
|
423
|
+
if (this._checkTypes(sourceFileInfo, token)) {
|
425
424
|
if (elapsedTime.getDurationInMilliseconds() > effectiveMaxTime) {
|
426
425
|
return true;
|
427
426
|
}
|
@@ -579,10 +578,10 @@ class Program {
|
|
579
578
|
const evaluator = this._evaluator || this._createNewEvaluator();
|
580
579
|
return evaluator.getEffectiveTypeOfSymbol(symbol);
|
581
580
|
}
|
582
|
-
printType(type,
|
581
|
+
printType(type, options) {
|
583
582
|
this._handleMemoryHighUsage();
|
584
583
|
const evaluator = this._evaluator || this._createNewEvaluator();
|
585
|
-
return evaluator.printType(type,
|
584
|
+
return evaluator.printType(type, options);
|
586
585
|
}
|
587
586
|
static _getPrintTypeFlags(configOptions) {
|
588
587
|
let flags = 0 /* None */;
|
@@ -622,7 +621,7 @@ class Program {
|
|
622
621
|
// We need to track the relationship so if the original type stub is removed from the
|
623
622
|
// program, we can remove the corresponding shadowed file and any files it imports.
|
624
623
|
_addShadowedFile(stubFile, shadowImplPath) {
|
625
|
-
let shadowFileInfo = this.
|
624
|
+
let shadowFileInfo = this.getSourceFileInfo(shadowImplPath);
|
626
625
|
if (!shadowFileInfo) {
|
627
626
|
const importName = this._getImportNameForFile(shadowImplPath);
|
628
627
|
const sourceFile = new sourceFile_1.SourceFile(this._fs, shadowImplPath, importName,
|
@@ -752,7 +751,7 @@ class Program {
|
|
752
751
|
}
|
753
752
|
return false;
|
754
753
|
}
|
755
|
-
_checkTypes(fileToCheck) {
|
754
|
+
_checkTypes(fileToCheck, token) {
|
756
755
|
return this._logTracker.log(`analyzing: ${fileToCheck.sourceFile.getFilePath()}`, (logState) => {
|
757
756
|
// If the file isn't needed because it was eliminated from the
|
758
757
|
// transitive closure or deleted, skip the file rather than wasting
|
@@ -777,7 +776,8 @@ class Program {
|
|
777
776
|
}
|
778
777
|
}
|
779
778
|
if (!this._disableChecker) {
|
780
|
-
fileToCheck.sourceFile.
|
779
|
+
const execEnv = this._configOptions.findExecEnvironment(fileToCheck.sourceFile.getFilePath());
|
780
|
+
fileToCheck.sourceFile.check(this._importResolver, this._evaluator, execEnv, this._createSourceMapper(execEnv, token, fileToCheck), (p) => (0, sourceFileInfoUtils_1.isUserCode)(this.getSourceFileInfo(p)));
|
781
781
|
}
|
782
782
|
// For very large programs, we may need to discard the evaluator and
|
783
783
|
// its cached types to avoid running out of heap space.
|
@@ -892,7 +892,7 @@ class Program {
|
|
892
892
|
});
|
893
893
|
circDep.normalizeOrder();
|
894
894
|
const firstFilePath = circDep.getPaths()[0];
|
895
|
-
const firstSourceFile = this.
|
895
|
+
const firstSourceFile = this.getSourceFileInfo(firstFilePath);
|
896
896
|
(0, debug_1.assert)(firstSourceFile !== undefined);
|
897
897
|
firstSourceFile.sourceFile.addCircularDependency(circDep);
|
898
898
|
}
|
@@ -911,7 +911,7 @@ class Program {
|
|
911
911
|
}
|
912
912
|
}
|
913
913
|
getTextOnRange(filePath, range, token) {
|
914
|
-
const sourceFileInfo = this.
|
914
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
915
915
|
if (!sourceFileInfo) {
|
916
916
|
return undefined;
|
917
917
|
}
|
@@ -932,7 +932,7 @@ class Program {
|
|
932
932
|
});
|
933
933
|
}
|
934
934
|
getAutoImports(filePath, range, similarityLimit, nameMap, options, token) {
|
935
|
-
const sourceFileInfo = this.
|
935
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
936
936
|
if (!sourceFileInfo) {
|
937
937
|
return [];
|
938
938
|
}
|
@@ -1022,36 +1022,38 @@ class Program {
|
|
1022
1022
|
}
|
1023
1023
|
getDefinitionsForPosition(filePath, position, filter, token) {
|
1024
1024
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1025
|
-
const sourceFileInfo = this.
|
1025
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1026
1026
|
if (!sourceFileInfo) {
|
1027
1027
|
return undefined;
|
1028
1028
|
}
|
1029
1029
|
this._bindFile(sourceFileInfo);
|
1030
1030
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1031
|
-
return sourceFileInfo.sourceFile.getDefinitionsForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, filter, this._evaluator, token);
|
1031
|
+
return sourceFileInfo.sourceFile.getDefinitionsForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, filter, this._evaluator, token);
|
1032
1032
|
});
|
1033
1033
|
}
|
1034
1034
|
getTypeDefinitionsForPosition(filePath, position, token) {
|
1035
1035
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1036
|
-
const sourceFileInfo = this.
|
1036
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1037
1037
|
if (!sourceFileInfo) {
|
1038
1038
|
return undefined;
|
1039
1039
|
}
|
1040
1040
|
this._bindFile(sourceFileInfo);
|
1041
1041
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1042
|
-
return sourceFileInfo.sourceFile.getTypeDefinitionsForPosition(this._createSourceMapper(execEnv,
|
1042
|
+
return sourceFileInfo.sourceFile.getTypeDefinitionsForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo,
|
1043
|
+
/* mapCompiled */ false,
|
1044
|
+
/* preferStubs */ true), position, this._evaluator, filePath, token);
|
1043
1045
|
});
|
1044
1046
|
}
|
1045
1047
|
reportReferencesForPosition(filePath, position, includeDeclaration, reporter, token) {
|
1046
1048
|
this._runEvaluatorWithCancellationToken(token, () => {
|
1047
|
-
const sourceFileInfo = this.
|
1049
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1048
1050
|
if (!sourceFileInfo) {
|
1049
1051
|
return;
|
1050
1052
|
}
|
1051
1053
|
const invokedFromUserFile = (0, sourceFileInfoUtils_1.isUserCode)(sourceFileInfo);
|
1052
1054
|
this._bindFile(sourceFileInfo);
|
1053
1055
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1054
|
-
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, reporter, token);
|
1056
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, reporter, token);
|
1055
1057
|
if (!referencesResult) {
|
1056
1058
|
return;
|
1057
1059
|
}
|
@@ -1083,7 +1085,7 @@ class Program {
|
|
1083
1085
|
// Already included.
|
1084
1086
|
continue;
|
1085
1087
|
}
|
1086
|
-
const declFileInfo = this.
|
1088
|
+
const declFileInfo = this.getSourceFileInfo(decl.path);
|
1087
1089
|
if (!declFileInfo) {
|
1088
1090
|
// The file the declaration belongs to doesn't belong to the program.
|
1089
1091
|
continue;
|
@@ -1116,7 +1118,7 @@ class Program {
|
|
1116
1118
|
this._handleMemoryHighUsage();
|
1117
1119
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1118
1120
|
var _a;
|
1119
|
-
const sourceFileInfo = this.
|
1121
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1120
1122
|
if (!sourceFileInfo) {
|
1121
1123
|
return undefined;
|
1122
1124
|
}
|
@@ -1137,7 +1139,7 @@ class Program {
|
|
1137
1139
|
}
|
1138
1140
|
addSymbolsForDocument(filePath, symbolList, token) {
|
1139
1141
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1140
|
-
const sourceFileInfo = this.
|
1142
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1141
1143
|
if (sourceFileInfo) {
|
1142
1144
|
if (!sourceFileInfo.sourceFile.getCachedIndexResults()) {
|
1143
1145
|
// If we already have cached index for this file, no need to bind this file.
|
@@ -1175,40 +1177,40 @@ class Program {
|
|
1175
1177
|
}
|
1176
1178
|
getHoverForPosition(filePath, position, format, token) {
|
1177
1179
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1178
|
-
const sourceFileInfo = this.
|
1180
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1179
1181
|
if (!sourceFileInfo) {
|
1180
1182
|
return undefined;
|
1181
1183
|
}
|
1182
1184
|
this._bindFile(sourceFileInfo);
|
1183
1185
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1184
|
-
return sourceFileInfo.sourceFile.getHoverForPosition(this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ true), position, format, this._evaluator, token);
|
1186
|
+
return sourceFileInfo.sourceFile.getHoverForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo, /* mapCompiled */ true), position, format, this._evaluator, token);
|
1185
1187
|
});
|
1186
1188
|
}
|
1187
1189
|
getDocumentHighlight(filePath, position, token) {
|
1188
1190
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1189
|
-
const sourceFileInfo = this.
|
1191
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1190
1192
|
if (!sourceFileInfo) {
|
1191
1193
|
return undefined;
|
1192
1194
|
}
|
1193
1195
|
this._bindFile(sourceFileInfo);
|
1194
1196
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1195
|
-
return sourceFileInfo.sourceFile.getDocumentHighlight(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, token);
|
1197
|
+
return sourceFileInfo.sourceFile.getDocumentHighlight(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, token);
|
1196
1198
|
});
|
1197
1199
|
}
|
1198
1200
|
getSignatureHelpForPosition(filePath, position, format, token) {
|
1199
1201
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1200
|
-
const sourceFileInfo = this.
|
1202
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1201
1203
|
if (!sourceFileInfo) {
|
1202
1204
|
return undefined;
|
1203
1205
|
}
|
1204
1206
|
this._bindFile(sourceFileInfo);
|
1205
1207
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1206
|
-
return sourceFileInfo.sourceFile.getSignatureHelpForPosition(position, this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ true), this._evaluator, format, token);
|
1208
|
+
return sourceFileInfo.sourceFile.getSignatureHelpForPosition(position, this._createSourceMapper(execEnv, token, sourceFileInfo, /* mapCompiled */ true), this._evaluator, format, token);
|
1207
1209
|
});
|
1208
1210
|
}
|
1209
1211
|
async getCompletionsForPosition(filePath, position, workspacePath, options, nameMap, libraryMap, token) {
|
1210
1212
|
var _a;
|
1211
|
-
const sourceFileInfo = this.
|
1213
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1212
1214
|
if (!sourceFileInfo) {
|
1213
1215
|
return undefined;
|
1214
1216
|
}
|
@@ -1217,8 +1219,7 @@ class Program {
|
|
1217
1219
|
const result = this._runEvaluatorWithCancellationToken(token, () => {
|
1218
1220
|
this._bindFile(sourceFileInfo);
|
1219
1221
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1220
|
-
return sourceFileInfo.sourceFile.getCompletionsForPosition(position, workspacePath, this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
|
1221
|
-
/* includeIndexUserSymbols */ false, token), token);
|
1222
|
+
return sourceFileInfo.sourceFile.getCompletionsForPosition(position, workspacePath, this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, token, sourceFileInfo, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap, options.includeUserSymbolsInAutoImport, token), token);
|
1222
1223
|
});
|
1223
1224
|
ls.add(`found ${(_a = result === null || result === void 0 ? void 0 : result.completionMap.size) !== null && _a !== void 0 ? _a : 'null'} items`);
|
1224
1225
|
return result;
|
@@ -1243,20 +1244,19 @@ class Program {
|
|
1243
1244
|
}
|
1244
1245
|
resolveCompletionItem(filePath, completionItem, options, nameMap, libraryMap, token) {
|
1245
1246
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1246
|
-
const sourceFileInfo = this.
|
1247
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1247
1248
|
if (!sourceFileInfo) {
|
1248
1249
|
return;
|
1249
1250
|
}
|
1250
1251
|
this._bindFile(sourceFileInfo);
|
1251
1252
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1252
|
-
sourceFileInfo.sourceFile.resolveCompletionItem(this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, sourceFileInfo, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap,
|
1253
|
-
/* includeIndexUserSymbols */ false, token), completionItem, token);
|
1253
|
+
sourceFileInfo.sourceFile.resolveCompletionItem(this._configOptions, this._importResolver, this._lookUpImport, this._evaluator, options, this._createSourceMapper(execEnv, token, sourceFileInfo, /* mapCompiled */ true), nameMap, libraryMap, () => this._buildModuleSymbolsMap(sourceFileInfo, !!libraryMap, options.includeUserSymbolsInAutoImport, token), completionItem, token);
|
1254
1254
|
});
|
1255
1255
|
}
|
1256
1256
|
renameModule(path, newPath, token) {
|
1257
1257
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1258
1258
|
if ((0, pathUtils_1.isFile)(this._fs, path)) {
|
1259
|
-
const fileInfo = this.
|
1259
|
+
const fileInfo = this.getSourceFileInfo(path);
|
1260
1260
|
if (!fileInfo) {
|
1261
1261
|
return undefined;
|
1262
1262
|
}
|
@@ -1271,7 +1271,7 @@ class Program {
|
|
1271
1271
|
}
|
1272
1272
|
moveSymbolAtPosition(filePath, newFilePath, position, token) {
|
1273
1273
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1274
|
-
const fileInfo = this.
|
1274
|
+
const fileInfo = this.getSourceFileInfo(filePath);
|
1275
1275
|
if (!fileInfo) {
|
1276
1276
|
return undefined;
|
1277
1277
|
}
|
@@ -1294,7 +1294,7 @@ class Program {
|
|
1294
1294
|
}
|
1295
1295
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1296
1296
|
const declarations = documentSymbolCollector_1.DocumentSymbolCollector.getDeclarationsForNode(node, this._evaluator,
|
1297
|
-
/* resolveLocalNames */ false, token, this._createSourceMapper(execEnv, fileInfo));
|
1297
|
+
/* resolveLocalNames */ false, token, this._createSourceMapper(execEnv, token, fileInfo));
|
1298
1298
|
const renameModuleProvider = renameModuleProvider_1.RenameModuleProvider.createForSymbol(this._importResolver, this._configOptions, this._evaluator, filePath, newFilePath, declarations, token);
|
1299
1299
|
if (!renameModuleProvider) {
|
1300
1300
|
return undefined;
|
@@ -1305,7 +1305,7 @@ class Program {
|
|
1305
1305
|
}
|
1306
1306
|
canRenameSymbolAtPosition(filePath, position, isDefaultWorkspace, allowModuleRename, token) {
|
1307
1307
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1308
|
-
const sourceFileInfo = this.
|
1308
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1309
1309
|
if (!sourceFileInfo) {
|
1310
1310
|
return undefined;
|
1311
1311
|
}
|
@@ -1333,7 +1333,7 @@ class Program {
|
|
1333
1333
|
renameSymbolAtPosition(filePath, position, newName, isDefaultWorkspace, allowModuleRename, token) {
|
1334
1334
|
return this._runEvaluatorWithCancellationToken(token, () => {
|
1335
1335
|
var _a;
|
1336
|
-
const sourceFileInfo = this.
|
1336
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1337
1337
|
if (!sourceFileInfo) {
|
1338
1338
|
return undefined;
|
1339
1339
|
}
|
@@ -1418,13 +1418,13 @@ class Program {
|
|
1418
1418
|
});
|
1419
1419
|
}
|
1420
1420
|
getCallForPosition(filePath, position, token) {
|
1421
|
-
const sourceFileInfo = this.
|
1421
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1422
1422
|
if (!sourceFileInfo) {
|
1423
1423
|
return undefined;
|
1424
1424
|
}
|
1425
1425
|
this._bindFile(sourceFileInfo);
|
1426
1426
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1427
|
-
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, undefined, token);
|
1427
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, undefined, token);
|
1428
1428
|
if (!referencesResult || referencesResult.declarations.length === 0) {
|
1429
1429
|
return undefined;
|
1430
1430
|
}
|
@@ -1432,13 +1432,13 @@ class Program {
|
|
1432
1432
|
return callHierarchyProvider_1.CallHierarchyProvider.getCallForDeclaration(referencesResult.symbolName, targetDecl, this._evaluator, token);
|
1433
1433
|
}
|
1434
1434
|
getIncomingCallsForPosition(filePath, position, token) {
|
1435
|
-
const sourceFileInfo = this.
|
1435
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1436
1436
|
if (!sourceFileInfo) {
|
1437
1437
|
return undefined;
|
1438
1438
|
}
|
1439
1439
|
this._bindFile(sourceFileInfo);
|
1440
1440
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1441
|
-
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, undefined, token);
|
1441
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, undefined, token);
|
1442
1442
|
if (!referencesResult || referencesResult.declarations.length === 0) {
|
1443
1443
|
return undefined;
|
1444
1444
|
}
|
@@ -1459,13 +1459,13 @@ class Program {
|
|
1459
1459
|
return items;
|
1460
1460
|
}
|
1461
1461
|
getOutgoingCallsForPosition(filePath, position, token) {
|
1462
|
-
const sourceFileInfo = this.
|
1462
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1463
1463
|
if (!sourceFileInfo) {
|
1464
1464
|
return undefined;
|
1465
1465
|
}
|
1466
1466
|
this._bindFile(sourceFileInfo);
|
1467
1467
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1468
|
-
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, sourceFileInfo), position, this._evaluator, undefined, token);
|
1468
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token, sourceFileInfo), position, this._evaluator, undefined, token);
|
1469
1469
|
if (!referencesResult || referencesResult.declarations.length === 0) {
|
1470
1470
|
return undefined;
|
1471
1471
|
}
|
@@ -1473,7 +1473,7 @@ class Program {
|
|
1473
1473
|
return callHierarchyProvider_1.CallHierarchyProvider.getOutgoingCallsForDeclaration(targetDecl, sourceFileInfo.sourceFile.getParseResults(), this._evaluator, token);
|
1474
1474
|
}
|
1475
1475
|
performQuickAction(filePath, command, args, token) {
|
1476
|
-
const sourceFileInfo = this.
|
1476
|
+
const sourceFileInfo = this.getSourceFileInfo(filePath);
|
1477
1477
|
if (!sourceFileInfo) {
|
1478
1478
|
return undefined;
|
1479
1479
|
}
|
@@ -1497,7 +1497,7 @@ class Program {
|
|
1497
1497
|
this._parsedFileCount = 0;
|
1498
1498
|
}
|
1499
1499
|
test_createSourceMapper(execEnv, from) {
|
1500
|
-
return this._createSourceMapper(execEnv, /*from*/ from, /* mapCompiled */ false);
|
1500
|
+
return this._createSourceMapper(execEnv, vscode_languageserver_1.CancellationToken.None, /*from*/ from, /* mapCompiled */ false);
|
1501
1501
|
}
|
1502
1502
|
_getRenameSymbolMode(sourceFileInfo, referencesResult, isDefaultWorkspace) {
|
1503
1503
|
// We have 2 different cases
|
@@ -1513,10 +1513,10 @@ class Program {
|
|
1513
1513
|
(userFile && !referencesResult.requiresGlobalSearch) ||
|
1514
1514
|
(!userFile &&
|
1515
1515
|
sourceFileInfo.isOpenByClient &&
|
1516
|
-
referencesResult.declarations.every((d) => this.
|
1516
|
+
referencesResult.declarations.every((d) => this.getSourceFileInfo(d.path) === sourceFileInfo))) {
|
1517
1517
|
return 'singleFileMode';
|
1518
1518
|
}
|
1519
|
-
if (referencesResult.declarations.every((d) => (0, sourceFileInfoUtils_1.isUserCode)(this.
|
1519
|
+
if (referencesResult.declarations.every((d) => (0, sourceFileInfoUtils_1.isUserCode)(this.getSourceFileInfo(d.path)))) {
|
1520
1520
|
return 'multiFileMode';
|
1521
1521
|
}
|
1522
1522
|
// Rename is not allowed.
|
@@ -1525,11 +1525,11 @@ class Program {
|
|
1525
1525
|
}
|
1526
1526
|
_supportRenameModule(declarations, isDefaultWorkspace) {
|
1527
1527
|
// Rename module is not supported for standalone file and all decls must be on a user file.
|
1528
|
-
return !isDefaultWorkspace && declarations.every((d) => (0, sourceFileInfoUtils_1.isUserCode)(this.
|
1528
|
+
return !isDefaultWorkspace && declarations.every((d) => (0, sourceFileInfoUtils_1.isUserCode)(this.getSourceFileInfo(d.path)));
|
1529
1529
|
}
|
1530
1530
|
_getReferenceResult(sourceFileInfo, filePath, position, allowModuleRename, token) {
|
1531
1531
|
const execEnv = this._configOptions.findExecEnvironment(filePath);
|
1532
|
-
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv), position, this._evaluator, undefined, token);
|
1532
|
+
const referencesResult = sourceFileInfo.sourceFile.getDeclarationForPosition(this._createSourceMapper(execEnv, token), position, this._evaluator, undefined, token);
|
1533
1533
|
if (!referencesResult) {
|
1534
1534
|
return undefined;
|
1535
1535
|
}
|
@@ -1718,15 +1718,15 @@ class Program {
|
|
1718
1718
|
}
|
1719
1719
|
return false;
|
1720
1720
|
}
|
1721
|
-
_createSourceMapper(execEnv, from, mapCompiled, preferStubs) {
|
1721
|
+
_createSourceMapper(execEnv, token, from, mapCompiled, preferStubs) {
|
1722
1722
|
const sourceMapper = new sourceMapper_1.SourceMapper(this._importResolver, execEnv, this._evaluator, (stubFilePath, implFilePath) => {
|
1723
|
-
const stubFileInfo = this.
|
1723
|
+
const stubFileInfo = this.getSourceFileInfo(stubFilePath);
|
1724
1724
|
if (!stubFileInfo) {
|
1725
1725
|
return undefined;
|
1726
1726
|
}
|
1727
1727
|
this._addShadowedFile(stubFileInfo, implFilePath);
|
1728
1728
|
return this.getBoundSourceFile(implFilePath);
|
1729
|
-
}, (f) => this.getBoundSourceFileInfo(f), mapCompiled !== null && mapCompiled !== void 0 ? mapCompiled : false, preferStubs !== null && preferStubs !== void 0 ? preferStubs : false, from);
|
1729
|
+
}, (f) => this.getBoundSourceFileInfo(f), (f) => this.getSourceFileInfo(f), mapCompiled !== null && mapCompiled !== void 0 ? mapCompiled : false, preferStubs !== null && preferStubs !== void 0 ? preferStubs : false, from, token);
|
1730
1730
|
return sourceMapper;
|
1731
1731
|
}
|
1732
1732
|
_isImportAllowed(importer, importResult, isImportStubFile) {
|
@@ -1761,6 +1761,14 @@ class Program {
|
|
1761
1761
|
thirdPartyImportAllowed = true;
|
1762
1762
|
}
|
1763
1763
|
}
|
1764
|
+
else if (importer.isThirdPartyImport) {
|
1765
|
+
// If the importing file is a third-party import, allow importing of
|
1766
|
+
// additional third-party imports. This supports the case where the importer
|
1767
|
+
// is in a py.typed library but is importing from another non-py.typed
|
1768
|
+
// library. It also supports the case where someone explicitly opens a
|
1769
|
+
// library source file in their editor.
|
1770
|
+
thirdPartyImportAllowed = true;
|
1771
|
+
}
|
1764
1772
|
// Some libraries ship with stub files that import from non-stubs. Don't
|
1765
1773
|
// explore those.
|
1766
1774
|
// Don't explore any third-party files unless they're type stub files
|
@@ -1894,8 +1902,8 @@ class Program {
|
|
1894
1902
|
// We found a new import to add. See if it's already part
|
1895
1903
|
// of the program.
|
1896
1904
|
let importedFileInfo;
|
1897
|
-
if (this.
|
1898
|
-
importedFileInfo = this.
|
1905
|
+
if (this.getSourceFileInfo(importInfo.path)) {
|
1906
|
+
importedFileInfo = this.getSourceFileInfo(importInfo.path);
|
1899
1907
|
}
|
1900
1908
|
else {
|
1901
1909
|
const importName = this._getImportNameForFile(importInfo.path);
|
@@ -1924,8 +1932,8 @@ class Program {
|
|
1924
1932
|
// specified by the source file.
|
1925
1933
|
sourceFileInfo.imports = [];
|
1926
1934
|
newImportPathMap.forEach((_, path) => {
|
1927
|
-
if (this.
|
1928
|
-
sourceFileInfo.imports.push(this.
|
1935
|
+
if (this.getSourceFileInfo(path)) {
|
1936
|
+
sourceFileInfo.imports.push(this.getSourceFileInfo(path));
|
1929
1937
|
}
|
1930
1938
|
});
|
1931
1939
|
// Resolve the builtins import for the file. This needs to be
|
@@ -1934,7 +1942,7 @@ class Program {
|
|
1934
1942
|
const builtinsImport = sourceFileInfo.sourceFile.getBuiltinsImport();
|
1935
1943
|
if (builtinsImport && builtinsImport.isImportFound) {
|
1936
1944
|
const resolvedBuiltinsPath = builtinsImport.resolvedPaths[builtinsImport.resolvedPaths.length - 1];
|
1937
|
-
sourceFileInfo.builtinsImport = this.
|
1945
|
+
sourceFileInfo.builtinsImport = this.getSourceFileInfo(resolvedBuiltinsPath);
|
1938
1946
|
}
|
1939
1947
|
// Resolve the ipython display import for the file. This needs to be
|
1940
1948
|
// analyzed before the file can be analyzed.
|
@@ -1942,13 +1950,10 @@ class Program {
|
|
1942
1950
|
const ipythonDisplayImport = sourceFileInfo.sourceFile.getIPythonDisplayImport();
|
1943
1951
|
if (ipythonDisplayImport && ipythonDisplayImport.isImportFound) {
|
1944
1952
|
const resolvedIPythonDisplayPath = ipythonDisplayImport.resolvedPaths[ipythonDisplayImport.resolvedPaths.length - 1];
|
1945
|
-
sourceFileInfo.ipythonDisplayImport = this.
|
1953
|
+
sourceFileInfo.ipythonDisplayImport = this.getSourceFileInfo(resolvedIPythonDisplayPath);
|
1946
1954
|
}
|
1947
1955
|
return filesAdded;
|
1948
1956
|
}
|
1949
|
-
_getSourceFileInfoFromPath(filePath) {
|
1950
|
-
return this._sourceFileMap.get((0, pathUtils_1.normalizePathCase)(this._fs, filePath));
|
1951
|
-
}
|
1952
1957
|
_removeSourceFileFromListAndMap(filePath, indexToRemove) {
|
1953
1958
|
this._sourceFileMap.delete((0, pathUtils_1.normalizePathCase)(this._fs, filePath));
|
1954
1959
|
this._sourceFileList.splice(indexToRemove, 1);
|