-
Notifications
You must be signed in to change notification settings - Fork 540
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
Conversation
|
||
override fun getText() = INTENTION_EXPAND_COLUMN_NAMES_TEXT | ||
|
||
override fun isAvailable(project: Project, editor: Editor?, psiFile: PsiFile?) = true |
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.
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) |
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.
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()) |
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 can be
val selectStatement = PsiTreeUtil.findElementOfClassAtOffset(file, offset, SqliteSelectStmt::class.java, false)
which could probably be wrapped into a nice extension function on PsiFile
Closes #812 |
b0a62ee
to
933ab4a
Compare
@AlecStrong PTAL |
hell yea awesome |
Closes #812