Command to toggle docstring in VSCode

时光毁灭记忆、已成空白 提交于 2021-01-26 03:14:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!