Python parameter info fails for imported methods annotated -> None

SyntaxEditor Python Language Add-on for WPF Forum

Posted 3 days ago by Shaun Gannon
Version: 25.1.4
Platform: .NET 10
Environment: Windows 11 (64-bit)
Avatar
# Actipro Python parameter info fails for imported methods annotated `-> None`

## Summary

Actipro Python IntelliPrompt does not show parameter information after `(` for
an imported method whose return annotation is the literal `None`.

The same imported class and method shape works when the return annotation is a
normal type such as `str`. A locally declared function annotated `-> None` also
works. Member completion and completion-item documentation work in every case.

The annotation is valid and conventional Python typing. It should not affect
parameter information. Omitting it is a confirmed temporary workaround, not a
correction to the API's type information.

## Environment

- Actipro version: 25.1.4

## Minimal repro setup

Create these files under the virtual environment's `site-packages` directory.

### `actipro_none_return_repro\__init__.py`

```python
"""Minimal package for reproducing Python parameter-info behavior."""


class Widget:
    """A type intentionally defined in a package __init__.py file."""

    def returns_value(self, name: str) -> str:
        """Return the supplied name."""
        return name

    def returns_none(self, name: str) -> None:
        """Accept a name without returning a value."""
        _ = name
```

### `actipro_none_return_repro\widget.py`

```python
"""The same repro type, defined in a normal module rather than __init__.py."""


class ModuleWidget:
    """A type intentionally defined in widget.py."""

    def returns_value(self, name: str) -> str:
        """Return the supplied name."""
        return name

    def returns_none(self, name: str) -> None:
        """Accept a name without returning a value."""
        _ = name
```

### `actipro_none_return_repro_script.py`

```python
from actipro_none_return_repro import Widget
from actipro_none_return_repro.widget import ModuleWidget


def local_returns_none(name: str) -> None:
    """Local positive control for a function returning None."""
    _ = name


widget = Widget()
module_widget = ModuleWidget()

widget.returns_value
widget.returns_none
module_widget.returns_value
module_widget.returns_none
local_returns_none
```

## Reproduction steps

1. On each final expression, place the caret immediately after the method name
   and type `(` manually. Do not execute the script.
2. Observe whether Actipro displays its parameter-information popup.

## Results

| Expression after typing `(` | Definition location | Return annotation | Parameter info |
| --- | --- | --- | --- |
| `widget.returns_value(` | imported package `__init__.py` | `str` | Shown |
| `widget.returns_none(` | imported package `__init__.py` | `None` | Not shown |
| `module_widget.returns_value(` | imported `widget.py` | `str` | Shown |
| `module_widget.returns_none(` | imported `widget.py` | `None` | Not shown |
| `local_returns_none(` | active editor document | `None` | Shown |

For the failing calls, member completion still lists the method and shows its
signature/documentation before `(` is typed. The failure is limited to the
parameter-information popup after typing `(`.

## Confirmed workaround

Removing the literal `-> None` annotation from the imported method causes
Actipro to show parameter information normally. For example:

```python
# Parameter information is not shown.
def returns_none(self, name: str) -> None:
    _ = name

# Parameter information is shown.
def returns_none(self, name: str):
    _ = name
```

This confirms that the annotation is the trigger. It does not change Python
runtime behavior, but it removes useful static type information. `-> None`
should remain supported because it is the standard way to state that a
function intentionally returns no value.

## Expected behavior

Actipro should show parameter information for both imported methods, including:

```text
returns_none(name: str)
```

The return type of a callable should not determine whether its parameter
information can be displayed.

In particular, an imported method annotated `-> None` should behave the same
as a local method with that annotation and as an imported method with another
return annotation.

## Actual behavior

For an imported method annotated `-> None`, typing `(` inserts the editor's
matching `)` but no parameter-information popup appears. The same method shape
with `-> str`, and a local function with `-> None`, display parameter
information normally.

Comments (1)

The latest build of this product (v26.1.1) was released 3 days ago, which was before the next post in this thread.
Answer - Posted 2 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Thank you for reporting this.  We have found the problem and resolved it for the next build.  Unfortunately, we just released v26.1.1 yesterday, so the fix for this will be in v26.1.2.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.