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?

Anil
  • 1,097
  • 7
  • 20
  • 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 Nov 21 '22 at 19:10

1 Answers1

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.

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13