richterger / Perl-LanguageServer

Language Server for Perl
Other
219 stars 53 forks source link

[WSL2] Default launch.json doesn't start debugging, emits Bareword found where operator expected error #162

Closed Rytisgit closed 1 year ago

Rytisgit commented 1 year ago

I wanted to try debugging Perl on remote WSL2 from Windows using the Remote Development extension, after generating the default launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "type": "perl",
            "request": "launch",
            "name": "Perl-Debug",
            "program": "${workspaceFolder}/${relativeFile}",
            "stopOnEntry": true,
            "reloadModules": true,
            "env": {"TERMCAST_HOST":"termcast.org",
                "PERL5LIB":"/source/dcss_tv/"}
        }
    ]
}

and trying to launch debugging it outputs the error:

Bareword found where operator expected at /home/sentei/dcss_tv/.vscode/launch.json line 2, near "// Use"
    (Missing operator before Use?)
String found where operator expected at /home/sentei/dcss_tv/.vscode/launch.json line 5, near ""version""
    (Missing semicolon on previous line?)
syntax error at /home/sentei/dcss_tv/.vscode/launch.json line 2, near "// Use IntelliSense "
syntax error at /home/sentei/dcss_tv/.vscode/launch.json line 17, near "}"
Execution of /home/sentei/dcss_tv/.vscode/launch.json aborted due to compilation errors.

trying the same on natively installed vscode inside wsl, the debugger launches correctly.

richterger commented 1 year ago

The default configuration tries to start the programm that is currently open in the editor. The error looks like you are currently editing the launch.json itself, with, of course, cannot debugged as perl programm. Try to switch to the programm you want to debug in the editor and start the debugger again.

Rytisgit commented 1 year ago

Looks like you are correct, not sure how it didn't occur to me. Sorry for the bogus report.