-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
153 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
internal/zinc-compile-core/src/main/scala/sbt/internal/inc/ProblemStringFormats.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package sbt | ||
package internal | ||
package inc | ||
|
||
import xsbti.Problem | ||
import sbt.util.ShowLines | ||
import sbt.util.InterfaceUtil.jo2o | ||
|
||
/** | ||
* The string representation of compiler warnings and error messages, | ||
* used by LoggerReporter and the logging system. | ||
*/ | ||
trait ProblemStringFormats { | ||
implicit lazy val ProblemStringFormat: ShowLines[Problem] = new ShowLines[Problem] { | ||
def showLines(p: Problem): Seq[String] = | ||
p match { | ||
case p if !p.position.sourcePath.isPresent && !p.position.line.isPresent => Vector(p.message) | ||
case _ => | ||
val pos = p.position | ||
val sourcePrefix = jo2o(pos.sourcePath).getOrElse("") | ||
val columnNumber = jo2o(pos.pointer).map(_.toInt + 1).getOrElse(1) | ||
val lineNumberString = jo2o(pos.line).map(":" + _ + ":" + columnNumber + ":").getOrElse(":") + " " | ||
val line1 = sourcePrefix + lineNumberString + p.message | ||
val lineContent = pos.lineContent | ||
if (!lineContent.isEmpty) { | ||
Vector(line1, lineContent) ++ | ||
(for { space <- jo2o(pos.pointerSpace) } | ||
yield (space + "^")).toVector // pointer to the column position of the error/warning | ||
} else Vector(line1) | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/Build.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
internal/zinc-scripted/src/main/contraband-scala/sbt/internal/inctest/BuildFormats.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.