-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
348 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitsExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.github.blarc.ai.commits.intellij.plugin | ||
|
||
import com.github.blarc.ai.commits.intellij.plugin.AICommitsBundle.message | ||
import com.intellij.openapi.ui.ValidationInfo | ||
import com.intellij.ui.layout.ValidationInfoBuilder | ||
import com.intellij.util.ui.ColumnInfo | ||
|
||
fun <T> createColumn(name: String, formatter: (T) -> String) : ColumnInfo<T, String> { | ||
return object : ColumnInfo<T, String>(name) { | ||
override fun valueOf(item: T): String { | ||
return formatter(item) | ||
} | ||
} | ||
} | ||
|
||
fun ValidationInfoBuilder.notBlank(value: String): ValidationInfo? = | ||
if (value.isBlank()) error(message("validation.required")) else null | ||
|
||
fun ValidationInfoBuilder.unique(value: String, existingValues: Set<String>): ValidationInfo? = | ||
if (existingValues.contains(value)) error(message("validation.unique")) else null | ||
|
||
fun ValidationInfoBuilder.isLong(value: String): ValidationInfo? { | ||
if (value.isBlank()){ | ||
return null | ||
} | ||
|
||
value.toLongOrNull().let { | ||
if (it == null) { | ||
return error(message("validation.number")) | ||
} else { | ||
return null | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/prompt/Prompt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.github.blarc.ai.commits.intellij.plugin.settings.prompt | ||
|
||
data class Prompt( | ||
var name: String = "", | ||
var description: String = "", | ||
var content: String = "", | ||
var canBeChanged: Boolean = true | ||
) |
Oops, something went wrong.