From b5cfe3f735a3d19b27a2c13e04ebb73eb88314e9 Mon Sep 17 00:00:00 2001 From: Reuel Ramos Ribeiro Date: Sat, 12 Apr 2025 02:36:57 -0300 Subject: [PATCH] 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 --- development/vscode-example/launch.json | 31 ++++++++++++-------------- development/vscode-example/tasks.json | 22 ++++++++++++++++++ 2 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 development/vscode-example/tasks.json diff --git a/development/vscode-example/launch.json b/development/vscode-example/launch.json index e3100c7a..46c886a4 100644 --- a/development/vscode-example/launch.json +++ b/development/vscode-example/launch.json @@ -6,7 +6,7 @@ "configurations": [ { "name": "Bench Web", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", "args": [ @@ -17,7 +17,6 @@ "--noreload", "--nothreading" ], - "pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python", "cwd": "${workspaceFolder}/frappe-bench/sites", "env": { "DEV_SERVER": "1" @@ -25,11 +24,10 @@ }, { "name": "Bench Short Worker", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", "args": ["frappe", "worker", "--queue", "short"], - "pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python", "cwd": "${workspaceFolder}/frappe-bench/sites", "env": { "DEV_SERVER": "1" @@ -37,11 +35,10 @@ }, { "name": "Bench Long Worker", - "type": "python", + "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", "args": ["frappe", "worker", "--queue", "long"], - "pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python", "cwd": "${workspaceFolder}/frappe-bench/sites", "env": { "DEV_SERVER": "1" @@ -49,21 +46,21 @@ }, { "name": "Honcho SocketIO Watch Schedule Worker", - "type": "python", + "type": "debugpy", "request": "launch", + "python": "/home/frappe/.pyenv/shims/python", "program": "/home/frappe/.local/bin/honcho", - "pythonPath": "${workspaceFolder}/frappe-bench/env/bin/python", "cwd": "${workspaceFolder}/frappe-bench", "console": "internalConsole", - "args": [ - "start", - "socketio", - "watch", - "schedule", - "worker_short", - "worker_long", - "worker_default" - ] + "args": ["start", "socketio", "watch", "schedule", "worker"], + "postDebugTask": "Clean Honcho SocketIO Watch Schedule Worker" + } + ], + "compounds": [ + { + "name": "Honcho + Web debug", + "configurations": ["Bench Web", "Honcho SocketIO Watch Schedule Worker"], + "stopAll": true } ] } diff --git a/development/vscode-example/tasks.json b/development/vscode-example/tasks.json new file mode 100644 index 00000000..7c0e6739 --- /dev/null +++ b/development/vscode-example/tasks.json @@ -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 + } + } + ] +}