chore: Update vscode-example scripts (#1613)

* chore: Add tasks.json file

* refactor: Remove deprecated pythonPath; redundant with settings.json anyway.

* fix: Use expected type for python debug

* feat: Run post clean task in seamless way

* feat: Add compunds config for easier setup

* style: Trigger pre-commit lint

* fix: honcho python environment in vscode launch.json

* fix: pre-commit prettier check

---------

Co-authored-by: Revant Nandgaonkar <revant.one@gmail.com>
This commit is contained in:
Reuel Ramos Ribeiro
2025-04-12 02:36:57 -03:00
committed by GitHub
parent bd8912c90d
commit b5cfe3f735
2 changed files with 36 additions and 17 deletions

View File

@@ -6,7 +6,7 @@
"configurations": [ "configurations": [
{ {
"name": "Bench Web", "name": "Bench Web",
"type": "python", "type": "debugpy",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
"args": [ "args": [
@@ -17,7 +17,6 @@
"--noreload", "--noreload",
"--nothreading" "--nothreading"
], ],
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
"cwd": "${workspaceFolder}/frappe-bench/sites", "cwd": "${workspaceFolder}/frappe-bench/sites",
"env": { "env": {
"DEV_SERVER": "1" "DEV_SERVER": "1"
@@ -25,11 +24,10 @@
}, },
{ {
"name": "Bench Short Worker", "name": "Bench Short Worker",
"type": "python", "type": "debugpy",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
"args": ["frappe", "worker", "--queue", "short"], "args": ["frappe", "worker", "--queue", "short"],
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
"cwd": "${workspaceFolder}/frappe-bench/sites", "cwd": "${workspaceFolder}/frappe-bench/sites",
"env": { "env": {
"DEV_SERVER": "1" "DEV_SERVER": "1"
@@ -37,11 +35,10 @@
}, },
{ {
"name": "Bench Long Worker", "name": "Bench Long Worker",
"type": "python", "type": "debugpy",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py",
"args": ["frappe", "worker", "--queue", "long"], "args": ["frappe", "worker", "--queue", "long"],
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
"cwd": "${workspaceFolder}/frappe-bench/sites", "cwd": "${workspaceFolder}/frappe-bench/sites",
"env": { "env": {
"DEV_SERVER": "1" "DEV_SERVER": "1"
@@ -49,21 +46,21 @@
}, },
{ {
"name": "Honcho SocketIO Watch Schedule Worker", "name": "Honcho SocketIO Watch Schedule Worker",
"type": "python", "type": "debugpy",
"request": "launch", "request": "launch",
"python": "/home/frappe/.pyenv/shims/python",
"program": "/home/frappe/.local/bin/honcho", "program": "/home/frappe/.local/bin/honcho",
"pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python",
"cwd": "${workspaceFolder}/frappe-bench", "cwd": "${workspaceFolder}/frappe-bench",
"console": "internalConsole", "console": "internalConsole",
"args": [ "args": ["start", "socketio", "watch", "schedule", "worker"],
"start", "postDebugTask": "Clean Honcho SocketIO Watch Schedule Worker"
"socketio", }
"watch", ],
"schedule", "compounds": [
"worker_short", {
"worker_long", "name": "Honcho + Web debug",
"worker_default" "configurations": ["Bench Web", "Honcho SocketIO Watch Schedule Worker"],
] "stopAll": true
} }
] ]
} }

View File

@@ -0,0 +1,22 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Clean Honcho SocketIO Watch Schedule Worker",
"detail": "When stopping the debug process from vscode window, the honcho won't receive the SIGINT signal. This task will send the SIGINT signal to the honcho processes.",
"type": "shell",
"command": "pkill -SIGINT -f bench; pkill -SIGINT -f socketio",
"isBackground": false,
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"close": true
}
}
]
}