microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.71k stars 765 forks source link

Support docstring templates / generate docstrings #5279

Closed assafmendelson closed 10 months ago

assafmendelson commented 9 years ago

Provide auto fill of docstring. The idea would be that if I type """ right at a docstring position (file, class method), it would generate a proper template for it. A simple example would be to start typing """ right after def f(a): and it would immediatly expand it to:

def f(a): """ :param a :return """

zooba commented 9 years ago

Yeah, I like it. This is especially handy if microsoft/PTVS#758 is done too.

RussBaz commented 9 years ago

I'm sceptical of this feature if it is always on.

I do not generally like IDE writing a piece of code on its own when I am not asking it to do so explicitly (even if it is just a docstring).

Do you think it will be better, perhaps, if it could be triggered by a tab button or if it could have a switch in settings to prevent it from running automatically when so desired?

den-run-ai commented 9 years ago

can this be considered under code snippets?

int19h commented 9 years ago

I don't think VS code snippets are sufficiently context-aware to pull off something like this.

What this reminds me of actually is GhostDoc: https://www.youtube.com/watch?t=21&v=xeZqoCGcHSU

den-run-ai commented 9 years ago

for now sublime can do this, works perfectly! :)

https://packagecontrol.io/packages/AutoDocstring

alexranaldi commented 9 years ago

I like the idea, but we should have the ability to disable it too.

sonictk commented 9 years ago

Upvote +1, I would definitely love this in PTVS.

lmazuel commented 7 years ago

Upvote :)

gramster commented 4 years ago

I'm going to move this issue to vscode-python; it has more chance of getting traction there first.

luabud commented 4 years ago

Just FYI for those who are interested, there's a 3rd party extension that provides that: https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring