Skip to content

Commit

Permalink
fix: AutoCrud Action only available when editor has selection
Browse files Browse the repository at this point in the history
  • Loading branch information
iptton committed Aug 9, 2023
1 parent 38aa95f commit cf49bd1
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -20,6 +20,12 @@ class AutoCrudAction : AbstractChatIntention() {
override fun getText(): String = AutoDevBundle.message("intentions.crud.new.name")
override fun getFamilyName(): String = AutoDevBundle.message("intentions.crud.new.family.name")


override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?): Boolean {
val isEnvironmentAvailable = super.isAvailable(project, editor, file)
return isEnvironmentAvailable && editor?.selectionModel?.hasSelection() == true
}

override fun invoke(project: Project, editor: Editor?, file: PsiFile?) {
if (editor == null || file == null) return

Expand Down

0 comments on commit cf49bd1

Please sign in to comment.