VSC Command Log

假如想象 提交于 2019-12-13 13:23:10

问题


Trying to figure out how to create a key binding for a specific command. I can see the command in the pallete but it has no bindings so I can't see it in the keybindings.json.

Is there any way I can LOG all commands being executed within VSC so that I can perform the command and see the command name in the log?

Edit:

To make it clear:

  • I want general method to know how I can find what commands were issued along with their command IDs.
  • I already know I find some commands in the default keybindings file and that's NOT a general way to find the command you have run. It doesn't list all command not does it explain what they each are and you can't use it to verify that it is the command you executed.

回答1:


You can create binding using Keyboard Shortcuts as well (Preferences: Open Keyboard Shortcuts command). You can search by command name and and even check its corresponding id:

Second option is that you can enable tracing and see executed commands in output panel (it looks like it doesn't log commands executed from command palette though):

  1. Set log level to trace. You can either pass --log argument when starting VS Code like: code --log trace (doesn't work for me for some reason) or execute Developer: Set Log Level... from command palette:

  2. After that, you should see executed commands in output panel for Window process.




回答2:


The "Toggle Line Comment" command's id is editor.action.commentLine.

You can find all the command ids by using the search feature in the Keyboard Shortcuts Editor (on macOS you can open it via Application Menu > Preferences > Keyboard Shortcuts or using the shortcut Cmd+K Cmd+S).

In the keybindings.json you can trigger the autocomplete help (i.e. Ctrl+Space) and search all available commands.



来源:https://stackoverflow.com/questions/44453308/vsc-command-log

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