heavenshell / vim-pydocstring

Generate Python docstring to your Python source code.
BSD 3-Clause "New" or "Revised" License
337 stars 53 forks source link

update docstring? #16

Closed napseis closed 7 years ago

napseis commented 7 years ago

hi,

I was wondering if it was possible to update the docstring in case a function is modified ? Currently, if I write a function, add a docstring, and then add an argument, if I rerun :Pydocstring, they get imbricated.

Thanks !

heavenshell commented 7 years ago

@napseis Hi, sorry for late response.

Currently no, but your suggestion is very interesting. I think there are few points to consider.

Anyway, I'll consider about this.

napseis commented 7 years ago

No problem for late response of course. Thanks for considering !

heavenshell commented 7 years ago

Sorry for late respose.

I consider this but currently this is very complicated. If updating args are same is ok, but if add/remove arg(s) is hard to reflect to docstring. For example,

before:

def foo(arg1, arg2):
    pass

after

def foo(arg1):
    pass

arg2 is gone, so we need detect docstring and remove it. It's possible but too complicated. It's better to use regex command to replace user's operation. And I don't have resource to impliment this. I'm sorry.

heavenshell commented 7 years ago

BTW if you sent me PR, I'll check it 😊