ioBroker/create-adapter

[enhancement] add launch.json to vscode

mcm1957 opened this issue · 6 comments

It should be evaluated wetehr adding a launch.json to the vscode template directory is a good idea.
I'll add an example which seems to work as base for discussion. Whter "launch install" should be added or removed is to be discussed too. It a special variant to debug installation situations which could possibly confuse newbies.

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch normal",
            "program": "${workspaceFolder}/main.js",
            "args": ["--instance", "0", "--force", "--logs", "--debug"],
            "env": {
                NODE_PATH=".dev-server\default\node_modules"
            },
            "request": "launch",
            "stopOnEntry": true,
            "console": "internalConsole",
            "outputCapture": "std",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "type": "node"
        },
    
        {
            "name": "Launch install",
            "program": "${workspaceFolder}/main.js",
            "args": ["--instance", "0", "--force", "--logs", "--debug", "--install"],
            "env": {
                NODE_PATH=.dev-server\default\node_modules
            },
            "request": "launch",
            "stopOnEntry": true,
            "console": "internalConsole",
            "outputCapture": "std",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "type": "node"
        },
    
        {
            "name": "Attach by Process ID",
            "processId": "${command:PickProcess}",
            "request": "attach",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "type": "node"
        }
    ]
}

I can try to add if some consent exists that it is useful

See telegram disussion too https://t.me/c/1697676361/5198 and several messages before and after ...

Should be:

NODE_PATH=".dev-server/default/node_modules"

Thanks - updated

Thanks - updated

Also Launch Install and / instead \

ticaki commented

Bei mir funktioniert beim Remote Debugging auch folgendes:

       {
            "type": "node",
            "request": "attach",
            "name": "Attach to remote",
            "restart": true,
            "port": 9229,
            "resolveSourceMapLocations": [
                "${workspaceFolder}/.dev-server/default/node_modules/**/*.js"
            ]
        },

A not yet released version of dev-server enables using symlinks for installing the adapter. This includes two launch configs (one for TS, one for JS):
ioBroker/dev-server#357

I'd prefer releasing that new version, make symlinking the default and use those launch configs.

Adding the one-time-install launch config may be helpful though.

corrected code from 1st Post:

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "Launch normal",
			"program": "${workspaceFolder}/main.js",
			"args": ["--instance", "0", "--force", "--logs", "--debug"],
			"env": {
				"NODE_PATH": ".dev-server/default/node_modules"
			},
			"request": "launch",
			"stopOnEntry": true,
			"console": "internalConsole",
			"outputCapture": "std",
			"skipFiles": ["<node_internals>/**"],
			"type": "node"
		},

		{
			"name": "Launch install",
			"program": "${workspaceFolder}/main.js",
			"args": ["--instance", "0", "--force", "--logs", "--debug", "--install"],
			"env": {
				"NODE_PATH": ".dev-server/default/node_modules"
			},
			"request": "launch",
			"stopOnEntry": true,
			"console": "internalConsole",
			"outputCapture": "std",
			"skipFiles": ["<node_internals>/**"],
			"type": "node"
		},

		{
			"name": "Attach by Process ID",
			"processId": "${command:PickProcess}",
			"request": "attach",
			"skipFiles": ["<node_internals>/**"],
			"type": "node"
		}
	]
}