Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] update docstring #11

Closed
Freed-Wu opened this issue Oct 4, 2021 · 4 comments
Closed

[feature] update docstring #11

Freed-Wu opened this issue Oct 4, 2021 · 4 comments

Comments

@Freed-Wu
Copy link

Freed-Wu commented Oct 4, 2021

test.py

def f(x: int) -> int:
    """f.

    :param x:
    :type x: int
    :rtype: int
    """
    return x

change test.py to

def f(x: float) -> float:
    """f.

    :param x:
    :type x: int
    :rtype: int
    """
    return x

Now use codeaction pydocstring

def f(x: float) -> float:
    """f.

    :param x:
    :type x: float
    :rtype: float
    """
    """f.

    :param x:
    :type x: int
    :rtype: int
    """
    return x

Expected behaviour:

def f(x: float) -> float:
    """f.

    :param x:
    :type x: float
    :rtype: float
    """
    return x

Thanks!

@yaegassy
Copy link
Owner

yaegassy commented Oct 4, 2021

Thanks for the feature request.

Unfortunately, the doq command used in coc-pydocstring does not return results that can be overridden.

(venv) pydocstring-check$ bat test.py
───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: test.py
───────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ def f(x: float) -> float:
   2   │     """f.
   3   │
   4   │     :param x:
   5   │     :type x: int
   6   │     :rtype: int
   7   │     """
   8   │     return x
───────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
(venv) pydocstring-check$ cat test.py | doq --start 1 --end 2
def f(x: float) -> float:
    """f.

    :param x:
    :type x: float
    :rtype: float
    """
    """f.

Also, adding your own overwriting process might be a source of bugs. :(

@Freed-Wu
Copy link
Author

Freed-Wu commented Oct 4, 2021

I see, the feature should be implemented in the upstream (py-doq).

Thanks!

@yaegassy
Copy link
Owner

yaegassy commented Oct 4, 2021

@Freed-Wu To be honest, I don't like that feature addition. :(

I'm not keen on adding this feature because I think it's just a matter of manually deleting the content.

Also, if you are submitting a feature request issue to py-doq, you should include more details than just a link to this issue.

@yaegassy
Copy link
Owner

yaegassy commented Oct 4, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants