bscan/PerlNavigator

Extension not working out of the box in vscode for me

Closed this issue · 4 comments

Im new to perl and trying to get the extension to work on my Mac with Perl 5.30 installed. I used exactly one of your examples but its not working out of the box in vscode as it should:

use strict;
use warnings;

use Set:Scalar;

my $set = Set:Scalar->new();

$set->insert

Also compiler errors are not highlighted... Am I missing something here? Do I have to Install any dependencies or change extension settings first?

Original question on Stack Overflow.

I suggested @fligge37 to report the issue here, so that it could help to improve the "work out of the box" experience.

The README Perl path section should maybe be moved before the VS Code installation one. Since the latest claims that the extension "should just work" after installation, why one's would read the following path section?

Eventually, the path mention could go in a preliminary "Requirements" section ?

Thanks for reporting the issue, happy to work through it and improve the installation process and documentation. In the stackoverflow question, you stated I have no Syntax Highlighting. VScode provides syntax highlighting by default for Perl (although the Navigator will fix some highlighting bugs and add additional highlighting for things like Moo and Object::Pad). In vscode, the language needs to be set in the bottom right of the editor if not detected automatically. Can you check this? If this is not set correctly, you can manually select the language.

image

If that still doesn't work, there are a couple other things we can check. First, you could check if the outline view is working. As long as you include as least one package or subroutine in the file, you should get breadcrumbs and an outline view. These features are implemented in typescript and don't require a functioning Perl. Examples below.

image

If those work and syntax checking does not, then it would be a problem connecting to Perl. Looking at your Stack overflow question, it looks like you are using the system version of Perl on Mac OS (which is 5.30.3 on MacOS Sonoma). If using the system perl, you should not need to set the perlnavigator.perlPath. It should work by looking for perl in your path. The perlPath should only be needed for alternative installations, such as if you had a 2nd version of perl from perlbrew. I have tested on Mac in the past, but not in a while, so it's possible something is broken here. Let me know what you find. You can also find logging by selecting the "Perl Navigator LSP" dropdown in the output tab.

image

Thanks for giving me further context on this. The language is set correctly.
The issue was related to the perlnavigator.perlPath but actually without having a second perl version installed.
I found out my perl path via $ which -a perl that gave me /usr/bin/perl (I guess the default perl installation path?). I then set perlnavigator.perlPath to my installation path which resolved the issue.

Perl Navigator is working fine now. Thanks for your Reply :)

Sounds good, thanks! I'm glad it's working. However, I'm surprised it needed to be set. To @smonff 's point, I feel like the Navigator should either be fixed to work out of the box, or the documentation should be updated.

The default value for perlPath is simply perl, which does work for finding the system install of perl on linux.

"default": "perl",

I'm curious if there is a bug affecting MacOS where it's not finding the system perl for some reason.