1

Lately in VS Code, my custom DX CLI plugin is no longer stopping when using the --dev-suspend flag, and the commands just run like normal. Breakpoints are no longer being hit when using the flag.

Output of node --version: v12.21.0

Output of code --version: 1.56.2 054a9295330880ed74ceaedda236253b4f39a335 x64

Output of sfdx --version: sfdx-cli/7.110.0 win32-x64 node-v14.17.3

Here is what my launch.json file configuration looks like:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "SFDX CLI Debugger",
      "address": "127.0.0.1",
      "port": 9229,
      "localRoot": "${workspaceFolder}",
      "remoteRoot": "${workspaceFolder}",
      "sourceMaps": true,
      "smartStep": true,
      "preLaunchTask": "Compile",
      "outFiles": ["{workspaceFolder}/**.js", "!**/node_modules/**"]
    },
    {
      "name": "Run All Tests",
      "type": "node",
      "request": "launch",
      "protocol": "inspector",
      "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
      "args": ["--inspect", "--no-timeouts", "--colors", "test/**/*.test.ts"],
      "env": {
        "NODE_ENV": "development",
        "SFDX_ENV": "development"
      },
      "sourceMaps": true,
      "smartStep": true,
      "internalConsoleOptions": "openOnSessionStart",
      "preLaunchTask": "Compile"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Run Current Test",
      "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
      "args": ["--inspect", "--no-timeouts", "--colors", "${file}"],
      "env": {
        "NODE_ENV": "development",
        "SFDX_ENV": "development"
      },
      "sourceMaps": true,
      "smartStep": true,
      "internalConsoleOptions": "openOnSessionStart",
      "preLaunchTask": "Compile"
    }
  ]
}

and my tasks.json:

{
  "version": "2.0.0",
  "problemMatcher": "$tsc-watch",
  "tasks": [
    {
      "label": "Compile",
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "command": "yarn",
      "type": "shell",
      "presentation": {
        "focus": false,
        "panel": "dedicated"
      },
      "args": ["run", "prepack"],
      "isBackground": false,
      "problemMatcher": {
        "owner": "typescript",
        "fileLocation": "relative",
        "pattern": {
          "regexp": "^(.*\\.ts):(\\d*):(\\d*)(\\s*-\\s*)(error|warning|info)\\s*(TS\\d*):\\s*(.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "severity": 5,
          "code": 6,
          "message": 7
        }
      }
    },
    {
      "label": "Lint",
      "command": "yarn",
      "type": "shell",
      "presentation": {
        "focus": false,
        "panel": "dedicated"
      },
      "args": ["run", "lint"],
      "isBackground": false,
      "problemMatcher": {
        "owner": "typescript",
        "fileLocation": "relative",
        "pattern": {
          "regexp": "^(ERROR|WARNING|INFO):\\s*(.*\\.ts):(\\d*):(\\d*)(\\s*-\\s*)(.*)$",
          "file": 2,
          "line": 3,
          "column": 4,
          "severity": 1,
          "message": 6
        }
      }
    }
  ]
}

In my settings.json in VS Code, I have tried toggling "debug.javascript.usePreview": back and forth between true and false but that doesn't seem to make any difference.

Has anyone run across similar issues with the CLI?

1

Looks like the issue was the AutoAttach feature under File > Preferences > Settings > Extensions > JavaScript Debugger > Auto Attach Filter. Setting it to smart didn't seem to work, but once set to always everything worked again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.