heavenshell / vim-pydocstring

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

Generate DocString For All Classes/Functions #146

Closed DuckyShine004 closed 10 months ago

DuckyShine004 commented 10 months ago

Description

I'm currently looking for a more efficient method to configure the docstring plugin in NeoVim. My goal is to automate the generation of docstrings for all classes and functions within any opened Python file.

Currently, my process involves manually executing the docstring command for each class and function, which is quite tedious.

Previously, I used a shell script with docformatter to handle all modules within a project's root directory, but it was time-consuming, especially when adding new Python scripts. I'm looking for a solution that streamlines this process, ideally integrating it directly into my NeoVim workflow.

heavenshell commented 10 months ago

@DuckyShine004 Thank you for comment.

:PydocstringFormat adds a docstring to the function or class in a single file.

I'm looking for a solution that streamlines this process, ideally integrating it directly into my NeoVim workflow.

I don't think it is the editor's responsibility to find all the files in the project and give them docstrings, what kind of workflow do you want?

If I wanted to the same workflow as you, I would let the script to use https://github.com/heavenshell/py-doq.

Maybe I'll do like followings

  1. Run doq with --recursive option first time
  2. Then I put doq to pre-commit or CI
DuckyShine004 commented 10 months ago

Hello!

:PydocstringFormat adds a docstring to the function or class in a single file.

Yes, thank you! This was command that I was exactly looking for! With this, I can now create my own shell script that generates docstrings for all Python files within a directory. Thanks!

heavenshell commented 10 months ago

Great to hear that!