param icon indicating copy to clipboard operation
param copied to clipboard

Code completion when a parameterized class implements an __init__ method

Open Davide-sd opened this issue 5 months ago • 2 comments

Is your feature request related to a problem? Please describe.

I'm opening this issue/future request as suggested in this post.

I am implementing a class which requires the __init__ method to accept some arguments. The only issue is that by implementing it, I lose the code completion capability (at least in Jupyter Notebook, where I do have code completion turned on). Here is an example:

import param
class Test(param.Parameterized):
    first_param = param.Integer(default=2, doc="first")
    second_param = param.Dict(default={}, doc="second")
    third_param = param.Selector(default="a", objects=["a", "b", "c"], doc="third")

    def __init__(self, *args, **kwargs):
        super().__init__(**kwargs)

If you type Test(first_ in a new cell, no completion is shown. If you comment out the __init__ method, code completion works fine.

Describe the solution you'd like

Regardless of the arguments written in the __init__ method, I would like to be able to use code completion on parameters that are created with param.

Describe alternatives you've considered

None, because I am attempting to refactor an existing module and I would like to maintain back-compatibility for as much as possible.

Davide-sd avatar Jul 29 '25 21:07 Davide-sd

This issue has been mentioned on HoloViz Discourse. There might be relevant details there:

https://discourse.holoviz.org/t/code-completion-with-param-when-a-class-implements-the-init-method/8877/3

holovizbot avatar Jul 29 '25 21:07 holovizbot

See #376

Coderambling avatar Aug 12 '25 15:08 Coderambling