Closed dseynhae closed 1 year ago
When I install Simple Perl
, on the same file, I have no problems formatting with PerlTidy.
I am assuming that both the Perl
extension and this Simple Perl
extension use the same PerlTidy installation...
I just installed VS Code on Linux, and even there the same problem exists, when I try to format Perl with the VS Code Perl extension; I guess this shouldn't be a surprise, as it is probably the same extension code executing with the same PerlTidy installation...
LS: {
options => {
insertSpaces => bless(do{\(my $o = 1)}, "JSON::PP::Boolean"),
tabSize => 2,
},
range => {
end => { character => 0, line => 28 },
start => { character => 0, line => 0 },
},
textDocument => {
uri => "file:///nfs/site/disks/swuser_work_dseynhae/home/_PERL/quick_test/test.pl",
},
}LS: ERROR: perltidy failed with exit code 126 at /nfs/site/home/dseynhae/perl5/lib/perl5/Perl/LanguageServer/Methods/textDocument.pm line 484.
[Error - 9:57:48 AM] Request textDocument/rangeFormatting failed.
Message: perltidy failed with exit code 126 at /nfs/site/home/dseynhae/perl5/lib/perl5/Perl/LanguageServer/Methods/textDocument.pm line 484.
Code: -32001
Same for me on macOS:
[Error - 8:12:48 PM] Request textDocument/rangeFormatting failed.
Message: perltidy failed with exit code 126 at /Library/Perl/5.30/Perl/LanguageServer/Methods/textDocument.pm line 484.
Code: -32001
@dseynhae @marghidanu Looks like perltidy binary is not in the PATH vscode is searching. Maybe you could try to add the full path to perltidy in Perl/LanguageServer/Methods/textDocument.pm
or set your PATH
via perl.env
setting
That worked, but I had to set the entire value for the PATH variable. Can this be inferred automatically by the extension? Or maybe add a variable just for the perltidy
path?
I went ahead and updated the user settings.json
:
"perl.env": {"PATH": "/home/dseynhae/bin:/bin:/usr/local/bin:/sbin:/usr/local/sbin"}
Since Perltidy was installed through cpanm
in the system libraries, it was indeed in /usr/local/bin
...
However, that location has always been in my main PATH variable, and I swear that it used to work before with the VS Code Perl Extension...
We first talked about this for environment variables in general, within VS Code.
It looks like there is a proposal to fix this through an option. I personally don't think this should be an option, it should be the normal behavior (all of my other Language Servers seem to import the existing environment for when I launch code
...).
Would we at least consider this the "normal" behavior for at least the PATH variable?
Environment is now passed per default. This can be disabled by disablesPassEnv
, see 29ad712a55348a1ba06a375bbf5e00fb62abbf05
@richterger On Windows 10, using remote sessions (remote WSL or Remote SSH): When trying to run
Format Document
, with the format section of the Perl VS Code Extension:Using: