richterger / Perl-LanguageServer

Language Server for Perl
Other
220 stars 53 forks source link

Support vscode specific variables in settings #128

Open ghandmann opened 2 years ago

ghandmann commented 2 years ago

Hi there,

today i tried to set additional include directories via settings.json this way:

{
  "perl.perlInc": [
    "${workspaceFolder}/lib"
  ],
}

But it turns out, that the ${workspaceFolder} variable is not substituted with it's actual value. Instead it is forwarded literally to the LanguageServer, so i get a Can't locate My/Module.pm error:

Can't locate My/Module.pm in @INC (you may need to install the My::Module module)
(@INC contains: ${workspaceFolder}/lib 
/home/MyUser/perl5/perlbrew/perls/perl-5.33.6/lib/site_perl/5.33.6/x86_64-linux
/home/MyUser/perl5/perlbrew/perls/perl-5.33.6/lib/site_perl/5.33.6
/home/MyUser/perl5/perlbrew/perls/perl-5.33.6/lib/5.33.6/x86_64-linux
/home/MyUser/perl5/perlbrew/perls/perl-5.33.6/lib/5.33.6

I am actually not sure if this is either something you need to enable/fix/implement or if VSCode is messing this up. Nevertheless it would be a cool feature for more portable workspaces. And at least for the setting perl.ignoreDirs this would come in handy too.

richterger commented 2 years ago

Unfortunately vscode does resolving of variables only inside of the program setting. For all other settings this must be done by the extention manualy. I will add the patch from @ecos-ps in the next release, so this work at lease for the workspaceFolder variable

bgeels commented 1 year ago

Just ran into this myself. Do you know when the next release will happen, @richterger?

afgit commented 1 year ago

See also #25 , #44 Unfortunately, the patch does not work for me. ${workspaceFolder} is not replaced by the workspace folder in perlInc, the error message still is:

Can't locate xxx.pm in @INC (you may need to install the xxx module) (@INC contains: ${workspaceFolder}/yyy ...) at - line 7.