perl-language-server
perl-language-server copied to clipboard
sorting imports issue
Sorting imports doesn't seem to work correctly for me.
If there is a blank line or comment it stops processing anything after the comment or blank line. It also doesn't seem to be sorting things alphabetically properly.
I see you are using ExtUtils::Installed to see what modules are installed. Sadly this doesn't really work for centos and ubuntu based systems and the likes because they don't include the .packlist in their rpm/dep packages. I only have packlists on my system for stuff I've installed out of cpan.
I'd either make using ExtUtils::Installed optional or remove it. I don't think it's gonna do a whole lot for most people. I don't know of any other better solutions. Maybe examine what's in @INC ? I think that's what https://github.com/briandfoy/app-module-lister does.
Personally I don't care for the spacing between the sections. I'd like to see an option to disable/enable spacing between sections.
What are your thoughts?
Yeah, I never made this feature particularly robust. It was originally just meant to sort things how I like them. It stops after the first non "use" line. Maybe that's not necessary, I just never tried to make it too complicated.
Perhaps if that option is available, then pragmas can stay in their own sections and all other modules can just be combined and sorted.
A side effect of having them stop after the first non use line is that once you sort them, you won't be able to sort them again. I think just sorting them would probably be good enough with pragmas on top. Ideally I think it would go: 1 pragmas 2 installed modules (any module outside of project root) 3 modules found in project root
The other related thing I forgot to ask is, shouldn't this feature be provided via a code action ? I was a little confused in reading whether it should or shouldn't be.
On Mon, Oct 11, 2021 at 9:24 AM Marc Reisner @.***> wrote:
Yeah, I never made this feature particularly robust. It was originally just meant to sort things how I like them. It stops after the first non "use" line. Maybe that's not necessary, I just never tried to make it too complicated.
Perhaps if that option is available, then pragmas can stay in their own sections and all other modules can just be combined and sorted.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/FractalBoy/perl-language-server/issues/68#issuecomment-940174601, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACTAMGOHHMDI23JNUQGWSLUGMFSNANCNFSM5FYS72XA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
If my memory serves, code actions come from hints, so you'd first need a hint that says "your imports aren't sorted" and then an associated code action to sort them.
That might be good, I haven't explored doing hints though.