Closed vasilmkd closed 2 months ago
Furthermore, the information returned by offset
in JavaPosition
is actually the column information, not the offset from the beginning of the file.
https://github.com/sbt/zinc/blob/4eacff2a9bf5c8750bfc5096955065ce67f4e68a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/javac/JavaErrorParser.scala#L185-L196 https://github.com/sbt/zinc/blob/4eacff2a9bf5c8750bfc5096955065ce67f4e68a/internal/zinc-compile-core/src/main/scala/sbt/internal/inc/javac/JavaErrorParser.scala#L295-L296
getOffset
is called on the contents of the error message, not the contents of the file.
IntelliJ IDEA expects compiler error messages to be reported with a
(line, column)
pair.xsbti.Position
instances produced for error messages coming fromjavac
do not contain a value forpointer
.https://youtrack.jetbrains.com/issue/SCL-22799/Missing-Line-and-Column-Info-in-Compilation-Error-Message-for-Java-SBT-project
Technically, there is enough information to calculate this, by combining the
line
andoffset
information. But this requires reading the source file from disk, which I'm trying to avoid.At the moment, both
sbt.internal.inc.javac.DiagnosticsReporter.PositionImpl
andsbt.internal.inc.javac.JavaPosition
implementdef pointer: Optional[Integer] = o2jo(None)
.It should be possible to parse this information and include it in the
Position
instances.