Perl-LanguageServer icon indicating copy to clipboard operation
Perl-LanguageServer copied to clipboard

Debug launch.json redirect standard input

Open QinjianZheng opened this issue 3 years ago • 3 comments

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,
        }
    ]
}

QinjianZheng avatar Mar 13 '21 03:03 QinjianZheng

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

richterger avatar Mar 14 '21 16:03 richterger

@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?

nametable avatar Jul 19 '21 16:07 nametable

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?

izderadicka avatar Nov 19 '21 09:11 izderadicka

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

wielandp avatar Feb 06 '23 17:02 wielandp

stdin redirect is implemented in 2.6.0+

richterger avatar Jul 26 '23 18:07 richterger