Skip to content

Argument completion with decorated funcs provides hints for decorators, not original function #352

@vvzen

Description

@vvzen

Hi everyone!

I have a simple issue with pylsp, so I was wondering if you could provide context if this is a bug/feature or not. Basically, when I'm writing a function that is decorated, I get a typing suggestion for the decorator, not for the original function. That is not particularly useful when the decorator is mean to act transparently (which I feel is the most common use case for decorators).

For example, while typing some_func(, I see this:

Screen Shot 2023-02-27 at 11 15 16

while I would have liked to see that I should pass some_arg to some_func.

Here's simple MRE that reproduces the error:

import functools


@functools.lru_cache()
def some_func(some_arg: int) -> None:
    pass

some_func()

I'm on https://github.com/helix-editor/helix, but I know this happened also to a coworker which uses vim, which led me to think that it's caused by pylsp itself.

I'm on:

$ pylsp --version
pylsp v1.5.0
$ hx --version
helix 22.12 (96ff64a8)

This is my helix config for python, in case it helps:

[[language]]
name = "python"
indent = { tab-width = 4, unit = " " }

[language.config]
# Disable everything but flake8
pylsp.configurationSources = [ 'flake8' ]
pylsp.plugins.flake8.enabled = true
pylsp.plugins.pycodestyle.enabled = false
pylsp.plugins.pyflakes.enabled = false
pylsp.plugins.pylint.enabled = false
pylsp.plugins.mccabe.enabled = false

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions