-
Notifications
You must be signed in to change notification settings - Fork 769
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Enable copy-pasting working example code from numpy style docstrings #6699
Comments
It seems vscode-jedi-language-server.mp4 |
Jedi is removing the This block here: |
An alternative would be to use code blocks. Then the >>> isn't necessary to get the code to format like code: def foo_with_doctest():
"""
Some example code:
>>> print(1)
>>> print(2)
""" Gives you this: While this docstring gives you this: def foo_with_codeblock():
"""
Some example code:
.. code-block:: python
print(1)
print(2)
""" |
Thx. We are using |
Selecting code in a code block on Python's website (built with Sphinx) doesn't include the prompts. There's also an option to hide the prompts and outputs. The sphinx-copybutton extension has a lot of knobs one can tweak, for instance, to exclude prompts for copies, which imho is what most people want (you can actually copy/paste code with these prompts in an IPython shell but that looks more like a workaround :) ). See more info on their site https://sphinx-copybutton.readthedocs.io/en/latest/use.html. The good news is that there are many ways VSCode would enhance the UX of these docstrings code blocks :) ! |
If we want to still return the The other alternative would be to eliminate the Transferring to a discussion item for up votes. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I would like to be able to copy paste working example code from numpy style docstrings. Currently I have to remove
>>>
and...
my self.vs-code.mp4
For context I'm currently contributing improved docstrings to HoloViz Param and we are discussing how we can best include useful example code in the docstrings. Join the discussion holoviz/param#977 (comment).
The problem is would like our example code to be useful in VS Code with Pylance, VS Code with jedi-language-server, PyCharm, Sphinx docs, Jupyter Notebook and many more places.
The text was updated successfully, but these errors were encountered: