richterger / Perl-LanguageServer

Language Server for Perl
Other
224 stars 53 forks source link

How to use this for a Plack app? #35

Closed tomascohen closed 4 years ago

tomascohen commented 4 years ago

It is not clear in the docs how to bind the server process to the language server .

minusdavid commented 4 years ago

I haven't tried this but here's my guess.

You could try the launch.json mentioned in https://github.com/richterger/Perl-LanguageServer/blob/master/docs/Perl-LanguageServer%20und%20Debugger%20f%C3%BCr%20Visual%20Studio%20Code%20u.a.%20Editoren%20-%20Perl%20Workshop%202020.pdf

And then create the launch.json as specified in https://code.visualstudio.com/docs/editor/debugging

minusdavid commented 4 years ago

Obviously modifying the launch.json to be for the app you're looking to debug of course

minusdavid commented 4 years ago

Actually, after reviewing that first document again, I have no idea

minusdavid commented 4 years ago

Yeah no I think that is it. Visual Studio Code probably sends the launch.json info through the debug port that Perl::LanguageServer is listening on, and then I imagine Perl::LanguageServer creates a child process that runs the desired program to debug.

richterger commented 4 years ago

Yes, this is how it works. So you need to start your Server by LanguageServer. This will work, as long as your server is a Perl program. This is because the Perl code needs to be started with debug options, otherwise the debugger don't get the necessary information from the Perl interpreter.