Search code examples
typescriptvscode-extensionslanguage-server-protocol

Breakpoints not binding in language server protocol extension


We are building our LSP extension using the sample as a basis. Breakpoints are binding successfully for code in the client folder but not in the server folder. Our launch configs are very similar to the ones in the sample and all our typescript gets compiled into the out folder.

{
      "type": "extensionHost",
      "request": "launch",
      "name": "Launch Client: SB Text Editor",
      "runtimeExecutable": "${execPath}",
      "args": [
        "${workspaceFolder}/client/testFixture",
        "--extensionDevelopmentPath=${workspaceRoot}"
      ],
      "outFiles": [
        "${workspaceRoot}/client/out/**/*.js",
        "${workspaceRoot}/server/out/**/*.js"
      ],
      "sourceMaps": true
    },
    {
      "type": "node",
      "request": "attach",
      "name": "Attach to Server: SB Text Editor LSP",
      "port": 6009,
      "restart": true,
      "outFiles": [
        "${workspaceRoot}/server/out/**/*.js",
        "${workspaceRoot}/server/out/"
      ],
      "sourceMaps": true,
      "trace": true,
      "timeout": 30000
    },

We use a compound similar to the one in the sample too.

    {
      "name": "SB Text Editor",
      "configurations": [
        "Launch Client: SB Text Editor",
        "Attach to Server: SB Text Editor LSP"
      ],
      "preLaunchTask": "build",
      "outFiles": [
        "${workspaceRoot}/client/out/**/*.js",
        "${workspaceRoot}/server/out/**/*.js"
      ],
      "sourceMaps": true
    },

enter image description here

Checking the Debug Diagnostics and we can see that the code in server is not being loaded, only the code in client. Are we missing something to get the server code to load for breakpoint binding?


Solution

  • We got this working by adding this to our client launch config so that the child server processes gets covered:

    "autoAttachChildProcesses": true