Skip to content
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

Add error reports info to metals doctor #5683

Merged
merged 9 commits into from
Oct 12, 2023

Conversation

kasiaMarek
Copy link
Contributor

resolves: #5672

doctor-reports

Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice idea! I left a couple small comments. Since we're also changing the structure of the doctor output here we'll also want to bump the DoctorResults.version.

Copy link
Member

@jkciesluk jkciesluk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I'm wondering if for reports which contain scala code in them (eg. CompilerAccess.handleError), can we wrap code in
```scala
...
```
?

@ckipp01 ckipp01 added the affects clients Use this if you are adding a new setting or making a change that will affect clients. label Oct 4, 2023
.map(decode)
.mkString("\n")
}
rc.getReports().map { case TimestampedFile(file, timestamp) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to instead use the target name in the filename? Similar to how we do it with timestamp?

@@ -20,7 +20,7 @@ final case class DoctorResults(

object DoctorResults {
// Version of the Doctor json that is returned.
val version = 4
val version = 5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we bump metals to 1.1.x in this case? What do you think @ckipp01 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will also try to explain all the recent changes in a plugin authors paragraph then

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few comments

Comment on lines 180 to 183
name <- buildTargets
.scalaTarget(buildTargetId)
.map(_.displayName)
.orElse(buildTargets.javaTarget(buildTargetId).map(_.displayName))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name <- buildTargets
.scalaTarget(buildTargetId)
.map(_.displayName)
.orElse(buildTargets.javaTarget(buildTargetId).map(_.displayName))
name <- buildTargets
.info(buildTargetId)
.map(_.displayName))

should be enough

}

case class DoctorVisibilityDidChangeParams(
visible: Boolean
)

object Doctor {
def getErrorReportSummary(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain a bit what this does in a comment?

*/
final case class ErrorReportInfo(
name: String,
timestamp: Long,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sending a timestamp but I wonder if it'd be better to send nicely formatted time-date string instead.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one comment.

Comment on lines 661 to 669
reversed = lines.reverse
index = reversed.indexWhere(_.startsWith(Report.summaryTitle))
if index >= 0
} yield reversed
.slice(0, index)
.reverse
.dropWhile(_ == "")
.map(decode)
.mkString("\n")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reversed = lines.reverse
index = reversed.indexWhere(_.startsWith(Report.summaryTitle))
if index >= 0
} yield reversed
.slice(0, index)
.reverse
.dropWhile(_ == "")
.map(decode)
.mkString("\n")
index = lines.indexWhere(_.startsWith(Report.summaryTitle))
if index >= 0
} yield lines
.slice(index, lines.length)
.takeWhile(_ != "")
.map(decode)
.mkString("\n")

do we need reverse at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use lastIndexWhere if needed.

@kasiaMarek kasiaMarek merged commit cc897ef into scalameta:main Oct 12, 2023
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects clients Use this if you are adding a new setting or making a change that will affect clients.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show error reports in the Doctor UI
4 participants