-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[WIP] #1579 Adapt the sbt bridge for the new error message #1646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think it should present the same output as dotc. We worked hard to make sure that the output from dotc is readable and well separated such that it is easy to know where errors end and begin. There's no point in better error messages if you can't tell where one starts and the other begins 😃 Instead of implementing a "new" reporter, I would look at adapting the Thus you've eliminated the need for maintaining two reporters and improvements made to |
Since we have little to no control over the sbt-API, it is possible that you'll need to for instance give sbt an empty position so that you can reuse the one that the |
@felixmulder thanks for your feedback and suggestions. |
@felixmulder I've updated PR, now output is like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow looks awesome! :)
I'd rather have the methods you moved be a part of the ConsoleReporter
class since that is then extensible by other people - who probably have different usecases than you and me. Could you move them back please? (to solve the issue of being able to call it's functions I'd put a private val consoleReporter = new ConsoleReporter()
in the DelegatingReporter
)
Otherwise, this looks great and I think we should merge it ASAP!
Or you know what - I see the point of moving them out into a separate object. Keep them separate - but make it a I'd call the trait something like
|
|
||
import scala.collection.mutable | ||
|
||
object MessageUtils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this guy becomes trait MessageRendering
(render(before), render(after), maxLen) | ||
} | ||
|
||
def columnMarker(pos: SourcePosition, offset: Int)(implicit ctx: Context):String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after :
def explanation(m: Message)(implicit ctx: Context): String = { | ||
val sb = new StringBuilder(hl"""| | ||
|${Blue("Explanation")} | ||
|${Blue("===========")}""".stripMargin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird indentation here, ident under the |
signs
sb.toString | ||
} | ||
|
||
def diagnosticLevel(cont: MessageContainer):String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space after :
here as well
Done |
Great job! We really appreciate this PR as it greatly improves the experience when using the sbt-dotty plugin or the dotty-example-project 🎉 |
I started adaptation of sbt bridge.
Right now I have following output for next samples:
case class Foo
results in (with explain):
results in (without explain):
println("msg", 123, None)
results in (with explain):
results in (without explain):
results in (with explain):
results in (without explain):
At this moment I would like to receive suggestions about errors output format:
should it be the same as used by dotty or proposed one is acceptable? (I opt for second because of sbt messages decoration)