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

Customize imports order #420

Closed
ronniehicks opened this issue Jan 24, 2018 · 3 comments
Closed

Customize imports order #420

ronniehicks opened this issue Jan 24, 2018 · 3 comments
Assignees

Comments

@ronniehicks
Copy link

ronniehicks commented Jan 24, 2018

I don't think it's a bug, but I'd like the Organize Imports action to respect an .importorder file from Eclipse. Sorry ahead of time if this is the wrong place to post this.

Environment
  • Operating System: Win 10
  • JDK version: 1.8.0_162
  • Visual Studio Code version: 1.19.2
  • Java extension version: 0.17
Steps To Reproduce
  1. Add .importorder file to .settings directory
  2. Perform Organize imports action
Current Result

.importorder file is ignored

Expected Result

.importorder file is respected

Additional Informations
@fbricon
Copy link
Collaborator

fbricon commented Jan 24, 2018

From what I can tell, eclipse can export xyz.importer files, but doesn't load them automatically. In Eclipse, import order is configured through the org.eclipse.jdt.ui.importorder preference in .settings/org.eclipse.jdt.ui.prefs, but this is not supported by jdt.ls/vscode-java.

Do you need a 3rd party plugin to have .importorder files being loaded in Eclipse?

@ronniehicks
Copy link
Author

Do you need a 3rd party plugin to have .importorder files being loaded in Eclipse?

Apologies, if I misunderstand your question here, but it sounds like you're asking if I'm in need of a plugin for Eclipse to load these files? If so, sure, I'll pass it on to the team I'm currently on, and keep it in mind if I start doing java development in Eclipse.

Thanks!

@fbricon fbricon changed the title Adhere to eclipse .importorder file Customize imports order Jan 31, 2018
@fbricon
Copy link
Collaborator

fbricon commented Jan 31, 2018

So while .importorder files are still not supported (I still need more info on their usage), a new java.completion.importOrder preference is available. A package or type name prefix (e.g. 'org.eclipse') is a valid entry. An import is always added to the most specific group. Default value is:

`java.completion.importOrder`: ["java", "javax", "com", "org"]

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

4 participants