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

Automatic import placed after class Doc comment. #842

Closed
EricBishton opened this issue May 18, 2018 · 2 comments
Closed

Automatic import placed after class Doc comment. #842

EricBishton opened this issue May 18, 2018 · 2 comments

Comments

@EricBishton
Copy link
Member

Imports should come before leading comments for a class. (Especially doc comments.)

To reproduce: Auto-add the import for openfl.system.System by pressing Alt+Enter at line 19.

image

IDEA Version: 2018.1
Plugin Version: 1.0.2 for 2018.x
Develop branch: e19d288

@Gama11
Copy link
Member

Gama11 commented May 18, 2018

Note that when you fix this, you need to consider license headers too. It maybe be hard to tell whether a comment belongs to the type or not in some cases, as there may not always be a package statement.

@EricBishton
Copy link
Member Author

True enough. We do know the difference between a regular comment and a doc comment (.e.g /**). Doc comments placed immediately in front of another primary element (class, field, method) should be associated with the primary element, in all cases. Doc comments should not be used in imports, though users could do that. However, the current implementation checks that import sections don't contain any comments; if they do, we refuse to sort them.

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

No branches or pull requests

3 participants