Skip to content

Improve launch.json #193

@rmadsen-ks

Description

@rmadsen-ks

It seems to be possible to debug both C# and Python code at the same time and allow the debuggers to attach automatically, using this launch json:

launch.json:

{
  "version": "0.2.0",
  "configurations": [
    
    {
      "name": "Start Editor",
      "type": "coreclr",
      "request": "launch",
      "program": "${workspaceFolder}/bin/Editor.dll",
      "console": "internalConsole",
      "presentation": {
        "hidden": true,
        "group": "",
        "order": 1
      },
    },

    {
      "name": "Python Debugger: Remote Attach",
      "type": "debugpy",
      "request": "attach",
      
      "connect": {
        "host": "localhost",
        "port": 5678
      },
      "pathMappings": [
        {
          "localRoot": "${workspaceFolder}/..",
          "remoteRoot": "."
        }
        
      ],
      "preLaunchTask": "waitForDebugger"
    }
  ],
  "compounds": [
    {
      "name": "Start Editor and Attach Debugger",
      "configurations": [
        "Start Editor",
        "Python Debugger: Remote Attach",
      ],
      "stopAll": true,
          
    }]
}

We need a pre launch task to wait for the debugger.

task.json:

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "shell",
			"command":"bin/tap",
			"args": ["wait-for-port", "--port", "5678"],
			"problemMatcher": [],
			"label": "waitForDebugger",
			"options": {
				"env": {
					"NODEBUGSERVER": "true"
				}
			}
		}
	]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions