Monday, 15 February 2021

VSCode auto complete string params for python

I've been looking around to see if I can create the same behaviour for Python in VSCode to show string param inputs as you can do with jsdoc in JavaScript.

JavaScript example with JSDoc:

/**
* @method someMethod
* @description A special method.
* @param { "option1" | "option2" } param1 Choose an option.
*/
function someMethod(param1) {
    console.log(param1);
}

So when calling the method, VSCode will give auto completion options for param1.

enter image description here

So I'm looking for a Python equivalent, preferably using google docstring format:

def some_method(param1: str) -> None:
    """A special method.

    Args:
        param1 (str): Choose an option. # HOW CAN WE ADD INTELLISENSE OPTIONS HERE??
    
    """
    print(param1)


from VSCode auto complete string params for python

No comments:

Post a Comment