我最近在Visual Studio Code中发现可以使用以下样式同时创建新文件夹和新文件:Test / Test.jsx
例如
答案 0 :(得分:0)
我认为您无法按照显示的方式进行操作,但是通过任务完成操作非常容易。在您的task.json中:
{
"version": "2.0.0",
"tasks": [
{
"label": "new react folder and files",
"command": "mkdir ${input:dirName} && touch '${input:dirName}/${input:dirName}.component.jsx' '${input:dirName}/${input:dirName}.styles.jsx'",
"type": "shell",
"problemMatcher": [],
"presentation": {
"echo": false,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
}
],
// ........................................................................................
"inputs": [
{
"type": "promptString",
"id": "dirName",
"description": "Complete my folder name",
"default": "jsx folder to create"
}
]
}
以及一些用于触发任务的键绑定(在您的keybindings.json中):
[
{
"key": "alt+j",
"command": "workbench.action.tasks.runTask",
"args": "new react folder and files",
}
]
这将提示您输入目录名称,然后在其中创建文件夹和两个文件。
[[如果您使用的外壳没有这些命令,则我会使用bash命令mkdir
和touch
创建文件夹和文件。]