-
Notifications
You must be signed in to change notification settings - Fork 202
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
feat: capture diagnostic code from Problem #1750
Conversation
This relates to the grand plan of scala/scala3#14904 and recently forwarding the `diagnosticCode` has been merged in scala/scala3#15565 and also backported so it should show up in the 3.2.x series. While this pr isn't super exciting, it's just making sure we capture the code and forward it, this should unlock _much_ better ways to determine what code actions are available for a given diagnostic. Meaning we don't have to do lovely things like regex on the diagnostic message for Scala 3 diagnostics. NOTE: that this does need some more changes in the build servers before this is usable. So we can wait for those to be merged in if you'd like. - [ ] sbt - sbt/sbt#6998 - [ ] Bloop - scalacenter/bloop#1750 - [ ] Mill - com-lihaoyi/mill#1912 Now if you look at the trace file for a diagnostic you'll see the addition of the code: ``` "diagnostics": [ { "range": { "start": { "line": 9, "character": 15 }, "end": { "line": 9, "character": 19 } }, "severity": 1, "code": "7", "source": "sbt", "message": "Found: (\u001b[32m\"hi\"\u001b[0m : String)\nRequired: Int\n\nThe following import might make progress towards fixing the problem:\n\n import sourcecode.Text.generate\n\n" } ], ``` Refs: scala/scala3#14904
category: String | ||
category: String, | ||
/** Unique code attatched to the diagnostic being reported */ | ||
override val diagnosticCode: Optional[xsbti.DiagnosticCode] |
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.
The override val
here is odd but I believe it's needed because of the signature in Javaland. Is there a better way to do 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.
Looks good to me
Looks like an issue was an old sbt version that didn't use the latest interfaces, but I can't find exactly why this would happen. Maybe some dependencies are added from the current sbt version? |
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.
Looks to be passing! Thanks @ckipp01
This relates to the grand plan of scala/scala3#14904 and recently forwarding the `diagnosticCode` has been merged in scala/scala3#15565 and also backported so it should show up in the 3.2.x series. While this pr isn't super exciting, it's just making sure we capture the code and forward it, this should unlock _much_ better ways to determine what code actions are available for a given diagnostic. Meaning we don't have to do lovely things like regex on the diagnostic message for Scala 3 diagnostics. NOTE: that this does need some more changes in the build servers before this is usable. So we can wait for those to be merged in if you'd like. - [ ] sbt - sbt/sbt#6998 - [ ] Bloop - scalacenter/bloop#1750 - [ ] Mill - com-lihaoyi/mill#1912 Now if you look at the trace file for a diagnostic you'll see the addition of the code: ``` "diagnostics": [ { "range": { "start": { "line": 9, "character": 15 }, "end": { "line": 9, "character": 19 } }, "severity": 1, "code": "7", "source": "sbt", "message": "Found: (\u001b[32m\"hi\"\u001b[0m : String)\nRequired: Int\n\nThe following import might make progress towards fixing the problem:\n\n import sourcecode.Text.generate\n\n" } ], ``` Refs: scala/scala3#14904
This relates to the grand plan of scala/scala3#14904 and recently forwarding the `diagnosticCode` has been merged in scala/scala3#15565 and also backported so it should show up in the 3.2.x series. While this pr isn't super exciting, it's just making sure we capture the code and forward it, this should unlock _much_ better ways to determine what code actions are available for a given diagnostic. Meaning we don't have to do lovely things like regex on the diagnostic message for Scala 3 diagnostics. NOTE: that this does need some more changes in the build servers before this is usable. So we can wait for those to be merged in if you'd like. - [ ] sbt - sbt/sbt#6998 - [ ] Bloop - scalacenter/bloop#1750 - [ ] Mill - com-lihaoyi/mill#1912 Now if you look at the trace file for a diagnostic you'll see the addition of the code: ``` "diagnostics": [ { "range": { "start": { "line": 9, "character": 15 }, "end": { "line": 9, "character": 19 } }, "severity": 1, "code": "7", "source": "sbt", "message": "Found: (\u001b[32m\"hi\"\u001b[0m : String)\nRequired: Int\n\nThe following import might make progress towards fixing the problem:\n\n import sourcecode.Text.generate\n\n" } ], ``` Refs: scala/scala3#14904
Needs scala/scala3#15565 to actually do anything. Although it's not working currently and I have no idea why. Just putting this here to test and tie all together.
Shoot, I just realized I opened this up on a branch and not in my fork 😬 sorry about that.