bscan / PerlNavigator

Perl Language Server that includes syntax checking, perl critic, and code navigation
MIT License
198 stars 39 forks source link

Help getting Sublime Text 4 perl includePaths working #87

Closed peterdragon closed 1 year ago

peterdragon commented 1 year ago

Hi, on a Mac I have Sublime Text 4 set up and working with perlnavigator and a homebrew perl 5.36. I am struggling to get the perlnavigator.includePaths setting to apply. Could you advise? I had a look through the git area but couldn't see an example.

I have this in LSP.sublime-settings where I have tried to set it in a couple of places

// Settings in here override those in "LSP/LSP.sublime-settings"
{
    "clients": {
        "perlnavigator": {
            "enabled": true,
            "command": ["node", "/Users/peter/localrepos/PerlNavigator/server/out/server.js","--stdio"],
            "selector": "source.perl",
            "includePaths": [
                "/Users/peter/mnt/develop/tal_pe/cgi",
            ],
            "settings": {
                "LSP-perl.enableWarnings": true,
                "LSP-perl.perlcriticEnabled": true,
                "LSP-perl.perlcriticProfile": "~/.perlcriticrc",
                "perlnavigator.includePaths": [
                    "/Users/peter/mnt/develop/tal_pe/cgi",
                ],
        }
    }
}

but when I check the warning in the editor that extra path is not included

Screenshot 2023-09-12 at 17 29 12
bscan commented 1 year ago

I think the problem is that you have two language servers running simultaneously (or some other extension providing syntax checking). The Perl Navigator prefixes errors with Syntax:, while something else must be reporting them with a prefix of perl:. My guess is that Perl Navigator is already registering the paths and then not throwing any errors. For completeness, here are example settings for Sublime:

// Settings in here override those in "LSP/LSP.sublime-settings"
{
    "clients": {
        "perlnavigator": {
            "enabled": true,
            "command": ["D:\\Applications\\perlnavigator.exe","--stdio"],
            "selector": "source.perl",
            "settings": {
                 "perlnavigator.includePaths": ["d:\\temp\\foo"]
            }
        },
    }
}
peterdragon commented 1 year ago

I've got ModernPerl, PerlSub and PerlTidy, SublimeLinter-contrib-perl packages installed. I will try experimenting with disabling/removing some of those since I think perlnavigator will provide that functionality anyway.

peterdragon commented 1 year ago

I got it working.

Removing these ST packages made perlnavigator work: SublimeLinter SublimeLinter-contrib-perl SublimeLinter-contrib-perlcritic

I also removed PerlTidy since I can do that via perlnavigator using select text, right click, LSP / Format Selection.

I kept these, which don't affect perlnavigator: ModernPerl - better syntax highlighting PerlSubs - name of current sub

Now I get proper syntax errors and perlcritic warnings: Screenshot 2023-09-13 at 11 01 27 and the @INC is being set with my extra library paths Screenshot 2023-09-13 at 11 02 50

Thanks for your help @bscan.