Vscode-java: Customize imports order

Created on 24 Jan 2018  路  3Comments  路  Source: redhat-developer/vscode-java

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
enhancement

Most helpful comment

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"]

All 3 comments

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?

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!

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"]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

zalcorshark picture zalcorshark  路  3Comments

bilymed picture bilymed  路  3Comments

roben picture roben  路  4Comments

BuZZ-dEE picture BuZZ-dEE  路  4Comments

sfariaNG picture sfariaNG  路  3Comments