From a227a1aa0c7b3224fac7dba95791b6b2f5abe1b5 Mon Sep 17 00:00:00 2001 From: Lingjie Date: Mon, 12 Feb 2024 12:35:40 +0800 Subject: [PATCH] feat: add snippet for debugpy remote attach (#397) useful on remote debugging, especially on slurm --- snippets/python/debug.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/snippets/python/debug.json b/snippets/python/debug.json index e5754b07..c9f593f1 100644 --- a/snippets/python/debug.json +++ b/snippets/python/debug.json @@ -30,5 +30,15 @@ "Pretty print": { "prefix": "pprint", "body": "__import__('pprint').pprint(${1:expression})$0" + }, + "debugpy remote attach": { + "prefix": "debugpy", + "body": [ + "import debugpy, platform", + "debugpy.listen((platform.node(), ${1:5678}))", + "print(f\"debugpy listening on {platform.node()}:$1\", flush=True)", + "debugpy.wait_for_client()$0" + ], + "description": "Code snippet for debugpy remote attach" } }