Community
    • Login

    DAP client plugin

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    7 Posts 4 Posters 233 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • EkopalypseE Offline
      Ekopalypse
      last edited by

      This is not for the faint of heart :)
      Discussions should take place here

      PeterJonesP Lycan ThropeL 2 Replies Last reply Reply Quote 3
      • PeterJonesP Online
        PeterJones @Ekopalypse
        last edited by

        @Ekopalypse ,

        I tried it out briefly.

        Unfortunately (not your plugin’s fault), I was not able to figure out how to make the Perl debugger talk “DAP”, despite a few hours with AI suggestions.

        I was able to replicate your Python config, and that did work, so I guess I’ll be starting to use that if I want to single-step through Python. So thanks.

        rdipardoR EkopalypseE 2 Replies Last reply Reply Quote 0
        • rdipardoR Offline
          rdipardo @PeterJones
          last edited by

          @PeterJones said:

          Unfortunately I was not able to figure out how to make the Perl debugger talk “DAP”

          If you have the Rust toolchain installed, there’s a perl-dap binary crate.

          Obviously Notepad++ is no listed as a supported IDE, but the (VS Code) setup guide might be worth looking at: https://github.com/EffortlessMetrics/perl-lsp/blob/master/docs/how-to/DEBUGGING.md

          1 Reply Last reply Reply Quote 1
          • Lycan ThropeL Offline
            Lycan Thrope @Ekopalypse
            last edited by

            @Ekopalypse , is this supposed to be a multi-language type debugger launching tool? IE, if you have a debugger for your language, it can be called up in the NPP environment? Of is this something more specific? Reading the description, and loooking at the sample configs you posted, I’m assuming that’s what this is. Any guidance would be appreciated.

            1 Reply Last reply Reply Quote 0
            • EkopalypseE Offline
              Ekopalypse @PeterJones
              last edited by

              @PeterJones

              Which debugger did you use?
              The problem with all of them is—to quote the DAP specification

              Since launching is debugger/runtime specific, the arguments for this request are not part of this specification.

              figuring out how to start them.
              I do hope that they all have one thing in common: that they expect this as a valid JSON message, which I define as launch_args.

              I tried it using the link from @rdipardo, but unfortunately it didn’t work properly. I was able to run through my simple test code step by step, but the variables weren’t returned. That might be due to my configuration or setup, though.

              @lycan-thrope
              Yes, as long as the debugger supports dap there is a chance that it will work with this client.

              Note that all dialog boxes are Scintilla controls and are not protected by the “Read-only” setting. However, this should not be a problem, with the exception of the Breakpoint View, where the client receives information about which breakpoints are currently set. The markers in the source code—currently only in the active document—are removed after the debugging session stops, but they remain in the breakpoint view so they can be reused in a later debugging session.
              The exception, of course, is if I click on an already set breakpoint again; then it is also deleted, and of course if I select and delete something in the breakpoint view…

              Just for reference the config I used for the linked perl-dap

              [perl]
              debugger = "C:/WHATEVER_DIR/perl-dap.exe"
              debugger_args = ["--stdio"]
              mode = "io"
              # debugger_args = ["--socket", "--port", "13603"]
              # mode = "tcp"
              # host = "127.0.0.1"
              # port = 13603
              env  = {
              	PATH="C:/compilers/strawberry-perl-5.42.2.1/perl/bin", 
              }
              launch_args = '''{
              	"program": "C:/repos/nppdebugger/tests/debuggees/perl/test.pl",
              	"cwd": "C:/repos/nppdebugger/tests/debuggees/perl",
              	"perlPath": "C:/compilers/strawberry-perl-5.42.2.1/perl/bin"
              }'''
              
              Lycan ThropeL 1 Reply Last reply Reply Quote 1
              • Lycan ThropeL Offline
                Lycan Thrope @Ekopalypse
                last edited by Lycan Thrope

                @Ekopalypse said:

                @lycan-thrope
                Yes, as long as the debugger supports dap there is a chance that it will work with this client.

                Just when I thought I was done with the feature set and was working on a compilation of legacy dBASE language UDL’s, you bring me a new feature to try and work into the package. I have to say thanks (sarcastically) and I say thanks (sincerely) as that would be one more addition to making Notepad++ a more homogenous IDE alternative for dBASE programmers.

                We have a debugger that runs (it’s a dBASE application as well) separate from the IDE, for those brave enough to use it. It does have a bit of a crashing issue, but that may be because the IDE and Debugger running concurrently are a huge draw on resources, and this might allow for smoother running via the Notepad++ environment link.

                I guess I’ll have to get up to speed on this DAP and see what I need to learn about the debugger’s mechanism to see if it will work. I know I have a problem getting a file edited in Notepad++ to launch in dBASE, and one of those problems is the aformentioned issue @peterjones brought up in another thread, with the use of spaces in paths. dBASE doesn’t like them either, IIRC.

                Sigh…I guess I better start looking this over, along with all the IRL chores I have to get done this season. :-)

                EkopalypseE 1 Reply Last reply Reply Quote 2
                • EkopalypseE Offline
                  Ekopalypse @Lycan Thrope
                  last edited by

                  @Lycan-Thrope

                  you bring me a new feature to try and work into the package

                  I’m sooorrrryyy :D

                  get up to speed on this DAP and

                  In short, it is essentially a “standard” for how an application should communicate with a debugger.
                  The communication itself takes place via JSON with a header section and is transmitted either via stdio or TCP.
                  Each side can send a request, which must be answered by the other side with a response, and in addition,
                  both sides can send events, which are simply pieces of information that do not require a response.
                  It looks like this

                  Content-Length: 139
                  
                  {"seq":29,"type":"event","event":"stopped","body":{"allThreadsStopped":true,"hitBreakpointIds":[1],"reason":"breakpoint","threadId":13008}}
                  
                  Content-Length: 46
                  
                  {"command":"threads","type":"request","seq":9}
                  
                  Content-Length: 180
                  
                  {"seq":30,"type":"response","request_seq":9,"success":true,"command":"threads","body":{"threads":[{"id":10932,"name":"2: tid=10932 \"\""},{"id":13008,"name":"1: tid=13008 \"\""}]}}
                  Content-Length: 47
                  
                  

                  So, to make your dbase debugger dap-compatible, you need to wrap it in this layer and interpret it:
                  In the previous example, the client asks: Which threads are currently running?
                  And the dbase adapter would then have to convert this into dbase debugger commands and return the result wrapped in JSON.

                  Of course, not all debuggers can support every feature, which is where capabilities come into play.
                  Before the actual debugging begins, the client and the debug-adapter exchange information about what each is capable of,
                  and only the appropriate requests should be used thereafter.

                  along with all the IRL chores I have to get done this season

                  Those are exactly the things that keep holding me back.
                  I have no idea who came up with them, but… can’t we just fire that person?
                  I mean, obviously I’m not the only one this affects. :-D

                  1 Reply Last reply Reply Quote 2

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • First post
                    Last post
                  The Community of users of the Notepad++ text editor.
                  Powered by NodeBB | Contributors