-
Notifications
You must be signed in to change notification settings - Fork 408
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
add threshold for organizing imports with the asterisk (*) wildcard character #1407
Conversation
Tested on vscode-java, setting "java.import.ondemandthreshold": 2,
"java.import.staticondemandthreshold": 2, No star imports are added with: package test1;
import static java.lang.Math.abs;
import static java.lang.Math.pow;
import static java.lang.Math.sqrt;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class E {
List<String> list = new ArrayList<>();
Map<String, String> map = new HashMap<String, String>();
public static void main(String[] args) {
double d1 = sqrt(4);
double d2 = pow(d1, abs(2));
System.err.println(d2);
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefs names need to be changed, but more importantly, feature should work. It just doesn't right now.
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/Preferences.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/Preferences.java
Outdated
Show resolved
Hide resolved
needs to be replaced with: Preferences preferences = JavaLanguageServerPlugin.getPreferencesManager() == null ? new Preferences() : JavaLanguageServerPlugin.getPreferencesManager().getPreferences();
rewrite.setImportOrder(preferences.getImportOrder());
rewrite.setOnDemandImportThreshold(preferences.getImportOnDemandThreshold());
rewrite.setStaticOnDemandImportThreshold(preferences.getStaticImportOnDemandThreshold()); (IMPORTS_THRESHOLD can be removed) Which will need new tests for checking completion generates star imports. |
test this please |
@fbricon I have updated the PR. |
...clipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CompletionHandlerTest.java
Outdated
Show resolved
Hide resolved
test this please |
1 similar comment
test this please |
Signed-off-by: Snjezana Peco <[email protected]>
@fbricon I have updated the PR. |
Thanks @snjeza! |
See redhat-developer/vscode-java#964
see redhat-developer/vscode-java#1374
Signed-off-by: Snjezana Peco [email protected]