yasnippet-snippets
yasnippet-snippets copied to clipboard
Py docstring type annotation
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.)
Thanks, I'll test it soon but otherwise looks good to me