5

There are some classes written with the docstring at the class level, as opposed to under methods like the init method, for example PyTorch's CrossEntropy loss class.

How can I show the class docstring in VSCode with a shortcut, similar to this question?

1
  • 1
    If you have "editor.hover.enabled": true in your settings.json file, you should see the class docstring when hovering over an instance of that class with your mouse, but I'm not sure of a keyboard shortcut for this offhand. That said, methods that are members of that class will show their own docstrings on hover, not their parent class's.
    – JRiggles
    Commented Nov 21, 2022 at 19:10

1 Answer 1

0

enter image description here

  1. Set these three key-bindings in the picture.
  2. Click or move the cursor to what you want to display the content
  3. Use the shortcuts to get.

You can also use the methods in the comments, hover over an instance of that class with your mouse.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.