richterger / Perl-LanguageServer

Language Server for Perl
Other
219 stars 53 forks source link

perltidy doesn't pick up `$HOME/.perltidyrc` #161

Closed dseynhae closed 1 year ago

dseynhae commented 1 year ago

I'm seeing the problem using VS Code Remote WSL and VS Code Remote SSH:

In my $HOME/.perltidyrc on those machines I have a simple setting to have 2-space indentation:

$ cat $HOME/.perltidyrc
-i=2     # 2 columns per indentation level (default n=4)
#-fnl    # Freeze newlines (don't merge lines)
         # This respect newlines, but also won't introduce new ones

When running perltidy from the command line, I'm getting the correct result. I also get the expected result with the Simple Perl extension...

⚠️ However when formatting with the Perl extension I'm still getting 4-space indentation, which leads me to believe that we're bypassing the configuration file...

richterger commented 1 year ago

This is the problem that the environment is not passed to perltidy. Set HOME in env in your perl extention config and it will work. It's on my TODO list to change the enviromentent setup for the next release

dseynhae commented 1 year ago

I see... PerlTidy is using the variable, and it simply isn't there...

When I set it in "perl.env", then the extension passes it on to PerlTidy; Thank you.

richterger commented 1 year ago

Environment is now passed per default. This can be disabled by disablesPassEnv, see 29ad712a55348a1ba06a375bbf5e00fb62abbf05