fix: channel mention display

Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
Infi 2024-12-21 22:17:41 +01:00
parent 1415a7744e
commit 5a794115f4
2 changed files with 7 additions and 1 deletions

View File

@ -89,6 +89,7 @@ import dev.snipme.highlights.model.ColorHighlight
import dev.snipme.highlights.model.SyntaxLanguage
import dev.snipme.highlights.model.SyntaxThemes
import kotlinx.coroutines.launch
import logcat.logcat
import org.intellij.markdown.MarkdownElementTypes
import org.intellij.markdown.MarkdownTokenTypes
import org.intellij.markdown.ast.ASTNode
@ -241,10 +242,15 @@ private fun annotateText(
background = state.colors.clickableBackground
)
)
val channel = RevoltAPI.channelCache[channelId]
val mentionDisplay = channel?.name?.let { name -> "#$name" }
?: "<#$channelId>"
appendInlineContent(JBMAnnotations.JBMBackgroundRoundingStart.tag)
append(mentionDisplay)
appendInlineContent(JBMAnnotations.JBMBackgroundRoundingEnd.tag)
pop()
pop()
}

View File

@ -25,7 +25,7 @@ class ChannelMentionParser : SequentialParser {
result.withNode(
SequentialParser.Node(
start..iterator.index + 1,
RSMElementTypes.USER_MENTION
RSMElementTypes.CHANNEL_MENTION
)
)
}