如何在“Command Palette”中设置tasks.json文件中的命令?

时间:2017-12-04 22:55:43

标签: visual-studio-code

示例命令: editor.action.goToDeclaration

像这样:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "gotoD",
            "type": "vscode",
            "command": "editor.action.goToDeclaration"
        }
    ]
}

1 个答案:

答案 0 :(得分:0)

您可以在task.json中添加命令

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "My Command",
            "type": "shell",
            "args": [],
            "command": "${command:my-command}",
            "presentation": {
                "reveal": "never",
                "panel": "shared",
            }
        }
    ]
}

https://code.visualstudio.com/docs/editor/variables-reference#_settings-command-variables-and-input-variables