FractalBoy / perl-language-server

101 stars 12 forks source link

Compilation aborted message in executable code #77

Closed Shenzo1337 closed 2 years ago

Shenzo1337 commented 2 years ago

Hello there,

I'm facing a problem with running a full Mojo app. The codeproblem window is telling me that the compilation aborted while the code can be executed.

This is my settings.json:

{
    "workbench.colorTheme": "Default Dark+",
    "editor.tabSize": 2,
    "perl.perlcritic.enabled": false,
    "perl.inc": [
    "./lib",
    "./t/lib",
    ],
    "telemetry.enableTelemetry": false,
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    }
}

image

This only appears while the sourcefile is opened.

Thanks for your work! I really like PLS :)

FractalBoy commented 2 years ago

I believe that the issue is that you are attempting to use relative paths in your inc. You need to replace . with $ROOT_PATH.

Shenzo1337 commented 2 years ago

Thanks for your quick response.

I tried the following settings:

{
    "workbench.colorTheme": "Default Dark+",
    "editor.tabSize": 2,
    "perl.perlcritic.enabled": false,
    "perl.inc": [
    "$ROOT_PATH/lib",
    "$ROOT_PATH/t/lib",
    ],
    "telemetry.enableTelemetry": false,
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    }
}

Unfortunately I still get the same message.

Kind regards.

FractalBoy commented 2 years ago

What do you get from running this command?

perl -I./lib -I./t/lib -c Cmdb.pm

Shenzo1337 commented 2 years ago

Hello,

thanks for the tip, I now understand what the problem is. However, in my case it makes no sense to post the output as it is too domain specific.

Nevertheless, I would like to explain what the problem is: The problem is that I am working on several Perl packages at the same time and these packages reference each other. However, I need short turn around times in my development, so I use the following code:

if(! $main::LIBLOAD) {
  use File::Find::Rule;
  use lib map { "$_/lib" } File::Find::Rule->directory->mindepth(1)->maxdepth(1)->in('../../packages');
}
$main::LIBLOAD = 1;

(This way I dynamically expand the Perl interpreter search path).

A solution for me would be that PLS allows to extend the search path after the internal initialisation (for example by using a callback).

Kind regards.