PerlNavigator icon indicating copy to clipboard operation
PerlNavigator copied to clipboard

navigator fails to find modules in lib/perl5/x86_64-linux/

Open Deracination opened this issue 1 year ago • 3 comments

I have the Mouse.pm and Imager.pm modules installed via local::lib which installs in local_lib/lib/perl5/x86_64-linux/

The navigator reports any modules in x86_64-linux as unknown and needing to be installed.

Configuration is:

    "perlnavigator.perlPath": "/opt/perlbrew/perls/perl-5.34.0/bin/perl",
    "perlnavigator.includePaths": [
        "$workspaceFolder/local_lib",
        "$workspaceFolder/code",
    ],
    "perlnavigator.perltidyProfile": "/home/dev/.perltidyrc",
    "perlnavigator.perlcriticEnabled": false,
    "perlnavigator.includeLib": false,
    "perlnavigator.enableWarnings": false,

Deracination avatar May 08 '23 05:05 Deracination

Using a wrapper for Perl as follows and perltidy now works but there is no navigation support - no definitions:

#!/bin/bash

# FindBin for bash!
readonly Bin=$(cd -- "$(dirname "$0")" && pwd)

/opt/perlbrew/perls/perl-5.34.0/bin/perl -Mlocal::lib=${Bin}/../local_lib $@
"perlnavigator.perlPath": "/home/dev/work/util/perl_run"

language server log shows:

Starting perl compilation check with the equivalent of: /home/dev/work/util/perl_run -c -Mwarnings -M-warnings=redefine -I /home/dev/work/code -I /home/dev/work/treeplan/perl -I /home/dev/.vscode-server/extensions/bscan.perlnavigator-0.5.5/server/src/perl -MInquisitor /home/dev/work/code/DMS/SiteUtils.pm
Compilation Time: 0.031 seconds
[Trace - 4:05:54 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///home/dev/work/code/DMS/SiteUtils.pm",
    "diagnostics": []
}


[Trace - 4:05:54 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///home/dev/work/code/DMS/SiteUtils.pm",
    "diagnostics": []
}

Deracination avatar May 08 '23 06:05 Deracination

Hi @Deracination, perhaps you can try adding the full path of the perl modules to your includePaths? Something like:

"perlnavigator.includePaths": [
        "/home/Deracination/local_lib/lib/perl5/x86_64-linux/",

In any case, you can usually get more info by manually running the "equivalent of" command shown. The navigator runs something slightly different because it needs to pass the code over stdin (since the file modifications may not be saved yet), but it's close enough. Including -MInquisitor causes it to dump symbols from the symbol table that are used for navigation purposes. You could leave that argument out if just checking to see if modules are found and the code compiles.

/home/dev/work/util/perl_run -c -Mwarnings -M-warnings=redefine -I /home/dev/work/code -I /home/dev/work/treeplan/perl -I /home/dev/.vscode-server/extensions/bscan.perlnavigator-0.5.5/server/src/perl -MInquisitor /home/dev/work/code/DMS/SiteUtils.pm

If none of this works, you may need https://github.com/bscan/PerlNavigator/pull/68, which allows passing arguments to the perl executable. I think many people want that feature for docker, local::lib, WSL, Carton, etc. I just need to finish reviewing it and then push a new release.

bscan avatar May 08 '23 14:05 bscan

Thanks, I'll watch for the new release

Deracination avatar May 08 '23 23:05 Deracination