Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add intention to expand wildcard in select statement into column names #822

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

Merged
merged 1 commit into from
May 3, 2018

Conversation

Egorand
Copy link
Collaborator

@Egorand Egorand commented May 2, 2018

Closes #812


override fun getText() = INTENTION_EXPAND_COLUMN_NAMES_TEXT

override fun isAvailable(project: Project, editor: Editor?, psiFile: PsiFile?) = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

psiFile is SqlDelightFile probably so we can be typesafe below


override fun invoke(project: Project, editor: Editor, psiFile: PsiFile) {
ApplicationManager.getApplication().invokeLater {
expandWildcard(project, editor, psiFile.virtualFile)
Copy link
Collaborator

Choose a reason for hiding this comment

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

pass psiFile as SqlDelightFile here instead of the virtualfile.

object : WriteCommandAction.Simple<Project>(project) {
override fun run() {
val file = PsiManager.getInstance(project).findFile(virtualFile) as SqlDelightFile
val selectStatement = findStatementAtCaret(editor, file.findChildrenOfType())
Copy link
Collaborator

Choose a reason for hiding this comment

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

this can be

val selectStatement = PsiTreeUtil.findElementOfClassAtOffset(file, offset, SqliteSelectStmt::class.java, false)

which could probably be wrapped into a nice extension function on PsiFile

@AlecKazakova
Copy link
Collaborator

Closes #812

@Egorand Egorand force-pushed the egorand/expand-columns-intention branch from b0a62ee to 933ab4a Compare May 3, 2018 16:26
@Egorand
Copy link
Collaborator Author

Egorand commented May 3, 2018

@AlecStrong PTAL

@AlecKazakova AlecKazakova merged commit 3f55f81 into master May 3, 2018
@AlecKazakova
Copy link
Collaborator

hell yea awesome

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

Successfully merging this pull request may close these issues.

2 participants