mirror of https://github.com/sbt/sbt.git
fix: Filter out JAR paths in BSP diagnostics on Windows (#8482)
When Java compiler generates warnings about missing annotations from JAR files, the path format is jar:file:///C:/... which causes InvalidPathException on Windows due to the : character. The fix filters out jar: paths in toDocument(), similar to how fake positions like <macro> are already filtered out. This prevents the exception and allows compilation to continue. Diagnostics for files inside JARs are not shown in the IDE, which is correct behavior since they cannot be edited. Fixes #7665 Generated-by: Cascade (AI pair programmer)
This commit is contained in:
parent
61899ecd16
commit
4fba87a757
|
|
@ -92,9 +92,11 @@ final class BuildServerReporterImpl(
|
|||
private val problemsByFile = mutable.Map[Path, Vector[Problem]]()
|
||||
|
||||
// sometimes the compiler returns a fake position such as <macro>
|
||||
// on Windows, this causes InvalidPathException (see #5994 and #6720)
|
||||
// or a JAR file path like jar:file:///C:/...
|
||||
// on Windows, this causes InvalidPathException (see #5994, #6720, and #7665)
|
||||
private def toDocument(ref: VirtualFileRef): Option[TextDocumentIdentifier] =
|
||||
if (ref.id().contains("<")) None
|
||||
val id = ref.id()
|
||||
if id.contains("<") || id.startsWith("jar:") then None
|
||||
else Some(TextDocumentIdentifier(converter.toPath(ref).toUri))
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue