NativeScript / plugin-seed

Build NativeScript Plugins Fast ⚡
https://docs.nativescript.org/plugins/plugin-workspace-guide
Apache License 2.0
45 stars 11 forks source link

Recommended way to debug in VSCode during plugin development? #2

Closed shansb-dev closed 4 years ago

shansb-dev commented 4 years ago

Hi can you give a quick explanation how you are debugging your demo apps/plugins in the workspace?

I can add new NativeScript launch configurations for npm start like this.

        {
            "command": "npm start",
            "name": "Run npm start",
            "request": "launch",
            "type": "node-terminal",
        },
        {
            "command": "npm start apps.demo-angular.android",
            "name": "Demo Angular Android",
            "request": "launch",
            "type": "node-terminal",
        },
        {
            "command": "npm start apps.demo-angular.ios",
            "name": "Demo Angular iOS",
            "request": "launch",
            "type": "node-terminal",
        }

But then all breakpoints I set are unbound and grayed out.

If I start the application via the interactive 'npm start' and try to attach a debugger (via "Attach on iOS") I get this result:

The application undefined is not installed on device with identifier 7ED7FC41-801D-46D3-A72B-915CC66884E5.

Am I missing something here?

Thanks

shansb-dev commented 4 years ago

It turned out, I added the launch configuration at the wrong place. The auto generated launch.json was placed inside the plugin workspace.

pluginworkspace
  .vscode
    launch.json

In order to use it with the demo app I had to move it. In the correct demo directory.

pluginworkspace
  apps
    demo-angular
      .vscode
        launch.json

Lesson learned, now it works as expected.