mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DS-3803 DS-3803 DS-3635 DS-2871 Jupyter autocompletion implicitly executes code in the editor, fixes and moved ConsolePandasColumnNameCompletionContributor to intellij.pycharm.community.iml module
GitOrigin-RevId: bae7ec7e06cc96feeb3a8f7ed4eb8d897e289547
This commit is contained in:
committed by
intellij-monorepo-bot
parent
d710873956
commit
58badfd492
@@ -110,5 +110,7 @@
|
||||
<orderEntry type="library" name="caffeine" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util.jdom" />
|
||||
<orderEntry type="module" module-name="intellij.platform.ml" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-json" level="project" />
|
||||
<orderEntry type="library" name="kotlinx-serialization-core" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1278,5 +1278,4 @@ python.interpreters.rename.interpreter.dialog.title=Rename Python Interpreter
|
||||
rename.python.interpreter.dialog.provide.name.error.text=Provide a name for Python interpreter.
|
||||
rename.python.interpreter.name.already.exists.error.text=Python interpreter with the same name already exists.
|
||||
|
||||
|
||||
|
||||
pandas.completion.type.text=DataFrame: {0}
|
||||
|
||||
@@ -61,7 +61,9 @@
|
||||
<lang.unwrapDescriptor language="Python" implementationClass="com.jetbrains.python.refactoring.unwrap.PyUnwrapDescriptor"/>
|
||||
<lang.psiStructureViewFactory language="Python" implementationClass="com.jetbrains.python.structureView.PyStructureViewFactory"/>
|
||||
<lang.documentationProvider language="Python" implementationClass="com.jetbrains.python.console.PydevDocumentationProvider"/>
|
||||
<lang.documentationProvider language="Python" implementationClass="com.jetbrains.python.documentation.PythonExternalDocumentationProvider" order="before pythonDocumentationProvider"/>
|
||||
<lang.documentationProvider language="Python"
|
||||
implementationClass="com.jetbrains.python.documentation.PythonExternalDocumentationProvider"
|
||||
order="before pythonDocumentationProvider"/>
|
||||
<lang.emacs language="Python" implementationClass="com.jetbrains.python.editor.PyEmacsHandler"/>
|
||||
<highlightRangeExtension implementation="com.jetbrains.python.validation.PyHighlightingAnnotator"/>
|
||||
<annotator language="Python" implementationClass="com.jetbrains.python.validation.PyAnnotatingVisitor"/>
|
||||
@@ -71,7 +73,8 @@
|
||||
<quoteHandler fileType="Python" className="com.jetbrains.python.editor.PythonQuoteHandler"/>
|
||||
<enterHandlerDelegate implementation="com.jetbrains.python.editor.PythonEnterHandler"/>
|
||||
<enterHandlerDelegate implementation="com.jetbrains.python.editor.PyEnterAtIndentHandler" order="first"/>
|
||||
<enterBetweenBracesDelegate language="Python" implementationClass="com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesAndBracketsDelegate"/>
|
||||
<enterBetweenBracesDelegate language="Python"
|
||||
implementationClass="com.intellij.codeInsight.editorActions.enter.EnterBetweenBracesAndBracketsDelegate"/>
|
||||
<!--suppress PluginXmlValidity -->
|
||||
<editorActionHandler action="EditorCopy" implementationClass="com.intellij.execution.console.ConsoleHistoryCopyHandler"/>
|
||||
|
||||
@@ -92,6 +95,14 @@
|
||||
<completion.contributor language="Python"
|
||||
implementationClass="com.jetbrains.python.testing.PyTestParameterCompletionContributor"/>
|
||||
|
||||
<completion.contributor language="Python"
|
||||
order="first"
|
||||
implementationClass="com.jetbrains.python.console.completion.ConsolePandasColumnNameCompletionContributor"/>
|
||||
|
||||
<projectService serviceInterface="com.jetbrains.python.console.completion.ConsolePandasColumnNameRetrievalService"
|
||||
serviceImplementation="com.jetbrains.python.console.completion.ConsolePandasColumnNameRetrievalServiceImpl"
|
||||
testServiceImplementation="com.jetbrains.python.console.completion.DummyConsolePandasColumnNameRetrievalService"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.python.configuration.PyConfigurableInterpreterList"/>
|
||||
|
||||
<projectService serviceImplementation="com.jetbrains.python.inspections.PyCompatibilityInspectionAdvertiserSettings"/>
|
||||
@@ -111,8 +122,8 @@
|
||||
|
||||
|
||||
<idIndexer filetype="Python" implementationClass="com.jetbrains.python.PyIdIndexer"/>
|
||||
<todoIndexer filetype="Python" implementationClass="com.jetbrains.python.PyTodoIndexer" />
|
||||
<indexPatternBuilder implementation="com.jetbrains.python.PyIndexPatternBuilder" />
|
||||
<todoIndexer filetype="Python" implementationClass="com.jetbrains.python.PyTodoIndexer"/>
|
||||
<indexPatternBuilder implementation="com.jetbrains.python.PyIndexPatternBuilder"/>
|
||||
|
||||
<declarationRangeHandler key="com.jetbrains.python.psi.PyClass"
|
||||
implementationClass="com.jetbrains.python.codeInsight.PyDeclarationRangeHandler"/>
|
||||
@@ -165,29 +176,49 @@
|
||||
<testFinder implementation="com.jetbrains.python.codeInsight.testIntegration.PyTestFinder"/>
|
||||
<testCreator language="Python" implementationClass="com.jetbrains.python.codeInsight.testIntegration.PyTestCreator"/>
|
||||
|
||||
<localInspection language="Python" shortName="PyUnresolvedReferencesInspection" suppressId="PyUnresolvedReferences" bundle="messages.PyPsiBundle" key="INSP.NAME.unresolved.refs" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection"/>
|
||||
<localInspection language="Python" shortName="PyUnresolvedReferencesInspection" suppressId="PyUnresolvedReferences"
|
||||
bundle="messages.PyPsiBundle" key="INSP.NAME.unresolved.refs" groupKey="INSP.GROUP.python" enabledByDefault="true"
|
||||
level="WARNING"
|
||||
implementationClass="com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection"/>
|
||||
<localInspection language="Python" shortName="PyTestParametrizedInspection" suppressId="PyTestParametrized"
|
||||
bundle="messages.PyPsiBundle" key="INSP.NAME.pytest-parametrized" groupKey="INSP.GROUP.python"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.jetbrains.python.testing.pyTestParametrized.PyTestParametrizedInspection"/>
|
||||
<localInspection shortName="PyPackageRequirementsInspection" suppressId="PyPackageRequirements" bundle="messages.PyPsiBundle" key="INSP.NAME.requirements" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyPackageRequirementsInspection"/>
|
||||
<localInspection language="Python" shortName="PyPep8Inspection" suppressId="PyPep8" bundle="messages.PyPsiBundle" key="INSP.pep8.coding.style.violation" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyPep8Inspection" unfair="true"/>
|
||||
<localInspection language="Python" shortName="PyInterpreterInspection" suppressId="PyInterpreter" bundle="messages.PyPsiBundle" key="INSP.NAME.invalid.interpreter" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyInterpreterInspection"/>
|
||||
<localInspection language="Python" shortName="PyStubPackagesCompatibilityInspection" suppressId="PyStubPackagesCompatibility" bundle="messages.PyPsiBundle" key="INSP.stub.packages.compatibility" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.codeInsight.typing.PyStubPackagesCompatibilityInspection"/>
|
||||
<localInspection language="Python" shortName="PyStubPackagesAdvertiser" suppressId="PyStubPackagesAdvertiser" bundle="messages.PyPsiBundle" key="INSP.stub.packages" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.codeInsight.typing.PyStubPackagesAdvertiser"/>
|
||||
<localInspection language="Python" shortName="PyRelativeImportInspection" suppressId="PyPackages" bundle="messages.PyPsiBundle" key="INSP.NAME.relative.import" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyRelativeImportInspection"/>
|
||||
<localInspection shortName="PyPackageRequirementsInspection" suppressId="PyPackageRequirements" bundle="messages.PyPsiBundle"
|
||||
key="INSP.NAME.requirements" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.jetbrains.python.inspections.PyPackageRequirementsInspection"/>
|
||||
<localInspection language="Python" shortName="PyPep8Inspection" suppressId="PyPep8" bundle="messages.PyPsiBundle"
|
||||
key="INSP.pep8.coding.style.violation" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING"
|
||||
implementationClass="com.jetbrains.python.inspections.PyPep8Inspection" unfair="true"/>
|
||||
<localInspection language="Python" shortName="PyInterpreterInspection" suppressId="PyInterpreter" bundle="messages.PyPsiBundle"
|
||||
key="INSP.NAME.invalid.interpreter" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.jetbrains.python.inspections.PyInterpreterInspection"/>
|
||||
<localInspection language="Python" shortName="PyStubPackagesCompatibilityInspection" suppressId="PyStubPackagesCompatibility"
|
||||
bundle="messages.PyPsiBundle" key="INSP.stub.packages.compatibility" groupKey="INSP.GROUP.python"
|
||||
enabledByDefault="true" level="WARNING"
|
||||
implementationClass="com.jetbrains.python.codeInsight.typing.PyStubPackagesCompatibilityInspection"/>
|
||||
<localInspection language="Python" shortName="PyStubPackagesAdvertiser" suppressId="PyStubPackagesAdvertiser"
|
||||
bundle="messages.PyPsiBundle" key="INSP.stub.packages" groupKey="INSP.GROUP.python" enabledByDefault="true"
|
||||
level="WARNING" implementationClass="com.jetbrains.python.codeInsight.typing.PyStubPackagesAdvertiser"/>
|
||||
<localInspection language="Python" shortName="PyRelativeImportInspection" suppressId="PyPackages" bundle="messages.PyPsiBundle"
|
||||
key="INSP.NAME.relative.import" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING"
|
||||
implementationClass="com.jetbrains.python.inspections.PyRelativeImportInspection"/>
|
||||
|
||||
<defaultLiveTemplates file="liveTemplates/Python.xml"/>
|
||||
<liveTemplateContext contextId="Python" implementation="com.jetbrains.python.codeInsight.liveTemplates.PythonTemplateContextType$General"/>
|
||||
<liveTemplateContext contextId="Python_Class" baseContextId="Python" implementation="com.jetbrains.python.codeInsight.liveTemplates.PythonTemplateContextType$Class"/>
|
||||
<liveTemplateContext contextId="Python_Top_Level" baseContextId="Python" implementation="com.jetbrains.python.codeInsight.liveTemplates.PythonTemplateContextType$TopLevel"/>
|
||||
<liveTemplateContext contextId="Python"
|
||||
implementation="com.jetbrains.python.codeInsight.liveTemplates.PythonTemplateContextType$General"/>
|
||||
<liveTemplateContext contextId="Python_Class" baseContextId="Python"
|
||||
implementation="com.jetbrains.python.codeInsight.liveTemplates.PythonTemplateContextType$Class"/>
|
||||
<liveTemplateContext contextId="Python_Top_Level" baseContextId="Python"
|
||||
implementation="com.jetbrains.python.codeInsight.liveTemplates.PythonTemplateContextType$TopLevel"/>
|
||||
<liveTemplateMacro implementation="com.jetbrains.python.codeInsight.liveTemplates.CollectionElementNameMacro"/>
|
||||
<liveTemplateMacro implementation="com.jetbrains.python.codeInsight.liveTemplates.PyClassNameMacro"/>
|
||||
<liveTemplateMacro implementation="com.jetbrains.python.codeInsight.liveTemplates.PyFunctionNameMacro"/>
|
||||
<liveTemplateMacro implementation="com.jetbrains.python.codeInsight.liveTemplates.PyIterableVariableMacro"/>
|
||||
|
||||
<codeInsight.overrideMethod language="Python" implementationClass="com.jetbrains.python.codeInsight.override.PyOverrideMethodsHandler"/>
|
||||
<codeInsight.implementMethod language="Python" implementationClass="com.jetbrains.python.codeInsight.implement.PyImplementMethodsHandler"/>
|
||||
<codeInsight.implementMethod language="Python"
|
||||
implementationClass="com.jetbrains.python.codeInsight.implement.PyImplementMethodsHandler"/>
|
||||
<lang.refactoringSupport language="Python" implementationClass="com.jetbrains.python.refactoring.PyRefactoringProvider"/>
|
||||
<lang.refactoringSupport.classMembersRefactoringSupport language="Python"
|
||||
implementationClass="com.jetbrains.python.refactoring.classes.PyMembersRefactoringSupport"/>
|
||||
@@ -214,12 +245,15 @@
|
||||
implementationClass="com.jetbrains.python.codeInsight.regexp.PythonVerboseRegexpParserDefinition"/>
|
||||
<lang.syntaxHighlighterFactory language="PythonVerboseRegExp"
|
||||
implementationClass="com.jetbrains.python.codeInsight.regexp.PythonVerboseRegexpSyntaxHighlighterFactory"/>
|
||||
<regExpLanguageHost forClass="com.jetbrains.python.psi.impl.PyStringLiteralExpressionImpl" implementationClass="com.jetbrains.python.codeInsight.PythonRegExpHost"/>
|
||||
<regExpLanguageHost forClass="com.jetbrains.python.psi.impl.PyStringLiteralExpressionImpl"
|
||||
implementationClass="com.jetbrains.python.codeInsight.PythonRegExpHost"/>
|
||||
|
||||
<autoImportOptionsProvider instance="com.jetbrains.python.codeInsight.imports.PyAutoImportOptions"/>
|
||||
|
||||
<completion.ml.contextFeatures language="Python" implementationClass="com.jetbrains.python.codeInsight.mlcompletion.PyContextFeatureProvider"/>
|
||||
<completion.ml.elementFeatures language="Python" implementationClass="com.jetbrains.python.codeInsight.mlcompletion.PyElementFeatureProvider"/>
|
||||
<completion.ml.contextFeatures language="Python"
|
||||
implementationClass="com.jetbrains.python.codeInsight.mlcompletion.PyContextFeatureProvider"/>
|
||||
<completion.ml.elementFeatures language="Python"
|
||||
implementationClass="com.jetbrains.python.codeInsight.mlcompletion.PyElementFeatureProvider"/>
|
||||
<completion.confidence language="Python" implementationClass="com.jetbrains.python.codeInsight.completion.PyCompletionConfidence"/>
|
||||
<completion.ml.model implementation="com.jetbrains.python.codeInsight.mlcompletion.PythonMLRankingProvider"/>
|
||||
<typedHandler implementation="com.jetbrains.python.console.completion.PythonConsoleAutopopupBlockingHandler" id="pydevBlockAutoPopup"
|
||||
@@ -245,7 +279,8 @@
|
||||
<moveFileHandler implementation="com.jetbrains.python.refactoring.move.PyMoveFileHandler"/>
|
||||
<refactoring.moveHandler implementation="com.jetbrains.python.refactoring.move.PyMoveSymbolDelegate"/>
|
||||
|
||||
<refactoring.changeSignatureUsageProcessor implementation="com.jetbrains.python.refactoring.changeSignature.PyChangeSignatureUsageProcessor" id="Python"/>
|
||||
<refactoring.changeSignatureUsageProcessor
|
||||
implementation="com.jetbrains.python.refactoring.changeSignature.PyChangeSignatureUsageProcessor" id="Python"/>
|
||||
|
||||
<lang.importOptimizer language="Python" implementationClass="com.jetbrains.python.codeInsight.imports.PyImportOptimizer"/>
|
||||
|
||||
@@ -266,13 +301,17 @@
|
||||
key="configurable.PySmartKeysOptions.display.name"/>
|
||||
|
||||
<!-- We run it before FilePathCompletionContributor (id="filePath") to get help text about full path results in the extended completion -->
|
||||
<psi.referenceContributor implementation="com.jetbrains.python.codeInsight.PySoftFileReferenceContributor" language="Python" order="before filePath"/>
|
||||
<psi.referenceContributor implementation="com.jetbrains.python.codeInsight.PyConsoleFileReferenceContributor" language="Python" order="before filePath"/>
|
||||
<psi.referenceContributor implementation="com.jetbrains.python.testing.pyTestFixtures.PyTestFixtureReferenceContributor" language="Python"/>
|
||||
<psi.referenceContributor implementation="com.jetbrains.python.codeInsight.PySoftFileReferenceContributor" language="Python"
|
||||
order="before filePath"/>
|
||||
<psi.referenceContributor implementation="com.jetbrains.python.codeInsight.PyConsoleFileReferenceContributor" language="Python"
|
||||
order="before filePath"/>
|
||||
<psi.referenceContributor implementation="com.jetbrains.python.testing.pyTestFixtures.PyTestFixtureReferenceContributor"
|
||||
language="Python"/>
|
||||
|
||||
<applicationConfigurable groupId="tools" instance="com.jetbrains.python.documentation.PythonDocumentationConfigurable"
|
||||
id="com.jetbrains.python.documentation.PythonDocumentationConfigurable"/>
|
||||
<applicationConfigurable parentId="project.propDebugger" instance="com.jetbrains.python.debugger.variablesview.usertyperenderers.PyUserTypeRenderersConfigurable"
|
||||
<applicationConfigurable parentId="project.propDebugger"
|
||||
instance="com.jetbrains.python.debugger.variablesview.usertyperenderers.PyUserTypeRenderersConfigurable"
|
||||
id="debugger.dataViews.python.type.renderers"/>
|
||||
<projectConfigurable groupId="tools" instance="com.jetbrains.python.configuration.PyIntegratedToolsModulesConfigurable"
|
||||
id="com.jetbrains.python.configuration.PyIntegratedToolsModulesConfigurable"
|
||||
@@ -319,13 +358,15 @@
|
||||
<backgroundPostStartupActivity implementation="com.jetbrains.python.sdk.PythonSdkUpdater"/>
|
||||
|
||||
<backgroundPostStartupActivity implementation="com.jetbrains.python.packaging.PyPackagesUpdater"/>
|
||||
<directoryProjectConfigurator implementation="com.jetbrains.python.configuration.PyDefaultProjectAwareServiceConfigurator" id="integratedTools" order="after sdk"/>
|
||||
<directoryProjectConfigurator implementation="com.jetbrains.python.configuration.PyDefaultProjectAwareServiceConfigurator"
|
||||
id="integratedTools" order="after sdk"/>
|
||||
|
||||
|
||||
<macro implementation="com.jetbrains.python.sdk.InterpreterDirectoryMacro"/>
|
||||
|
||||
<!-- User skeletons -->
|
||||
<codeInsight.lineMarkerProvider language="Python" implementationClass="com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsLineMarkerProvider"/>
|
||||
<codeInsight.lineMarkerProvider language="Python"
|
||||
implementationClass="com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsLineMarkerProvider"/>
|
||||
|
||||
<!-- TestRunnerService -->
|
||||
<moduleService serviceImplementation="com.jetbrains.python.testing.TestRunnerService$ModuleService"/>
|
||||
@@ -337,8 +378,10 @@
|
||||
|
||||
<!-- Namespace packages -->
|
||||
<moduleService serviceImplementation="com.jetbrains.python.namespacePackages.PyNamespacePackagesService"/>
|
||||
<registryKey key="python.explicit.namespace.packages" defaultValue="true" restartRequired="true" description="Require marking namespace packages explicitly, treat regular directories as implicit source roots"/>
|
||||
<registryKey key="python.create.namespace.package.action" defaultValue="false" description="Possibility to create namespace packages from New | Python Package"/>
|
||||
<registryKey key="python.explicit.namespace.packages" defaultValue="true" restartRequired="true"
|
||||
description="Require marking namespace packages explicitly, treat regular directories as implicit source roots"/>
|
||||
<registryKey key="python.create.namespace.package.action" defaultValue="false"
|
||||
description="Possibility to create namespace packages from New | Python Package"/>
|
||||
|
||||
<!-- typing -->
|
||||
<multiHostInjector implementation="com.jetbrains.python.codeInsight.typing.PyTypingAnnotationInjector"/>
|
||||
@@ -364,12 +407,14 @@
|
||||
<createFromTemplateHandler implementation="com.jetbrains.python.packaging.setupPy.PyCreateSetupPyFromTemplateHandler"/>
|
||||
|
||||
<consoleHistoryModelProvider implementation="com.jetbrains.python.console.PyConsoleHistoryModelProvider"/>
|
||||
<scratch.rootType implementation="com.jetbrains.python.console.PyConsoleRootType" />
|
||||
<scratch.rootType implementation="com.jetbrains.python.console.PyConsoleRootType"/>
|
||||
<consoleFilterProvider implementation="com.jetbrains.python.run.PyMessageFilterProvider"/>
|
||||
|
||||
<!-- Run Anything -->
|
||||
<runAnything.executionProvider order="after RunAnythingRunConfigurationProvider" implementation="com.jetbrains.python.run.runAnything.PyRunAnythingProvider"/>
|
||||
<runAnything.executionProvider order="after RunAnythingRunConfigurationProvider" implementation="com.jetbrains.python.run.runAnything.PyConsoleRunAnythingProvider"/>
|
||||
<runAnything.executionProvider order="after RunAnythingRunConfigurationProvider"
|
||||
implementation="com.jetbrains.python.run.runAnything.PyRunAnythingProvider"/>
|
||||
<runAnything.executionProvider order="after RunAnythingRunConfigurationProvider"
|
||||
implementation="com.jetbrains.python.run.runAnything.PyConsoleRunAnythingProvider"/>
|
||||
<runAnything.commandCustomizer implementation="com.jetbrains.python.run.runAnything.PyRunAnythingCommandCustomizer"/>
|
||||
|
||||
<!-- Statistics -->
|
||||
@@ -380,22 +425,31 @@
|
||||
<statistics.counterUsagesCollector implementationClass="com.jetbrains.python.namespacePackages.PyNamespacePackagesStatisticsCollector"/>
|
||||
|
||||
<!-- Code-insight IDE bridge -->
|
||||
<applicationService serviceInterface="com.jetbrains.python.PythonRuntimeService" serviceImplementation="com.jetbrains.python.PythonRuntimeServiceImpl"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.PythonCodeStyleService" serviceImplementation="com.jetbrains.python.PythonCodeStyleServiceImpl"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.PythonUiService" serviceImplementation="com.jetbrains.python.PythonUiServiceImpl"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.codeInsight.imports.PyImportCollectorFactory" serviceImplementation="com.jetbrains.python.codeInsight.imports.CodeStylePyImportCollectorFactory"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.codeInsight.imports.ImportChooser" serviceImplementation="com.jetbrains.python.codeInsight.imports.PyImportChooser"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.refactoring.PyRefactoringUiService" serviceImplementation="com.jetbrains.python.refactoring.PyRefactoringUiServiceImpl"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.PythonRuntimeService"
|
||||
serviceImplementation="com.jetbrains.python.PythonRuntimeServiceImpl"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.PythonCodeStyleService"
|
||||
serviceImplementation="com.jetbrains.python.PythonCodeStyleServiceImpl"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.PythonUiService"
|
||||
serviceImplementation="com.jetbrains.python.PythonUiServiceImpl"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.codeInsight.imports.PyImportCollectorFactory"
|
||||
serviceImplementation="com.jetbrains.python.codeInsight.imports.CodeStylePyImportCollectorFactory"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.codeInsight.imports.ImportChooser"
|
||||
serviceImplementation="com.jetbrains.python.codeInsight.imports.PyImportChooser"/>
|
||||
<applicationService serviceInterface="com.jetbrains.python.refactoring.PyRefactoringUiService"
|
||||
serviceImplementation="com.jetbrains.python.refactoring.PyRefactoringUiServiceImpl"/>
|
||||
|
||||
<registryKey key="python.relative.import.depth" defaultValue="3" description="Specifies default acceptable number of dots in a relative import statement"/>
|
||||
<registryKey key="python.relative.import.depth" defaultValue="3"
|
||||
description="Specifies default acceptable number of dots in a relative import statement"/>
|
||||
|
||||
<!-- flake8 -->
|
||||
<lang.inspectionSuppressor language="Python" implementationClass="com.jetbrains.python.inspections.flake8.Flake8InspectionSuppressor"/>
|
||||
<daemon.changeLocalityDetector implementation="com.jetbrains.python.inspections.flake8.Flake8SuppressingCommentLocalityDetector"/>
|
||||
|
||||
<!-- # type: ignore -->
|
||||
<lang.inspectionSuppressor language="Python" implementationClass="com.jetbrains.python.inspections.typeignore.TypeIgnoreInspectionSuppressor"/>
|
||||
<daemon.changeLocalityDetector implementation="com.jetbrains.python.inspections.typeignore.TypeIgnoreSuppressingCommentLocalityDetector"/>
|
||||
<lang.inspectionSuppressor language="Python"
|
||||
implementationClass="com.jetbrains.python.inspections.typeignore.TypeIgnoreInspectionSuppressor"/>
|
||||
<daemon.changeLocalityDetector
|
||||
implementation="com.jetbrains.python.inspections.typeignore.TypeIgnoreSuppressingCommentLocalityDetector"/>
|
||||
|
||||
<!-- Pipenv -->
|
||||
<editorFactoryListener implementation="com.jetbrains.python.sdk.pipenv.PipEnvPipFileWatcher"/>
|
||||
@@ -409,17 +463,24 @@
|
||||
<postStartupActivity implementation="com.jetbrains.python.sdk.poetry.PoetryConfigLoader" order="last"/>
|
||||
|
||||
<!-- Targets API -->
|
||||
<registryKey key="python.use.targets.api" defaultValue="true" description="Switches Python support to Targets API." />
|
||||
<notificationGroup id="Python Debugger" displayType="TOOL_WINDOW" toolWindowId="Debug" bundle="messages.PyBundle" key="debug.notification.group"/>
|
||||
<notificationGroup id="Python SDK Updater" displayType="BALLOON" bundle="messages.PyBundle" key="python.sdk.updater.notifications.group.title"/>
|
||||
<registryKey key="python.use.targets.api" defaultValue="true" description="Switches Python support to Targets API."/>
|
||||
<notificationGroup id="Python Debugger" displayType="TOOL_WINDOW" toolWindowId="Debug" bundle="messages.PyBundle"
|
||||
key="debug.notification.group"/>
|
||||
<notificationGroup id="Python SDK Updater" displayType="BALLOON" bundle="messages.PyBundle"
|
||||
key="python.sdk.updater.notifications.group.title"/>
|
||||
<notificationGroup id="Sync Python requirements" displayType="BALLOON" bundle="messages.PyBundle" key="python.requirements.balloon"/>
|
||||
<notificationGroup id="CythonWarning" displayType="BALLOON" bundle="messages.PyBundle" key="notification.group.cython"/>
|
||||
<notificationGroup id="Python Compatibility Inspection Advertiser" displayType="STICKY_BALLOON" isLogByDefault="false" bundle="messages.PyBundle" key="python.compatibility.inspection.advertiser.notifications.group.title"/>
|
||||
<notificationGroup id="Package requirements" displayType="BALLOON" isLogByDefault="false" bundle="messages.PyBundle" key="notification.group.package.requirements"/>
|
||||
<notificationGroup id="Pipfile Watcher" displayType="STICKY_BALLOON" isLogByDefault="false" bundle="messages.PyBundle" key="python.sdk.pipenv.pip.file.watcher"/>
|
||||
<notificationGroup id="ConfiguredPythonInterpreter" displayType="BALLOON" isLogByDefault="true" bundle="messages.PyBundle" key="sdk.has.been.configured.notification.name"/>
|
||||
<notificationGroup id="Python Compatibility Inspection Advertiser" displayType="STICKY_BALLOON" isLogByDefault="false"
|
||||
bundle="messages.PyBundle" key="python.compatibility.inspection.advertiser.notifications.group.title"/>
|
||||
<notificationGroup id="Package requirements" displayType="BALLOON" isLogByDefault="false" bundle="messages.PyBundle"
|
||||
key="notification.group.package.requirements"/>
|
||||
<notificationGroup id="Pipfile Watcher" displayType="STICKY_BALLOON" isLogByDefault="false" bundle="messages.PyBundle"
|
||||
key="python.sdk.pipenv.pip.file.watcher"/>
|
||||
<notificationGroup id="ConfiguredPythonInterpreter" displayType="BALLOON" isLogByDefault="true" bundle="messages.PyBundle"
|
||||
key="sdk.has.been.configured.notification.name"/>
|
||||
<notificationGroup id="Packaging" displayType="BALLOON" bundle="messages.PyBundle" key="notification.group.packaging"/>
|
||||
<notificationGroup id="pyproject.toml Watcher" displayType="STICKY_BALLOON" isLogByDefault="true" bundle="messages.PyBundle" key="python.sdk.poetry.pip.file.watcher"/>
|
||||
<notificationGroup id="pyproject.toml Watcher" displayType="STICKY_BALLOON" isLogByDefault="true" bundle="messages.PyBundle"
|
||||
key="python.sdk.poetry.pip.file.watcher"/>
|
||||
|
||||
<toolWindow id="Python Packages" anchor="bottom"
|
||||
icon="PythonIcons.Python.PythonPackages"
|
||||
@@ -431,16 +492,20 @@
|
||||
|
||||
<executionTargetLanguageRuntimeType implementation="com.jetbrains.python.target.PythonLanguageRuntimeType"/>
|
||||
|
||||
<!-- Code vision -->
|
||||
<!-- Code vision -->
|
||||
<vcs.codeVisionLanguageContext language="Python" implementationClass="com.jetbrains.python.vcs.PyVcsContextProvider"/>
|
||||
</extensions>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint qualifiedName="Pythonid.remoteSdkValidator" interface="com.jetbrains.python.sdk.PyRemoteSdkValidator" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyTestFixtureExtension" interface="com.jetbrains.python.testing.pyTestFixtures.PyTestFixtureExtension" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyTestConfigurationSelector" interface="com.jetbrains.python.testing.PyTestConfigurationSelector" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pythonCommandLineEnvironmentProvider" interface="com.jetbrains.python.run.PythonCommandLineEnvironmentProvider" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pythonCommandLineTargetEnvironmentProvider" interface="com.jetbrains.python.run.target.PythonCommandLineTargetEnvironmentProvider" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyTestFixtureExtension"
|
||||
interface="com.jetbrains.python.testing.pyTestFixtures.PyTestFixtureExtension" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyTestConfigurationSelector"
|
||||
interface="com.jetbrains.python.testing.PyTestConfigurationSelector" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pythonCommandLineEnvironmentProvider"
|
||||
interface="com.jetbrains.python.run.PythonCommandLineEnvironmentProvider" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pythonCommandLineTargetEnvironmentProvider"
|
||||
interface="com.jetbrains.python.run.target.PythonCommandLineTargetEnvironmentProvider" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.magicLiteral"
|
||||
interface="com.jetbrains.python.magicLiteral.PyMagicLiteralExtensionPoint"
|
||||
dynamic="true"/>
|
||||
@@ -452,13 +517,17 @@
|
||||
<extensionPoint qualifiedName="Pythonid.documentationLinkProvider"
|
||||
interface="com.jetbrains.python.documentation.PythonDocumentationLinkProvider"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.runConfigurationExtension" interface="com.jetbrains.python.run.PythonRunConfigurationExtension" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.runConfigurationExtension" interface="com.jetbrains.python.run.PythonRunConfigurationExtension"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.remoteInterpreterManager"
|
||||
interface="com.jetbrains.python.remote.PythonRemoteInterpreterManager"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.remoteSkeletonGeneratorFactory" interface="com.jetbrains.python.remote.PyRemoteSkeletonGeneratorFactory" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.remoteProcessStarterManager" interface="com.jetbrains.python.run.PyRemoteProcessStarterManager" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.remoteConsoleProcessCreator" interface="com.jetbrains.python.console.PythonConsoleRemoteProcessCreator" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.remoteSkeletonGeneratorFactory"
|
||||
interface="com.jetbrains.python.remote.PyRemoteSkeletonGeneratorFactory" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.remoteProcessStarterManager" interface="com.jetbrains.python.run.PyRemoteProcessStarterManager"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.remoteConsoleProcessCreator"
|
||||
interface="com.jetbrains.python.console.PythonConsoleRemoteProcessCreator" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.breakpointHandler"
|
||||
interface="com.jetbrains.python.debugger.PyBreakpointHandlerFactory"
|
||||
dynamic="true"/>
|
||||
@@ -466,14 +535,16 @@
|
||||
interface="com.jetbrains.python.console.PyConsoleOptionsProvider"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyRootTypeProvider" interface="com.jetbrains.python.module.PyRootTypeProvider" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.runConfigurationEditorExtension" interface="com.jetbrains.python.run.PyRunConfigurationEditorExtension" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.runConfigurationEditorExtension"
|
||||
interface="com.jetbrains.python.run.PyRunConfigurationEditorExtension" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyCustomSdkUiProvider"
|
||||
interface="com.jetbrains.python.sdk.PyCustomSdkUiProvider"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pep8ProblemSuppressor"
|
||||
interface="com.jetbrains.python.validation.Pep8ProblemSuppressor"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.debugSessionFactory" interface="com.jetbrains.python.debugger.PyDebugSessionFactory" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.debugSessionFactory" interface="com.jetbrains.python.debugger.PyDebugSessionFactory"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pythonSdkComparator" interface="com.jetbrains.python.sdk.PySdkComparator" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.pyPregeneratedSkeletonsProvider"
|
||||
interface="com.jetbrains.python.sdk.skeletons.PyPregeneratedSkeletonsProvider"
|
||||
@@ -485,7 +556,8 @@
|
||||
<extensionPoint qualifiedName="Pythonid.projectSynchronizerProvider"
|
||||
interface="com.jetbrains.python.remote.PyProjectSynchronizerProvider"
|
||||
dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.sshInterpreterManager" interface="com.jetbrains.python.remote.PythonSshInterpreterManager" dynamic="true"/>
|
||||
<extensionPoint qualifiedName="Pythonid.sshInterpreterManager" interface="com.jetbrains.python.remote.PythonSshInterpreterManager"
|
||||
dynamic="true"/>
|
||||
|
||||
<extensionPoint qualifiedName="Pythonid.condaSdkCustomizer"
|
||||
interface="com.jetbrains.python.sdk.conda.PyCondaSdkCustomizer"
|
||||
@@ -627,8 +699,8 @@
|
||||
<add-to-group group-id="EditorPopupMenu" anchor="before" relative-to-action="CompareClipboardWithSelection"/>
|
||||
|
||||
<keyboard-shortcut keymap="$default" first-keystroke="alt shift E"/>
|
||||
<keyboard-shortcut keymap="Mac OS X" first-keystroke="control shift E" />
|
||||
<keyboard-shortcut keymap="Mac OS X 10.5+" first-keystroke="control shift E" />
|
||||
<keyboard-shortcut keymap="Mac OS X" first-keystroke="control shift E"/>
|
||||
<keyboard-shortcut keymap="Mac OS X 10.5+" first-keystroke="control shift E"/>
|
||||
<keyboard-shortcut keymap="Eclipse" first-keystroke="ctrl alt E" replace-all="true"/>
|
||||
<keyboard-shortcut keymap="NetBeans 6.5" first-keystroke="ctrl alt E" replace-all="true"/>
|
||||
</action>
|
||||
@@ -674,22 +746,23 @@
|
||||
<add-to-group group-id="XDebugger.ValueGroup" anchor="after" relative-to-action="Debugger.AddToWatch"/>
|
||||
</action>
|
||||
|
||||
<action id="PyDebugger.CustomizeDataView" class="com.jetbrains.python.debugger.variablesview.usertyperenderers.ConfigureTypeRenderersAction">
|
||||
<action id="PyDebugger.CustomizeDataView"
|
||||
class="com.jetbrains.python.debugger.variablesview.usertyperenderers.ConfigureTypeRenderersAction">
|
||||
<add-to-group group-id="XDebugger.ValueGroup" anchor="first"/>
|
||||
</action>
|
||||
|
||||
<action id="PyDebugger.ViewAsGroup" class="com.jetbrains.python.debugger.actions.ViewAsGroup">
|
||||
<add-to-group group-id="XDebugger.ValueGroup" anchor="last" />
|
||||
<add-to-group group-id="XDebugger.ValueGroup" anchor="last"/>
|
||||
</action>
|
||||
|
||||
<action id="PyConvertModuleToPackage" class="com.jetbrains.python.refactoring.convertModulePackage.PyConvertModuleToPackageAction"
|
||||
>
|
||||
<add-to-group group-id="RefactoringMenu" anchor="last" />
|
||||
<add-to-group group-id="RefactoringMenu" anchor="last"/>
|
||||
</action>
|
||||
|
||||
<action id="PyConvertPackageToModuleAction" class="com.jetbrains.python.refactoring.convertModulePackage.PyConvertPackageToModuleAction"
|
||||
>
|
||||
<add-to-group group-id="RefactoringMenu" anchor="last" />
|
||||
<add-to-group group-id="RefactoringMenu" anchor="last"/>
|
||||
</action>
|
||||
|
||||
<action id="StepIntoMyCode" class="com.jetbrains.python.debugger.PyStepIntoMyCodeAction" icon="PythonIcons.Python.Debug.StepIntoMyCode">
|
||||
@@ -699,7 +772,8 @@
|
||||
<keyboard-shortcut keymap="$default" first-keystroke="alt shift F7" replace-all="true"/>
|
||||
<keyboard-shortcut keymap="Mac OS X" first-keystroke="alt shift F7" replace-all="true"/>
|
||||
<keyboard-shortcut keymap="Mac OS X 10.5+" first-keystroke="alt shift F7" replace-all="true"/>
|
||||
<keyboard-shortcut keymap="macOS System Shortcuts" first-keystroke="alt shift SEMICOLON" second-keystroke="alt shift F7" replace-all="true"/>
|
||||
<keyboard-shortcut keymap="macOS System Shortcuts" first-keystroke="alt shift SEMICOLON" second-keystroke="alt shift F7"
|
||||
replace-all="true"/>
|
||||
</action>
|
||||
|
||||
<action id="SetNextStatement" class="com.jetbrains.python.debugger.PySetNextStatementAction">
|
||||
@@ -723,7 +797,8 @@
|
||||
<extensions defaultExtensionNs="com.intellij.spellchecker">
|
||||
<support language="Python" implementationClass="com.jetbrains.python.spellchecker.PythonSpellcheckerStrategy"/>
|
||||
<bundledDictionaryProvider implementation="com.jetbrains.python.spellchecker.PythonBundledDictionaryProvider"/>
|
||||
<dictionary.runtimeDictionaryProvider implementation="com.jetbrains.python.packaging.PyPackagesDictionary$PyPackagesDictionaryProvider"/>
|
||||
<dictionary.runtimeDictionaryProvider
|
||||
implementation="com.jetbrains.python.packaging.PyPackagesDictionary$PyPackagesDictionaryProvider"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="com.jetbrains.python.console">
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package com.jetbrains.python.console.completion
|
||||
|
||||
import com.intellij.codeInsight.completion.*
|
||||
import com.intellij.execution.ui.RunContentDescriptor
|
||||
import com.intellij.openapi.application.ex.ApplicationUtil
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.project.DumbAware
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.patterns.PlatformPatterns
|
||||
import com.intellij.util.ProcessingContext
|
||||
import com.jetbrains.python.actions.checkIfAvailableAndShowHint
|
||||
import com.jetbrains.python.actions.getCustomDescriptor
|
||||
import com.jetbrains.python.actions.getSelectedPythonConsole
|
||||
import com.jetbrains.python.console.PyExecuteConsoleCustomizer
|
||||
import com.jetbrains.python.console.PydevConsoleCommunication
|
||||
import com.jetbrains.python.console.PythonConsoleView
|
||||
import kotlinx.serialization.SerializationException
|
||||
import kotlinx.serialization.decodeFromString
|
||||
import kotlinx.serialization.json.Json
|
||||
import java.lang.invoke.MethodHandles
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
class ConsolePandasColumnNameCompletionContributor : CompletionContributor(), DumbAware {
|
||||
|
||||
init {
|
||||
extend(CompletionType.BASIC, PlatformPatterns.psiElement(), object : CompletionProvider<CompletionParameters>() {
|
||||
override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, result: CompletionResultSet) {
|
||||
val project = parameters.editor.project ?: return
|
||||
val editor = parameters.editor
|
||||
val virtualFile = parameters.originalFile.virtualFile
|
||||
|
||||
if (!checkIfAvailableAndShowHint(editor)) return
|
||||
val existingConsole = getDescriptorIfExist(virtualFile, project, editor) ?: return
|
||||
val pydevRunner: PythonConsoleView = existingConsole.executionConsole as? PythonConsoleView ?: return
|
||||
val consoleCommunication = pydevRunner.executeActionHandler?.consoleCommunication as? PydevConsoleCommunication ?: return
|
||||
if (consoleCommunication.isExecuting) return
|
||||
|
||||
val dataFrameCandidates = getCompleteAttribute(parameters)
|
||||
ApplicationUtil.runWithCheckCanceled(Callable {
|
||||
result.addAllElements(dataFrameCandidates.flatMap { candidate ->
|
||||
val columnsDataFrame = getDataFrameColumns(project, candidate.psiName, consoleCommunication)
|
||||
processDataFrameColumns(candidate.psiName, columnsDataFrame, candidate.needValidatorCheck,
|
||||
parameters.position, project, false)
|
||||
})
|
||||
}, ProgressManager.getInstance().progressIndicator)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun getDescriptorIfExist(virtualFile: VirtualFile?, project: Project, editor: Editor): RunContentDescriptor? {
|
||||
if (virtualFile != null && PyExecuteConsoleCustomizer.instance.isCustomDescriptorSupported(virtualFile)) {
|
||||
tryGetCustomDescriptor(project, editor)?.let { return it }
|
||||
}
|
||||
return getSelectedPythonConsole(project)
|
||||
}
|
||||
|
||||
private fun tryGetCustomDescriptor(project: Project, editor: Editor): RunContentDescriptor? {
|
||||
try {
|
||||
val (descriptor, _) = getCustomDescriptor(project, editor)
|
||||
return descriptor
|
||||
}
|
||||
catch (e: IllegalStateException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun getDataFrameColumns(project: Project, name: @NlsSafe String, consoleCommunication: PydevConsoleCommunication): List<String> {
|
||||
val service = project.service<ConsolePandasColumnNameRetrievalService>()
|
||||
return service.getPandasColumns(consoleCommunication, name)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val LOG = Logger.getInstance(MethodHandles.lookup().lookupClass())
|
||||
const val COMPLETION_LOG_MESSAGE = "Incorrectly created python script with expression: "
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface ConsolePandasColumnNameRetrievalService {
|
||||
fun getPandasColumns(consoleCommunication: PydevConsoleCommunication, name: @NlsSafe String): List<String>
|
||||
}
|
||||
|
||||
class DummyConsolePandasColumnNameRetrievalService : ConsolePandasColumnNameRetrievalService {
|
||||
override fun getPandasColumns(consoleCommunication: PydevConsoleCommunication, name: @NlsSafe String): List<String> = listOf()
|
||||
}
|
||||
|
||||
|
||||
class ConsolePandasColumnNameRetrievalServiceImpl(val project: Project) : ConsolePandasColumnNameRetrievalService {
|
||||
override fun getPandasColumns(consoleCommunication: PydevConsoleCommunication, name: @NlsSafe String): List<String> {
|
||||
|
||||
val debugValue = consoleCommunication.evaluate(PANDAS_COLUMN_NAMES_CODE.format(name, name), true, true)
|
||||
return when (debugValue.type) {
|
||||
"str" -> debugValue.value?.let { parseDebugValue(it) } ?: emptyList()
|
||||
"NameError" -> emptyList()
|
||||
"SyntaxError" -> {
|
||||
ConsolePandasColumnNameCompletionContributor.LOG.error(ConsolePandasColumnNameCompletionContributor.COMPLETION_LOG_MESSAGE + name)
|
||||
emptyList()
|
||||
}
|
||||
else -> emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun parseDebugValue(value: String): List<String>? {
|
||||
|
||||
try {
|
||||
val map = Json.decodeFromString<Map<String, List<String>>>(value)
|
||||
return map["columns"]
|
||||
}
|
||||
catch (_: SerializationException) {
|
||||
return emptyList()
|
||||
}
|
||||
catch (_: IllegalArgumentException) {
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PANDAS_COLUMN_NAMES_CODE = "__import__('json').dumps({\"columns\":list(%s.columns.get_level_values(0))}) if str(%s.__class__)==\"<class 'pandas.core.frame.DataFrame'>\" else {}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package com.jetbrains.python.console.completion
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionParameters
|
||||
import com.intellij.codeInsight.completion.PrioritizedLookupElement
|
||||
import com.intellij.codeInsight.completion.ml.MLRankingIgnorable
|
||||
import com.intellij.codeInsight.lookup.LookupElement
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||
import com.intellij.codeInsight.lookup.LookupElementDecorator
|
||||
import com.intellij.lang.LanguageNamesValidation
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.psi.util.elementType
|
||||
import com.jetbrains.python.PyBundle
|
||||
import com.jetbrains.python.PyTokenTypes
|
||||
import com.jetbrains.python.PythonLanguage
|
||||
import com.jetbrains.python.psi.*
|
||||
import com.jetbrains.python.psi.impl.PyPsiUtils
|
||||
|
||||
/**
|
||||
*
|
||||
* This data class collect information about possible DataFrame.
|
||||
* @param psiName - name of PsiElement, that could be DataFrame type
|
||||
* @param needValidatorCheck - boolean flag to switch on check for validating columns name
|
||||
* LanguageNamesValidation.INSTANCE.forLanguage(PythonLanguage.getInstance()).isIdentifier()
|
||||
*
|
||||
*/
|
||||
data class PandasDataFrameCandidate(val psiName: String, val needValidatorCheck: Boolean)
|
||||
|
||||
|
||||
// Priority value to control order in CompletionResultSet
|
||||
private const val DATAFRAME_COLUMN_PRIORITY = 100.0
|
||||
|
||||
fun getCompleteAttribute(parameters: CompletionParameters): List<PandasDataFrameCandidate> {
|
||||
val currentElement: PsiElement?
|
||||
val needValidatorCheck: Boolean
|
||||
val parentLambdaExpression: PyExpression?
|
||||
val candidates = mutableListOf<PandasDataFrameCandidate>()
|
||||
val callInnerReferenceExpression = getCallInnerReferenceExpression(parameters)
|
||||
|
||||
findCompleteAttribute(parameters)?.let {
|
||||
currentElement = it.first
|
||||
needValidatorCheck = it.second
|
||||
when (currentElement) {
|
||||
is PyCallExpression, is PyParenthesizedExpression -> {
|
||||
return emptyList()
|
||||
}
|
||||
is PyExpression -> {
|
||||
parentLambdaExpression = collectParentOfLambdaExpression(currentElement, callInnerReferenceExpression)
|
||||
parentLambdaExpression?.text?.let { name -> candidates.add(PandasDataFrameCandidate(name, needValidatorCheck)) }
|
||||
}
|
||||
!is PyReferenceExpression -> {
|
||||
return emptyList()
|
||||
}
|
||||
}
|
||||
currentElement.text?.let { name -> candidates.add(PandasDataFrameCandidate(name, needValidatorCheck)) }
|
||||
}
|
||||
if (!candidates.isEmpty()) return candidates
|
||||
return getPossibleObjectsDataFrame(parameters, callInnerReferenceExpression)
|
||||
|
||||
}
|
||||
|
||||
private fun getPossibleObjectsDataFrame(parameters: CompletionParameters,
|
||||
callInnerReferenceExpression: PyExpression?): List<PandasDataFrameCandidate> {
|
||||
return setOfNotNull(
|
||||
callInnerReferenceExpression?.text,
|
||||
getSliceSubscriptionReferenceExpression(parameters)?.text,
|
||||
getAttributeReferenceExpression(parameters)?.text
|
||||
).map { PandasDataFrameCandidate(it, false) }
|
||||
}
|
||||
|
||||
private fun findCompleteAttribute(parameters: CompletionParameters): Pair<PsiElement, Boolean>? {
|
||||
var needCheck = true
|
||||
var element = parameters.position
|
||||
|
||||
if (element.prevSibling?.elementType != PyTokenTypes.DOT && element.parent?.prevSibling?.elementType == PyTokenTypes.LBRACKET) {
|
||||
needCheck = false
|
||||
element = element.parent
|
||||
}
|
||||
|
||||
val exactElement = element.prevSibling?.prevSibling
|
||||
when {
|
||||
exactElement != null ->
|
||||
return Pair(exactElement, needCheck)
|
||||
|
||||
else -> return null
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCallInnerReferenceExpression(parameters: CompletionParameters): PyExpression? {
|
||||
var callExpression: PyCallExpression? = PsiTreeUtil.getParentOfType(parameters.position, PyCallExpression::class.java)
|
||||
?: return null
|
||||
var referenceExpression: PyReferenceExpression? = null
|
||||
|
||||
while (true) {
|
||||
val tmp = PsiTreeUtil.findChildOfType(callExpression, PyReferenceExpression::class.java)
|
||||
if (tmp == null) break
|
||||
referenceExpression = tmp
|
||||
callExpression = PsiTreeUtil.getChildOfType(referenceExpression, PyCallExpression::class.java)
|
||||
}
|
||||
if (referenceExpression != null) {
|
||||
return PyPsiUtils.getFirstQualifier(referenceExpression)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun getSliceSubscriptionReferenceExpression(parameters: CompletionParameters): PyExpression? {
|
||||
val expression = PsiTreeUtil.getParentOfType(parameters.position, PySubscriptionExpression::class.java)
|
||||
?: PsiTreeUtil.getParentOfType(parameters.position, PySliceExpression::class.java)
|
||||
val result = PsiTreeUtil.getChildOfType(expression, PyReferenceExpression::class.java)
|
||||
if (result != null) {
|
||||
return PyPsiUtils.getFirstQualifier(result)
|
||||
}
|
||||
if (expression != null) {
|
||||
return getSliceSubscriptionReferenceExpressionWithMultiIndex(expression)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun getSliceSubscriptionReferenceExpressionWithMultiIndex(expression: PyExpression)
|
||||
: PyExpression? {
|
||||
var count = 0
|
||||
var child = expression.copy()
|
||||
|
||||
while (PsiTreeUtil.getChildOfType(child, PyReferenceExpression::class.java) == null && child != null) {
|
||||
count++
|
||||
child = PsiTreeUtil.getChildOfType(child, PySubscriptionExpression::class.java)
|
||||
}
|
||||
|
||||
val result = PsiTreeUtil.getChildOfType(child, PyReferenceExpression::class.java)
|
||||
if (result != null) {
|
||||
return PyPsiUtils.getFirstQualifier(result)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun getAttributeReferenceExpression(parameters: CompletionParameters): PyExpression? {
|
||||
val result = PsiTreeUtil.getParentOfType(parameters.position, PyReferenceExpression::class.java)
|
||||
|
||||
if (result != null) {
|
||||
val child = PsiTreeUtil.getChildrenOfType(result, PyExpression::class.java) ?: emptyArray()
|
||||
if (!child.isEmpty()) {
|
||||
return child[0]
|
||||
}
|
||||
return PyPsiUtils.getFirstQualifier(result)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
private fun collectParentOfLambdaExpression(element: PyExpression, callInnerReferenceExpression: PyExpression?): PyExpression? {
|
||||
if (callInnerReferenceExpression != null) {
|
||||
val lambdaExpression = PsiTreeUtil.getParentOfType(element, PyLambdaExpression::class.java)
|
||||
|
||||
if (lambdaExpression != null && callInnerReferenceExpression is PyQualifiedExpression) {
|
||||
if (lambdaExpression.parameterList.parameters.any { it.name == element.name }) {
|
||||
val callInnerReferencePyExpression = callInnerReferenceExpression as? PyQualifiedExpression
|
||||
return callInnerReferencePyExpression?.let { PyPsiUtils.getFirstQualifier(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun processDataFrameColumns(dfName: String,
|
||||
columns: List<String>,
|
||||
needValidatorCheck: Boolean,
|
||||
elementOnPosition: PsiElement,
|
||||
project: Project,
|
||||
ignoreML: Boolean): List<LookupElement> {
|
||||
val validator = LanguageNamesValidation.INSTANCE.forLanguage(PythonLanguage.getInstance())
|
||||
return columns.mapNotNull { column ->
|
||||
when {
|
||||
!needValidatorCheck && elementOnPosition !is PyPlainStringElement -> {
|
||||
"'${StringUtil.escapeChar(column, '\'')}'"
|
||||
}
|
||||
!needValidatorCheck -> StringUtil.escapeChar(column, '\'')
|
||||
validator.isIdentifier(column, project) -> column
|
||||
else -> null
|
||||
}?.let {
|
||||
val lookupElement = LookupElementBuilder.create(it).withTypeText(
|
||||
PyBundle.message("pandas.completion.type.text", dfName)
|
||||
)
|
||||
when (ignoreML) {
|
||||
true -> PrioritizedLookupElement.withPriority(lookupElement, DATAFRAME_COLUMN_PRIORITY).asMLIgnorable()
|
||||
false -> PrioritizedLookupElement.withPriority(lookupElement, DATAFRAME_COLUMN_PRIORITY)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun LookupElement.asMLIgnorable(): LookupElement {
|
||||
return object : LookupElementDecorator<LookupElement>(this), MLRankingIgnorable {}
|
||||
}
|
||||
Reference in New Issue
Block a user