Skip to content

Commit

Permalink
Clip diagnostic hints past certain length
Browse files Browse the repository at this point in the history
  • Loading branch information
enigmurl committed Oct 21, 2024
1 parent f129218 commit 03a651e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/kotlin/lean4ij/language/InlayHints.kt
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,17 @@ class InlayTextAttributes: UnmodifiableTextAttributes() {

}

class InlayRenderer(info: HighlightInfo): HintRenderer(info.description) {
class InlayRenderer(info: HighlightInfo): HintRenderer(clipDescription(info.description)) {
companion object {
const val MAX_LEN = 140;

Check notice on line 415 in src/main/kotlin/lean4ij/language/InlayHints.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'MAX_LEN' could be private

Check warning on line 415 in src/main/kotlin/lean4ij/language/InlayHints.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Redundant semicolon

Redundant semicolon
fun clipDescription(desc: String): String {
return if (desc.length < MAX_LEN) {
desc
} else {
desc.substring(0, MAX_LEN - 3) + "..."
}
}
}
override fun getTextAttributes(editor: Editor): TextAttributes? {

Check warning on line 424 in src/main/kotlin/lean4ij/language/InlayHints.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Redundant nullable return type

'getTextAttributes' always returns non-null type
return InlayTextAttributes()
}
Expand Down

0 comments on commit 03a651e

Please sign in to comment.