bandian
V2EX  ›  问与答

VSCode 如何自定义 Debug 命令

  •  
  •   bandian · Oct 29, 2022 · 1194 views
    This topic created in 1315 days ago, the information mentioned may be changed or developed.
    比如我现在想在 VSCode 中按 F5 直接执行 hugo server -D 来预览写好的文章,而不是在终端中手动输入这行命令,请问该如何配置呢
    jifengg
        1
    jifengg  
       Oct 31, 2022
    在 launch.json 中添加:


    {
    "command": "hugo server -D && exit",
    "name": "Run npm start",
    "request": "launch",
    "type": "node-terminal"
    },


    使用 node-terminal 来执行自定义命令,加上 && exit 是因为默认没有退出 terminal ,你如果想运行完看信息的话就不要加这句。
    type 里可用的值可以通过扩展来添加,node-terminal 应该是默认包含的,我的环境已经装好了所以不好验证。
    bandian
        2
    bandian  
    OP
       Oct 31, 2022
    @jifengg 哇,真的可以了欸,感谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2817 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 13:34 · PVG 21:34 · LAX 06:34 · JFK 09:34
    ♥ Do have faith in what you're doing.