richterger / Perl-LanguageServer

Language Server for Perl
Other
224 stars 51 forks source link

feature request: implementation of commandLine option in VS code launch.json file #149

Closed mikemitch closed 1 year ago

mikemitch commented 2 years ago

Currently it is possible to pass arguments to the Perl debugger in VS code in the launch.json file, using the built in args facility and input variables:

launch.json file

"configurations": [ { "type": "perl", "request": "launch", "name": "Perl-Debug", "program": "${file}", "args": ["${input:arg}"], "stopOnEntry": true, "reloadModules": true }, "inputs": [ { "type": "promptString", "id": "arg", "description": "command line argument", "default": "", }, ]

The current issue is that the input variable is passed as a string to the debugger, so it's not possible to specify multiple command line arguments this way. As discussed in the VS code channel (https://github.com/microsoft/vscode/issues/83678), the easiest way around this would be to: 'ask the debugger author to support an alternative launch configuration attribute "commandline" that avoids the array'. { "type": "perl", "request": "launch", "name": "Debug INPUT", "console": "integratedTerminal", "program": "${workspaceFolder}/${relativeFile}", "commandline": "-foo -bar /hello/world -o -p" }

Would something like this be possible to implement in the Perl language server?

mikemitch commented 1 year ago

Just a follow-up on this. It appears that there is a new feature in VS code that supports passing an entire string unmodified to the underlying shell: https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_70.md#javascript-debugging Could this be enabled in Perl?

wielandp commented 1 year ago

Perl supports args, but only as an array and without redirection :-)

I made a PR https://github.com/richterger/Perl-LanguageServer/pull/166 for redirect stdin. Maybe uft-8 would be nice for stdin? I thing nodejs always uses utf8, but Perl ascii and utf8.

Redirection of stdout would be possible similar. I had no use case so far.

At the moment I wait for feedback or merge of my PR

richterger commented 1 year ago

Args can now be a string, implemented in f16696a33a112978b4fd91704dd18506901a7222 (pull request #173 )