'Can't generate Python docstring with autoDocstring extension in VS Code when multiline string in the function body

To generate documentation with Python Sphinx I have to use a specific docstring format.

VS Code extension autoDocstring is capable to generate this specific format, but if the function contains multiline string then it doesn't work.

Example in this case works:

def func(param1, param2, param3):
    # docstring nicely generated
    """_summary_

    :param param1: _description_
    :type param1: _type_
    :param param2: _description_
    :type param2: _type_
    :param param3: _description_
    :type param3: _type_
    :return: _description_
    :rtype: _type_
    """

    random_variable = 42
    string_variable = "not a multiline string"

    return string_variable

But in this case can't generate auto docstring:

def func(param1, param2, param3):
    # doesn't work
    """"""

    random_variable = 42
    string_variable = """
             a 
             multiline
             string
     """

    return string_variable

Anyone know a trick, or something to make it work? I use a lot of multiline SQL strings in my functions and if I have to extract these strings just to make it work I need a lot of refactoring.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source