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

Add import quick fix for unknown type #2260

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

aperfilyev
Copy link
Collaborator

Screen.Recording.2021-04-08.at.17.20.43.mov

How do I unit test this?

closes #683

@aperfilyev aperfilyev changed the title Add import quick fix on unknown type Add import quick fix for unknown type Apr 8, 2021
@AlecKazakova
Copy link
Collaborator

YOOOOOOOOOOOOOOOOOOO NICE

@AlecKazakova
Copy link
Collaborator

i think you can unit test this similar to how we do the expand intention:

https://github.com/cashapp/sqldelight/blob/master/sqldelight-idea-plugin/src/test/kotlin/com/squareup/sqldelight/intellij/intentions/ExpandColumnNamesWildcardQuickFixTest.kt#L49-L50

however if that is proving really difficult im okay merging as is

@aperfilyev aperfilyev force-pushed the aperfilyev/import-quickfix branch 2 times, most recently from 7282c24 to f96b628 Compare April 8, 2021 20:15
@aperfilyev
Copy link
Collaborator Author

i think you can unit test this similar to how we do the expand intention:

I've tried but it doesn't resolve nor intentions nor quick fixes
Screenshot 2021-04-08 at 23 21 55

Copy link
Collaborator

@veyndan veyndan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome!!!

@aperfilyev
Copy link
Collaborator Author

It seems there are compatibility problems with an older IC-193.7288.26, what should I do?

@AlecKazakova
Copy link
Collaborator

AlecKazakova commented Apr 8, 2021 via email

@aperfilyev
Copy link
Collaborator Author

Yep, 4.1 is indeed on 2020.1 https://developer.android.com/studio/releases#4.1-intellij-idea

@AlecKazakova AlecKazakova merged commit 2fd5fc3 into cashapp:master Apr 9, 2021
@AlecKazakova
Copy link
Collaborator

boom, thanks

@aperfilyev aperfilyev deleted the aperfilyev/import-quickfix branch April 9, 2021 11:38
@ursusursus
Copy link

ursusursus commented Apr 28, 2021

If I may report, it doesn't seem to work for nested classes

data class DocumentId(val value: String)

data class Document(
    val id: DocumentId,
    val type: Type,
) {
    enum class Type {
        CONTRACT, FIN_DOC, WARRANTY_CLAIM, OTHER
    }
}

CREATE TABLE IF NOT EXISTS document (
    id TEXT AS DocumentId NOT NULL, <-- alt enter shows import
    type TEXT AS Document.Type NOT NULL, <-- alt enter here does nothing

    PRIMARY KEY (id, subscriberId)
);

@ursusursus
Copy link

Also, List seems to not include kotlin.collections.List

image

@ursusursus
Copy link

Also, when nested type is used, the parent is grayed out as not use, which is not true

image

@ursusursus
Copy link

Disambiguation is not right

image

Only sk.o2.product.Tariff, sk.tm.mobile.subscriber.Tariff should be visible; others are from modules which are not included, it seems that the list of options is just plain search for "Tariff" everywhere

@JakeWharton
Copy link
Member

Please file new issues if you have reproducible problems with this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Import suggestion on alt+enter of unknown type.
5 participants