vscode skill
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
# Configure Project Tasks in tasks.json
|
||||
|
||||
Use `.vscode/tasks.json` to define repeatable project commands and optional hooks for debugging.
|
||||
|
||||
## Minimal File
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": []
|
||||
}
|
||||
```
|
||||
|
||||
## Task Fields You Will Use Most
|
||||
|
||||
- `label`: Task name shown in VS Code.
|
||||
- `type`: Usually `shell`.
|
||||
- `command`: Executable to run.
|
||||
- `args`: Command arguments.
|
||||
- `options.cwd`: Working directory.
|
||||
- `group`: Mark default build or test tasks.
|
||||
- `problemMatcher`: Parse errors into the Problems panel.
|
||||
- `isBackground`: `true` for long-running tasks (for example dev server watch).
|
||||
|
||||
## Python Project Example
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "App: Run",
|
||||
"type": "shell",
|
||||
"command": "uv",
|
||||
"args": ["run", "uvicorn", "personal_mcp.main:app", "--host", "127.0.0.1", "--port", "8000", "--reload"],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"isBackground": true,
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"label": "Tests: Pytest",
|
||||
"type": "shell",
|
||||
"command": "uv",
|
||||
"args": ["run", "pytest"],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"group": "test",
|
||||
"problemMatcher": []
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Connect Tasks to Debug Profiles
|
||||
|
||||
In `launch.json`, you can run a task first:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "FastAPI: Attach",
|
||||
"type": "debugpy",
|
||||
"request": "attach",
|
||||
"connect": {
|
||||
"host": "127.0.0.1",
|
||||
"port": 5678
|
||||
},
|
||||
"preLaunchTask": "App: Run"
|
||||
}
|
||||
```
|
||||
|
||||
Use this only when startup sequencing is needed.
|
||||
|
||||
## Task Design Guidelines
|
||||
|
||||
1. Keep labels stable and descriptive.
|
||||
2. Prefer one task per intent instead of monolithic shell commands.
|
||||
3. Keep shell portability in mind if teammates use multiple OSes.
|
||||
4. Avoid embedding secrets directly in task definitions.
|
||||
5. Mark long-running tasks with `isBackground` and keep matchers explicit.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If a task fails unexpectedly:
|
||||
|
||||
1. Run the underlying command directly in terminal.
|
||||
2. Confirm `options.cwd` points to expected workspace root.
|
||||
3. Confirm tool availability in environment path.
|
||||
4. Confirm quoting and argument boundaries in `args`.
|
||||
5. Confirm the task is not blocked by an outdated background process.
|
||||
Reference in New Issue
Block a user