yasnippet-snippets icon indicating copy to clipboard operation
yasnippet-snippets copied to clipboard

Py docstring type annotation

Open WJCFerguson opened this issue 6 years ago • 1 comments
trafficstars

A few tweaks to the Python snippet fn for handling of args to generating docstrings, e.g. the function_docstring (key fd) snippet.

Before this it was upset by newlines in arg lists, e.g.

def foo(
        arg1,
        arg2,
):

And in addition, it didn't know what to do with type annotations, e.g:

def foo(
        arg1: int,
        arg2: str = 'default string',
):

It now excludes the type annotation from the docstring.

(I could see an argument for removing the default handling - my personal preference is to avoid duplicating the information - I'd be happy to modify the PR to do that, but who knows which users use and like this.)

WJCFerguson avatar Sep 20 '19 19:09 WJCFerguson

Thanks, I'll test it soon but otherwise looks good to me

AndreaCrotti avatar Sep 24 '19 20:09 AndreaCrotti