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

Feature Request: Sorted Imports #918

Open
RyanRHall opened this issue Aug 25, 2023 · 5 comments
Open

Feature Request: Sorted Imports #918

RyanRHall opened this issue Aug 25, 2023 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@RyanRHall
Copy link

I would love if there was an option to sort imports alphabetically. Liked groups could be segregated with a space (ex the way go fmt works).

@Janther
Copy link
Contributor

Janther commented Aug 25, 2023

mmmh not sure as the order of import does impact the bytecode generated and could potentially affect the way the state is stored and the amount of gas it uses on different calls.

doesn't feel right with me even as an option.

@fvictorio any thoughts?

@RyanRHall
Copy link
Author

@Janther Can you explain to me how import order impacts the bytecode? From my (albeit limited) experimenting, it seems to have no affect. Thanks!

@Janther
Copy link
Contributor

Janther commented Aug 28, 2023

I think I was mistaken, I was thinking of the order of inheritance in a contract.
Still would like to hear the community's feedback on this one as it does change the parsed AST.

@Janther Janther added enhancement New feature or request help wanted Extra attention is needed labels Aug 28, 2023
@Janther
Copy link
Contributor

Janther commented Aug 28, 2023

Parking this for now, it seems to add some complexity (specially if we add comments for the imports into the mix).

@fvictorio
Copy link
Member

I am of the opinion that this kind of thing belongs in a linter (tagging @juanpcapurro, who is maintaining solhint-community).

That being said, not everyone agrees with that point of view. For example, rustfmt does sort imports (and a lot of other things).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants