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

Remove unused imports across project/current file #113

Open
opsb opened this issue Jan 21, 2017 · 10 comments
Open

Remove unused imports across project/current file #113

opsb opened this issue Jan 21, 2017 · 10 comments

Comments

@opsb
Copy link

opsb commented Jan 21, 2017

As I'm just switching to Atom and haven't had the linter running in my editor previously I have a ton of unused imports. It would be fantastic if the following commands existed:

  1. Remove unused imports across project
  2. Remove unused imports in file
@opsb opsb changed the title Remove unused imports across project Remove unused imports across project/current file Jan 21, 2017
@halohalospecial
Copy link
Collaborator

How about also adding "Remove unused imports on save" option?

Cc: @mybuddymichael @splodingsocks

@mybuddymichael
Copy link
Owner

@halohalospecial Makes sense to me! I am curious if you have any thoughts to when functionality like this should go into elmjutsu instead of linter-elm-make or vice versa?

@halohalospecial
Copy link
Collaborator

@mybuddymichael linter-elm-make features seem to be anything related to the output from elm-make (error highlighting, quick fixes), while elmjutsu features are those that uses information extracted from parsing (except for Install Package and Uninstall Package, which I'm thinking of removing or moving to another package).

@halohalospecial
Copy link
Collaborator

halohalospecial commented Jan 22, 2017

There are sometimes overlaps though. Like if we want to have a quick fix that also needs parsed info.

Just realized that Atom is the only editor/IDE where major Elm support features are spread across different packages/plugins :D

@opsb
Copy link
Author

opsb commented Jan 22, 2017

How about also adding "Remove unused imports on save" option?

I'll try and take a look today

@opsb
Copy link
Author

opsb commented Jan 22, 2017

The timing seems a little tricky regarding save/linting/removeImports. The linting happens after save(unless you have on the fly enabled) and because removeImports requires the linter to run first it means that it also can't be run until after save. This means that you have to hit save twice to save the results from removeImports. There doesn't appear to be anyway to force the linting to happen before save because even if I call it explicitly in the onWillSave hook https://github.com/mybuddymichael/linter-elm-make/blob/master/lib/linter-elm-make.js#L407 is async which means that it still runs after save. Potentially I can trigger a second save automatically but preventing an infinite loop is fiddly. Open to ideas if anyone has any.

@opsb
Copy link
Author

opsb commented Jan 22, 2017

So I added a hack that does the job, 33795c8. It does work reliably but you definitely have to hold your nose.

@opsb
Copy link
Author

opsb commented Jan 22, 2017

@halohalospecial
Copy link
Collaborator

halohalospecial commented Jan 23, 2017

Should we also have "Add missing type annotations on save" and the "Add Missing Type Annotations" command?

@opsb
Copy link
Author

opsb commented Jan 23, 2017

Should we also have "Add missing type annotations on save" and the "Add Missing Type Annotations" command?

happy to add these as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants