Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,68 +112,61 @@ interface Colors {
@JvmField
val DARK_SPACER: NamedTextColor = NamedTextColor.DARK_GRAY

// -------------------- Prefix -------------------- //

/**
* The default prefix color (#3b92d1).
* Applied to all prefixes for consistency across Surf plugins.
*/
@JvmField
val PREFIX_COLOR: TextColor = PRIMARY

Comment on lines 117 to 123

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

KDoc for PREFIX_COLOR says it is "applied to all prefixes", but INFO_PREFIX/SUCCESS_PREFIX/WARNING_PREFIX/ERROR_PREFIX now call buildPrefix(INFO/SUCCESS/WARNING/ERROR) instead of PREFIX_COLOR. Either update the KDoc to reflect the per-type coloring, or pass PREFIX_COLOR to buildPrefix for all prefixes if the intent is consistency.

Copilot uses AI. Check for mistakes.
// -------------------- Default Colors -------------------- //
/**
* The default prefix character ('»').
*/
@Suppress("MayBeConstant")
@JvmField
val PREFIX_CHARACTER = '»'

private fun buildPrefix(color: TextColor) = buildText {
text(PREFIX_CHARACTER, color)
appendSpace()
darkSpacer("|")
appendSpace()
}

/**
* The default prefix used across all Surf plugins, ensuring a recognizable and uniform
* identifier in messages.
*/
@JvmField
val PREFIX: Component = buildText {
spacer("»")
appendSpace()
}
val PREFIX: Component = buildPrefix(PREFIX_COLOR)

/**
* The default info prefix used in informational messages.
*/
@JvmField
val INFO_PREFIX: Component = buildText {
spacer("[")
info("ℹ")
spacer("]")
appendSpace()
}
val INFO_PREFIX: Component = buildPrefix(INFO)

/**
* The default success prefix used in success messages.
*/
@JvmField
val SUCCESS_PREFIX: Component = buildText {
spacer("[")
success("✔")
spacer("]")
appendSpace()
}
val SUCCESS_PREFIX: Component = buildPrefix(SUCCESS)

/**
* The default warning prefix used in warning messages.
*/
@JvmField
val WARNING_PREFIX: Component = buildText {
spacer("[")
warning("⚠")
spacer("]")
appendSpace()
}
val WARNING_PREFIX: Component = buildPrefix(WARNING)

/**
* The default error prefix used in error messages.
*/
@JvmField
val ERROR_PREFIX: Component = buildText {
spacer("[")
error("✖")
spacer("]")
appendSpace()
}
val ERROR_PREFIX: Component = buildPrefix(ERROR)

// -------------------- Default Colors -------------------- //

/**
* Represents the color black.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ interface SurfComponentBuilder : TextComponent.Builder, ComponentBuilderColors {
suspend fun appendNewlineAsync(block: suspend SurfComponentBuilder.() -> Unit) =
appendNewline().appendAsync(block)

@Deprecated("Use TYPE specific functions")
fun appendNewPrefixedLine(block: SurfComponentBuilder.() -> Unit) =
appendNewPrefixedLine().append(block)
Comment on lines +57 to 59

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

The @deprecated message "Use TYPE specific functions" is unclear to API consumers (what is "TYPE" and which functions should they migrate to?). Consider making the message explicit (e.g., refer to appendNewInfoPrefixedLine/appendNewSuccessPrefixedLine/etc.) so the deprecation warning is actionable.

Copilot uses AI. Check for mistakes.

@Deprecated("Use TYPE specific functions")
suspend fun appendNewPrefixedLineAsync(block: suspend SurfComponentBuilder.() -> Unit) =
appendNewPrefixedLine().appendAsync(block)
Comment on lines +61 to 63

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

Same as above: the deprecation message is not actionable. If appendNewPrefixedLineAsync is being replaced by type-specific async helpers, the message should point to the concrete replacements to avoid confusing downstream plugin authors.

Copilot uses AI. Check for mistakes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import net.kyori.adventure.text.format.TextDecoration
interface ErrorComponentBuilderColor : ComponentBuilderColor {
fun SurfComponentBuilder.appendErrorPrefix() = append(Colors.ERROR_PREFIX)
fun SurfComponentBuilder.appendNewErrorPrefixedLine() = appendNewline().appendErrorPrefix()
suspend fun SurfComponentBuilder.appendNewErrorPrefixedLineAsync(block: suspend SurfComponentBuilder.() -> Unit) =
appendNewline().appendErrorPrefix().appendAsync(block)

fun SurfComponentBuilder.error(text: String, vararg decoration: TextDecoration) =
coloredComponent(text, Colors.ERROR, *decoration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import net.kyori.adventure.text.format.TextDecoration
interface InfoComponentBuilderColor : ComponentBuilderColor {
fun SurfComponentBuilder.appendInfoPrefix() = append(Colors.INFO_PREFIX)
fun SurfComponentBuilder.appendNewInfoPrefixedLine() = appendNewline().appendInfoPrefix()
suspend fun SurfComponentBuilder.appendNewInfoPrefixedLineAsync(block: suspend SurfComponentBuilder.() -> Unit) =
appendNewline().appendInfoPrefix().appendAsync(block)

fun SurfComponentBuilder.info(text: String, vararg decoration: TextDecoration) =
coloredComponent(text, Colors.INFO, *decoration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import net.kyori.adventure.text.format.TextDecoration
interface SuccessComponentBuilderColor : ComponentBuilderColor {
fun SurfComponentBuilder.appendSuccessPrefix() = append(Colors.SUCCESS_PREFIX)
fun SurfComponentBuilder.appendNewSuccessPrefixedLine() = appendNewline().appendSuccessPrefix()
suspend fun SurfComponentBuilder.appendNewSuccessPrefixedLineAsync(block: suspend SurfComponentBuilder.() -> Unit) =
appendNewline().appendSuccessPrefix().appendAsync(block)

fun SurfComponentBuilder.success(text: String, vararg decoration: TextDecoration) =
coloredComponent(text, Colors.SUCCESS, *decoration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import net.kyori.adventure.text.format.TextDecoration
interface WarningComponentBuilderColor : ComponentBuilderColor {
fun SurfComponentBuilder.appendWarningPrefix() = append(Colors.WARNING_PREFIX)
fun SurfComponentBuilder.appendNewWarningPrefixedLine() = appendNewline().appendWarningPrefix()
suspend fun SurfComponentBuilder.appendNewWarningPrefixedLineAsync(block: suspend SurfComponentBuilder.() -> Unit) =
appendNewline().appendWarningPrefix().appendAsync(block)

fun SurfComponentBuilder.warning(text: String, vararg decoration: TextDecoration) =
coloredComponent(text, Colors.WARNING, *decoration)
Expand Down
Loading