gpt4 book ai didi

visual-studio-code - VSCode 未在文件夹打开时运行任务

转载 作者:行者123 更新时间:2023-12-01 16:28:09 26 4
gpt4 key购买 nike

我正在使用 TypeScript,并且经常需要手动启动 tsc-watch 任务。根据博客 VSCode v1.30+ 可以 automatically run tasks when a folder is opened 但这对我不起作用(v1.33.1) - 我打开我的文件夹并且没有运行任何任务。
enter image description here

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"isBackground": true,
"problemMatcher": [
"$tsc"
]
},
{
"type": "typescript",
"label": "TypeScript Compiler Watcher Thingy...",
"tsconfig": "tsconfig.json",
"option": "watch",
"problemMatcher": [
"$tsc-watch"
],
"runOptions": {
"runOn": "folderOpen"
}
}
]
}

顺便说一句:也试过 this extension 并且它也没有启动任务。

最佳答案

这项工作在 VSCode v. 1.42.1 my tasks.json

    {
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"label": "TypeScript Compiler Watching...",
"option": "watch",
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared"
},
"isBackground": true,
"runOptions": {"runOn": "folderOpen"},
"problemMatcher": [
"$tsc-watch"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

如果这仍然不适用于打开项目文件夹,请尝试 Ctrl+shift+P 和 Tasks: Manage Automatic Tasks in Folder,然后在主项目文件夹或运行文件夹中选择“允许文件夹中的自动任务”。

关于visual-studio-code - VSCode 未在文件夹打开时运行任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55923264/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com