richterger / Perl-LanguageServer

Language Server for Perl
Other
222 stars 53 forks source link

Debug launch.json redirect standard input #82

Closed QinjianZheng closed 12 months ago

QinjianZheng commented 3 years ago

How do I read in variables while debugging? My current Launch.json

{
    "version": "0.2.0",
    "configurations": [       
        {
            "type": "perl",
            "request": "launch",
            "name": "Perl-Debug",
            "program": "${file}",
            "stopOnEntry": true,
            "reloadModules": true,
        }
    ]
}
richterger commented 3 years ago

Sorry, stdin in not implemented yet in the debugger (Patches are welcome :-). You might use environment variables, are open a file as workaround.

nametable commented 3 years ago

@richterger I am interested in trying to get this to work. What I am wondering is if there is a good way to use the LanguageServer to debug itself? So far I can easily debug the vscode client portion of the code but I'm unsure how to debug the debug-adapter Perl::LanguageServer itself. Is this something that should be possible?

Also, I am wondering if you may have some insight into how accomplishing the task of redirecting standard input may work. It seems that stdin and stdout are being redirected for the debugger already to talk to it (using open3 and specifying out and in file handlers in IO.pm), correct? Or am I misunderstanding?

izderadicka commented 2 years ago

Also missing this functionality, C debug in VS Code enables to add "<", "input_file.txt" to args, which redirects file to stdin. This will help and it might be easier that working with debug terminal?

wielandp commented 1 year ago

https://github.com/richterger/Perl-LanguageServer/pull/166 should fix this Syntax is same like C debug

richterger commented 12 months ago

stdin redirect is implemented in 2.6.0+