-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 EP to customize "Add Import" weights #2853
base: master
Are you sure you want to change the base?
Conversation
Friendly ping on this - any updates? |
Hi @andymagee ! We actually already have a simlar EP for callables - Could you please see if it is possible to extend it or introduce a new EP which would look similar to it? |
Fix for https://youtrack.jetbrains.com/issue/KTIJ-31471 KotlinAutoImportCallableWeigher allows customization of the order within the auto import list. This change updates it to more accurately handle imports for type names.
b8a6875
to
c3b4bf4
Compare
Thank you, I had missed that existing EP! The existing weigher uses I'm also removing the Let me know what you think, thanks. |
There's an existing test for TypeAlias import ordering, but it's only passing by accident. Adding a single parameter to the annotation that's being aliased causes the order to get swapped, which doesn't match the expected behavior. (I'm assuming the expected behavior is that the typealias should always be lower on the list; this is based on the existing test case.) The existing test case worked because the annotation had a default constructor with 0 arguments, and the referencing location that needs an import also has 0 arguments. But any time that argument count doesn't match, then the order is no longer determined by this weigher. This fix simply demotes any TypeAlias elements slightly.
Hi there, any comments on the updated changes? |
Sorry for the delay, I will take a look at it this week |
Hi @fedochet , have you had a chance to take a look at this PR? |
Hi again Andy! I have looked at your PR and the original issue once again, and I see that in the AS you've previously used Unfortunately, I am not sure that I am (as the owner of the auto-import subsystem) ready to make the My main concern is that in the current form the EP seems a little bit clumsy, and it is also somewhat under-used in our own code. Another concern is that it is not related to weighers, which seems like an overlooking from our part If it's possible, I would like to postpone this PR for some time. I am currently woking on auto-import subsystem, and I would also pay attention to the existing EPs, and will take your paricual problem (https://youtrack.jetbrains.com/issue/KTIJ-31471) into consideration as well WDYT? |
That sounds like a reasonable plan, and I agree that it makes sense to have a single mechanism rather than multiple different types of weighers. Do you have any timeline in mind for this work? Depending on when we would expect any updates, we may need to make some workarounds on our side for this in the meantime. |
Fix for https://youtrack.jetbrains.com/issue/KTIJ-31471