-
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
[WIP] Use OrganizeImportsOperation in o.e.jdt.core.manipulation. #566
Conversation
Can one of the admins verify this patch? |
add to whitelist |
Nice one @rgrunber, I didn't see that one coming. I love to see more deleted code than added :-) |
result.append(val); | ||
result.append(";"); //$NON-NLS-1$ | ||
} | ||
pref.put(CodeStyleConfiguration.ORGIMPORTS_IMPORTORDER, result.toString()); |
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.
pref.put(CodeStyleConfiguration.ORGIMPORTS_IMPORTORDER, String.join(";", importOrder));
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.
Fixed in updated version.
I don't have any numbers if caching multiple AST is worth it, it probably all depends on how the language client uses the server. I'm fine with caching less. @rgrunber But I wonder if it is a good idea to have a cache in the jdt.core.codemanipulation... |
9747fd6
to
450401c
Compare
@@ -142,6 +143,9 @@ public void start(BundleContext bundleContext) throws BackingStoreException { | |||
preferenceManager.addPreferencesChangeListener(preferencesChangeListener); | |||
logInfo(getClass() + " is started"); | |||
configureProxy(); | |||
|
|||
// Set the ID to use for preference lookups | |||
JavaManipulation.setJavaUIPluginId(PLUGIN_ID); |
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.
How about you rename that method upstream to something like setPreferenceStoreId or setPreferenceStorePluginId?
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.
This change should be in for Photon M6, https://git.eclipse.org/r/118209/ . New methods will be getPreferenceNodeId/setPreferenceNodeId . The setter returns true if the value was successfully set and false otherwise.
Funny thing is, with this change, #552 can not be reproduced \o/ |
@rgrunber remind me to buy you your favorite beverage next time I am at the office. |
This is awesome @rgrunber! |
@rgrunber nice work! |
- With http://eclip.se/506239, OrganizeImportsOperation is now API - ImportReferencesCollector is now API in org.eclipse.jdt.core.manipulation - non-UI methods of SharedASTProvider are exposed in org.eclipse.jdt.core.manipulation through CoreASTProvider - Preferences such as ORGIMPORTS_IMPORTORDER can now be defined entirely through the IEclipsePreferences facility. Simply use JavaManipulation.setPreferenceNodeId() to let the JDT know which plug-in node will be used to store preferences, and then default/runtime preferences for consumption. - StubUtility.createImportRewrite() methods are now public API in CodeStyleConfiguration - Copy over ASTNodes.getEnclosingDeclaration() and Bindings.findNullnessDefault to avoid growing the patch for now. Signed-off-by: Roland Grunberg <[email protected]>
450401c
to
b7d74f0
Compare
We'll merge this after the 0.15.0 release |
Merged as e0bb56a |
@fbricon Thanks for taking this. I was going to push some additional changes, mainly polishing up the target platform now that 4.8milestones can be used but I see you've done that already. |
org.eclipse.jdt.core.manipulation
org.eclipse.jdt.core.manipulation through CoreASTProvider
through the IEclipsePreferences facility. Simply use
JavaManipulation.setJavaUIPluginId() to let the JDT know which plug-in
node will be used to store preferences, and then default/runtime
preferences for consumption.
CodeStyleConfiguration
Signed-off-by: Roland Grunberg [email protected]
I figured I'd get the ball rolling on this now that it finally got accepted into JD UI. There are of course still a few items to fix up, and possibly more as I find them :
Move preference related code into the preference manager
AFAICT JDT-LS caches many ASTs but JDT only ever cached the one for the active document. This patch returns to the old behaviour. Is this a bad thing ? Do we really see a huge gain from caching many different ASTs ? The JDT SharedASTProvider javadoc mention that more than one AST should never be held in memory for performance reasons.
Wait until Oxygen M6 is released so we can stop depending on the 4.8-I-builds to build this change, and just use the current 4.8milestones in the target platform