Why Code Completion not working properly in DataSpell?


I have included three images highlighting the issue I've encountered with code completion in Dataspell. The issue seems to be that DataSpell does not recognise the type of ax1 (as can be seen from the image below). DataSpell seems to think that ax1 is an "Any" object. Jupyter running in the browser does not have this issue. 

The code completion seems to suffer from lots of similar failures to identify the type of the object and so only offers limited generic completion suggestions for the "Any" object.


Another user has kindly sent me an answer that suggests a workaround from 7 years ago that cured the problem for Pycharm. My hope is that the requirement for type hinting, in order to get code-completion behaviour available in other IDEs and Jupyter on the browser, has now disappeared.

I like lots of DataSpell's features, but the requirement to add type hints throughout the code, when other IDEs don't require this, would not be ideal. I'm hoping that I've simply missed an option that enables this common behaviour. Any help will be appreciated.   McDVOICE 




DataSpell, an IDE for Python, should ideally provide code completion based on inferred object types. However, there is an issue where DataSpell fails to recognize the type of the ax1 object, resulting in limited generic completion suggestions. To address this, ensure that your DataSpell installation is up to date and include type hints in your code wherever possible. Type hints provide explicit information about variable types and enhance code completion accuracy. If the problem persists, explicitly specify the type of the ax1 object by declaring it with a specific type, such as ax1: matplotlib.axes.Axes.

If the issue still persists, it is recommended to contact the DataSpell support team or consult the documentation for assistance. They can provide guidance and investigate if there is a bug or configuration problem causing the code completion issue. It's important to note that a workaround mentioned for PyCharm may not directly apply to DataSpell, as different IDEs can have distinct code completion implementations and behaviors.

Although code completion capabilities vary across IDEs, type hints are generally valuable in Python development. They improve code completion, enhance code readability and maintainability, and enable static analysis tools to catch potential issues. By following these steps and seeking appropriate support, you can hopefully resolve the code completion issue in DataSpell.



I've encountered an issue with code completion in DataSpell, as shown in the provided images. DataSpell fails to recognize the type of `ax1`, unlike Jupyter in the browser. This leads to limited suggestions for the "Any" object. I'm hoping this requirement for type hinting, unlike other IDEs, can be resolved. Appreciate any assistance.

Go now.


Please try using python
def add_numbers(a: int, b: int) -> int:
    return a + b



I will see again pizza tower



It appears that you are experiencing issues with the code completion feature in DataSpell not recognizing the correct type of certain objects, specifically ax1 in your case, and defaulting to the "Any" type. This can indeed limit the usefulness of the code completion feature.

From the information provided, a few possible solutions and troubleshooting steps can be considered:

Check DataSpell Settings: Ensure that you have the appropriate settings enabled for intelligent code completion. You can find these settings in DataSpell under "File" > "Settings" (or "Preferences" on macOS) > "Editor" > "General" > "Code Completion". Make sure that the settings are configured to provide the most comprehensive code suggestions.

Type Inference: DataSpell, like PyCharm and other JetBrains IDEs, relies on type inference to provide code completion suggestions. If the IDE cannot infer the type, it may require type hints to provide accurate suggestions. However, if Jupyter in the browser is correctly inferring the type without hints, there might be a discrepancy in how DataSpell is handling type inference.

Update DataSpell: If you are not running the latest version of DataSpell, consider updating to the latest version. JetBrains continuously improves their products, and newer versions may have enhanced type inference capabilities or fixes related to code completion.

Type Hinting: As a workaround, you can add type hints to your code. While you mentioned that this is not ideal, it can be a temporary solution until the issue is resolved by JetBrains. Adding type hints can improve the IDE's ability to provide accurate code completion suggestions.

JetBrains Support: If the issue persists, consider reaching out to JetBrains support or checking the DataSpell Documentation for more information on code completion settings. You can also search for or report the issue on the JetBrains Issue Tracker to see if it is a known problem or if a fix is in progress.

Community Forums: Engage with the community on forums or platforms like Stack Overflow. As you mentioned, another user provided a workaround that worked for a similar issue in PyCharm. There may be users who have encountered the same issue in DataSpell and have found a solution. Mcdvoice