问题
What command do I have to use in VSCode to toggle the docstring?
I have searched in settings for docstring, help but nothing that makes sense shows up.
回答1:
You can hit Ctrl + K Ctrl + I. This will execute the editor.action.showHover
command and will display the same text that is displayed when you hover over for example a function. Unfortunately there seems to be no corresponding editor.action.hideHover
command (I searched the keybindings.json
). But it should be possible to hide the text again by pressing the Esc key.
回答2:
I guess you want parameter suggestions for a method or function. Shortcut for mac is: cmd + Shift + Space.
See other question: Is there a "quick documentation" shortcut for VS code?
For all shortcuts press: cmd + k, cmd + r.
回答3:
You can either install an extension/snippet to provide it (Python only right now) https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring
Or you can create a user-defined snippet and assign it to a hotkey.
来源:https://stackoverflow.com/questions/49535763/command-to-toggle-docstring-in-vscode