Nihilus118 / perl-debug-adapter

MIT License
11 stars 1 forks source link

Help needed for setting perl-debug up on nvim-dap #4

Closed bmeneg closed 1 year ago

bmeneg commented 1 year ago

Hi @Nihilus118,

as we were discussing earlier on another discussion on perl-ide org, I started using this extension with nvim-dap, however, there're weird things happening. Using the following test script:

#!/usr/bin/perl

use v5.38;
use strict;
use warnings;

my $somevar = 112;

dosomething();

sub dosomething {
    print $somevar;    
}

I get the error on DAP (:DapShowLog):

[ DEBUG ] 2023-08-23T20:00:19Z-0300 ] ...g/.local/share/nvim/plugged/nvim-dap/lua/dap/session.lua:950 ] 1   {
  body = {
    category = "stderr",
    output = "Error parsing variable $EXECUTABLE_NAME: TypeError: (0 , unescape_js_1.default) is not a function\n"
  },
  event = "output",
  seq = 48,
  type = "event"
}
[ DEBUG ] 2023-08-23T20:00:19Z-0300 ] ...g/.local/share/nvim/plugged/nvim-dap/lua/dap/session.lua:950 ] 1   {
  body = {
    category = "stderr",
    output = "Error parsing variable $ARGV: TypeError: (0 , unescape_js_1.default) is not a function\n"
  },
  event = "output",
  seq = 49,
  type = "event"
}
...

Which goes on for every symbol found (even for $somevar), reporting as not a function.

[ DEBUG ] 2023-08-23T17:38:27Z-0300 ] ...g/.local/share/nvim/plugged/nvim-dap/lua/dap/session.lua:950 ] 1   {
  body = {
    category = "stderr",
    output = "Error parsing variable $somevar: TypeError: (0 , unescape_js_1.default) is not a function\n"
  },
  event = "output",
  seq = 12,
  type = "event"
}
[ DEBUG ] 2023-08-23T17:38:27Z-0300 ] ...g/.local/share/nvim/plugged/nvim-dap/lua/dap/session.lua:950 ] 1   {
  body = {
    variables = { {
        name = "$somevar",
        presentationHint = {
          kind = "data"
        },
        type = "UNDEF",
        value = "undef",
        variablesReference = 0
      } }
  },
  command = "variables",
  request_seq = 7,
  seq = 13,
  success = true,
  type = "response"
}

Even though I've some experience with LSP, that's the first time using DAP. So have an idea how DAP works, but I didn't have time to check out your extension code to see how the interactions with Perl debugger works.

Any advice is welcome :)

Nihilus118 commented 1 year ago

Hi @bmeneg,

I will try to have a look at it this weekend even though I never worked with nvim-dap so far. The errors looks like the unescape_js package isn't installed properly. Did you run npm install in the base folder?

bmeneg commented 1 year ago

Yes, npm install seems just fine:

$ npm install

up to date, audited 465 packages in 2s

66 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Nihilus118 commented 1 year ago

I finally had the time to give this error a proper look. Adding one line to the tsconfig.json fixed the error for me. Please pull the newest version of the master and try it out for yourself.

WhoIsSethDaniel commented 1 year ago

I no longer see the error.

Nihilus118 commented 1 year ago

@bmeneg is it working out for you as well?

bmeneg commented 1 year ago

@Nihilus118 I didn't have the opportunity to test it yet, but I'll give it a try in a couple of hours and let you know.

bmeneg commented 1 year ago

@Nihilus118 really sorry for the late reply, but yeap! The issue was fixed with your last code change! Many thanks for working on it. Time to test nvim-dap-ui with it :))

bmeneg commented 1 year ago

With that, I'm closing the issue.