Giter VIP home page Giter VIP logo

Comments (7)

dsyzling avatar dsyzling commented on June 2, 2024

I noticed in the latest dap-mode code - testing and integrating some of my changes there is support for the startDebugging request. This isn't enabled within the initialisation parameters and also currently doesn't work with debugpy. The processing filter returns:

error in process filter: or: :debugServer or :dap-server-path should be present
error in process filter: :debugServer or :dap-server-path should be present

I'm not sure what the current status of this work is? For this to work dap-server-path would have to be nil and debugServer should be set to the port from the original message. Looks like this function was added as part of 'Initial integration of new node js debugger' by @yyoncho .

from dap-mode.

dsyzling avatar dsyzling commented on June 2, 2024

This is an example startDebugging request message sent by debugpy in a multi-process scenario. In this case the launch-args are different from the scenario tested with the node js debugger. Here we may have launched a process with a straight command line (no attach), but the second process spawned is now requesting that we create a new session and attach to the sub-process.

{
  "seq": 22,
  "type": "request",
  "command": "startDebugging",
  "arguments": {
    "request": "attach",
    "configuration": {
      "type": "python-run-with-python-path",
      "name": "Subprocess 21490",
      "module": "package.runner",
      "cwd": "/home/dsyzling/dev/dap-multi-process",
      "python": [
        "/home/dsyzling/miniconda3/envs/dap-multi-process/bin/python"
      ],
      "isOutputRedirected": null,
      "subProcessId": 21490,
      "connect": {
        "host": "127.0.0.1",
        "port": 57819
      }
    }
  }
}

from dap-mode.

dsyzling avatar dsyzling commented on June 2, 2024

Something like this (excuse the poor emacs lisp and dash binding), which checks to see if there's a nested "connect" key and uses this to initiate the new session. However I think this still fails when the child session terminates and doesn't restore the current connection back to the parent?

(lsp-defun dap--start-debugging ((debug-session &as &dap-session 'launch-args 'proc 'name)
                                 (&hash "seq" "arguments"
                                        (&hash "configuration" (&hash "connect")
                                               "request" "configuration")))
  (-let* (((&plist :debugServer port :host) launch-args)
          (new-launch-args (list
                            :host (if connect (gethash "host" connect) host)
                            :debugServer (if connect (gethash "port" connect) port)
                            :request request
                            :name (format "Child of %s" name))))
    (ht-aeach (plist-put new-launch-args (intern (concat ":" key)) value) configuration)
    (dap-start-debugging-noexpand new-launch-args)

    (dap--send-message (dap--make-success-response
                        seq "startDebugging")
                       (dap--resp-handler) debug-session)))

from dap-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.