Skip to content

Commit

Permalink
[cbh] Do not show empty error highlighting messages when compiler hig…
Browse files Browse the repository at this point in the history
…hlighting is on #SCL-22848 fixed

- We still show messages not associated with any source file at position 1:1 in all source files (when opened). This will be addressed separately.
  • Loading branch information
vasilmkd committed Nov 20, 2024
1 parent 0cc0897 commit 1ac37f7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ private object CompilerMessages {
case bspMessageTemplate(_, position) => position
case line => line
}
trimmedMessage.stripSuffix(suffix).trim
val noSuffix = trimmedMessage.stripSuffix(suffix).trim
if (noSuffix.isBlank) trimmedMessage else noSuffix
}

def isUnusedImport(description: String): Boolean =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,27 @@ class CompilerMessagesTest {
val actual = CompilerMessages.description(originalMessage)
assertEquals(expected, actual)
}

@Test
def deprecationWarningsMessage(): Unit = {
val originalMessage = "there were 4 deprecation warnings; re-run with -deprecation for details\n\n"
val expected = "there were 4 deprecation warnings; re-run with -deprecation for details"
val actual = CompilerMessages.description(originalMessage)
assertEquals(expected, actual)
}

@Test
def oneLineMessage(): Unit = {
val originalMessage = "This is a one line error message"
val actual = CompilerMessages.description(originalMessage)
assertEquals(originalMessage, actual)
}

@Test
def blankAfterProcessing(): Unit = {
val originalMessage = "\n\nSome message \n "
val expected = "Some message"
val actual = CompilerMessages.description(originalMessage)
assertEquals(expected, actual)
}
}

0 comments on commit 1ac37f7

Please sign in to comment.