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

Explicit imports lens (as seen on Twitter) #310

Merged
merged 5 commits into from
Aug 15, 2020

Conversation

pepeiborra
Copy link
Collaborator

This adds a new code lens for displaying explicit import lists on import declarations. There is hopefully an animated gif that illustrates it.

@lukel97
Copy link
Collaborator

lukel97 commented Aug 11, 2020

Could this be exposed via a source.organizeImports code action instead? This is really handy but I can imagine for modules with a lot of imports you're going to have to be scrolling through a lot of code lenses

@pepeiborra
Copy link
Collaborator Author

pepeiborra commented Aug 11, 2020

Could this be exposed via a source.organizeImports code action instead? This is really handy but I can imagine for modules with a lot of imports you're going to have to be scrolling through a lot of code lenses

That would be a completely different feature, a refactoring to rewrite your imports. This plugin is firmly a code lens. Maybe we need to support a way to toggle plugins on/off ?

@ndmitchell
Copy link
Collaborator

If you click on the code lens, does it replace your import? Seems like that would be an expected feature, and thus starts to make the two features increasingly similar.

@lukel97
Copy link
Collaborator

lukel97 commented Aug 11, 2020

Could this be exposed via a source.organizeImports code action instead? This is really handy but I can imagine for modules with a lot of imports you're going to have to be scrolling through a lot of code lenses

That would be a completely different feature, a refactoring to rewrite your imports. This plugin is firmly a code lens. Maybe we need to support a way to toggle plugins on/off ?

Maybe source.organizeImports is the wrong code action kind, I was thinking more along the lines of a refactoring code action that appears under imports and offers to "Make import list explicit". This was just a thought though, a code lens is also just fine for me

@1Computer1
Copy link

I would much prefer a button I can click over code lenses. Rust Analyzer uses code lenses everywhere which gets annoying quick, but they offer a way to disable them while still being able to do the same actions by just hovering over the item which displays actions you can take on it.

@pepeiborra
Copy link
Collaborator Author

If you click on the code lens, does it replace your import? Seems like that would be an expected feature, and thus starts to make the two features increasingly similar.

Yes, it does

@pepeiborra
Copy link
Collaborator Author

I would much prefer a button I can click over code lenses. Rust Analyzer uses code lenses everywhere which gets annoying quick, but they offer a way to disable them while still being able to do the same actions by just hovering over the item which displays actions you can take on it.

This is a personal preference, I'd rather have a code lens. This is solved with a toggle that you can turn on/off, but currently HLS doesn't provide anything in that regard.

@1Computer1
Copy link

Yeah, a toggle would be the best option.

@pepeiborra pepeiborra requested a review from alanz August 15, 2020 11:49
@alanz alanz merged commit 23dda97 into haskell:master Aug 15, 2020
@expipiplus1
Copy link
Contributor

It might also be nice to disable this for qualified imports.

@pepeiborra
Copy link
Collaborator Author

It might also be nice to disable this for qualified imports.

Agreed. Please send a PR if you have the chance!

@expipiplus1
Copy link
Contributor

see #354

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

Successfully merging this pull request may close these issues.

None yet

6 participants