How to use Snippets in vscode to define python function input parameter comments (parameter name and type)?

Viewed 485

For example, when I type """ under the signature of a python function, it triggers the automatic parsing of the function parameter comments, which contain information about the definition, type, default value, etc. of the input and output parameters of the function. I don't want to use a third-party plugin to do this, I want to use vscode's own snippets to do it.

def myfun(a,b,c=1,d="defaultvalue"):
"""


Parameters
----------
a : TYPE
    DESCRIPTION.
b : TYPE
    DESCRIPTION.
c : TYPE, optional
    DESCRIPTION. The default is 1.
d : TYPE, optional
    DESCRIPTION. The default is "defaultvalue".

Returns
-------
str
    DESCRIPTION.

"""
return "test"

enter image description here

0 Answers
Related