bscan / PerlNavigator

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

Please provide documentation how to use perltidy in Visual Studio Code #147

Open horshack opened 3 days ago

horshack commented 3 days ago

I try to format my perl-code with perltidy in Visual Studio Code. This can be done because mentioned in

https://github.com/bscan/PerlNavigator/

Currently Implemented Features: Code formatting via Perl::Tidy

Ok, but how can I do this? I tried it with the VSCode extension "Perl Simple" described in https://stackoverflow.com/questions/79089661/how-to-use-perltidy-to-reformat-code-in-visual-studio-code/79093098#79093098 like this:

+++ VSCode has a beautifier way for every kind of file.

A VSCode extension must get installed to use it. I installed the extension: Simple Perl. After that I highlighted some perl code in some perl file. Right-click - Menue: Format selection. The code gets formatted. +++

I tried the same with PerlNavigator, but this changes nothing in the code. perltidy seems not to get called.

Could you please describe in

https://github.com/bscan/PerlNavigator/

how I can reformat code in Visual Studio Code with the extension PerlNavigator?

bscan commented 2 days ago

Hi @horshack, thanks for filing the issue. Additional documentation sounds good to me, especially since Perl Navigator supports both "Format Selection" and "Format Document" options, as shown below.

284102994-55f58d48-7c0f-4d80-bfca-98180208ffe2

I'm surprised it works in "Simple Perl", but not in "Perl Navigator". Neither of them have perltidy bundled, so it must already be installed in your version of perl. Are you using the system install of Perl? If you need to point to a different installation of Perl, you can set the params "perlnavigator.perlPath". Did you provide any settings to simple-perl?