Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sorting imports issue #68

Open
willt opened this issue Oct 11, 2021 · 3 comments
Open

sorting imports issue #68

willt opened this issue Oct 11, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@willt
Copy link

willt commented Oct 11, 2021

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?

@FractalBoy
Copy link
Owner

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.

@willt
Copy link
Author

willt commented Oct 11, 2021 via email

@FractalBoy
Copy link
Owner

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.

@FractalBoy FractalBoy added the enhancement New feature or request label Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants