Skip to content

Commit 6f184d7

Browse files
committed
type hints done
1 parent 9956586 commit 6f184d7

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# vim-python-docstring
2-
This is a plugin to Vim for creating of docstrings.
2+
This is a plugin to Vim and NeoVim for creating of docstrings.
33

4-
Works also with neovim.
4+
**New**: Support for type hints and async functions.
55

66
## What it does
7-
Docstrings for methods will contain a **list of arguments**, **list of raised exceptions** and whether the method **yields** or **raises**.
7+
Docstrings for methods will contain a **list of parameters and their type hints**, **list of raised exceptions** and whether the method **yields** or **raises**.
88

99
Class docstring will have a **list of atributes**.
1010

@@ -39,6 +39,7 @@ The plugin uses these commands:
3939
| Command | Description |
4040
|---------------|-------------|
4141
| Docstring | Create full docstring
42+
| DocstringTypes| Just like `:Docstring` but includes type hints
4243
| DocstringLine | Create empty one-line docstring
4344

4445
## Options:
@@ -64,7 +65,7 @@ Possible values = [`'google'`, `'numpy'`, `'rest'`, `'epytext'`]
6465
let g:python_style = 'google'
6566
~~~
6667

67-
## Work in progress
68+
## Development
6869
Pull requests are welcome as are feature request and issue reports.
6970

7071
You can encounter some situations in which the plugin may not work as expected.

styles/epytext-method.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
{% if args|len > 0 %}{% for a in args %}@param {{a.arg}}:
3-
{% endfor %}{% endif %}{% if returns %}@return:
3+
{% endfor %}{% if hints %}{% for a in args %}{% if a.type %}@type {{a.arg}}: {{a.type}}
4+
{% endif %}{% endfor %}{% endif %}{% endif %}{% if returns %}@return:
45
{% endif %}{% if yields %}@yield:
56
{% endif %}{% if raises|len > 0 %}{% for a in raises %}@raise {{a}}:
67
{% endfor %}{% endif %}"""

styles/numpy-method.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% if args|len > 0 %}
33
Parameters
44
----------
5-
{% for a in args %}{{indent}}{{a.arg}} :
5+
{% for a in args %}{{indent}}{{a.arg}} :{% if hints and a.type %} {{a.type}}{% endif %}
66
{% endfor %}{% endif %}{% if returns %}
77
Returns
88
-------

styles/rest-method.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
{% if args|len > 0 %}{% for a in args %}:param {{a.arg}}:
3-
{% endfor %}{% endif %}{% if returns %}:returns:
3+
{% endfor %}{% if hints %}{% for a in args %}{% if a.type %}:type {{a.arg}}: {{a.type}}
4+
{% endif %}{% endfor %}{% endif %}{% endif %}{% if returns %}:returns:
45
{% endif %}{% if yields %}:yields:
56
{% endif %}{% if raises|len > 0 %}{% for a in raises %}:raises {{a}}:
67
{% endfor %}{% endif %}"""

0 commit comments

Comments
 (0)