-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
bump compiler-interface and capture the diagnosticCode #15565
Conversation
At the moment this is just testing a bit. I see you already have a test PR to bump zinc in com-lihaoyi#1845 but one of the things that this brings in is the changes to `Problem` I made in sbt/sbt#6874 that expose the diagnostic code of the diagnostic coming from dotc. I have been doing some work on that on the compiler side in scala/scala3#15565 and wanted to try it out with Mill. I tried to mimic the way you currently have it set up, so let me know if it's not the direction you'd want to go. However, the idea here would be that the diagnostic code is forwarded when diagnostics are published via BSP so that Metals could then capture that code and know what code actions to offer. You can see more of the big picture in scala/scala3#14904.
At the moment this is just testing a bit. I see you already have a test PR to bump zinc in com-lihaoyi#1845 but one of the things that this brings in is the changes to `Problem` I made in sbt/sbt#6874 that expose the diagnostic code of the diagnostic coming from dotc. I have been doing some work on that on the compiler side in scala/scala3#15565 and wanted to try it out with Mill. I tried to mimic the way you currently have it set up, so let me know if it's not the direction you'd want to go. However, the idea here would be that the diagnostic code is forwarded when diagnostics are published via BSP so that Metals could then capture that code and know what code actions to offer. You can see more of the big picture in scala/scala3#14904.
Looking at the [commit](scala@fa063b6) that added 1.6.2 I believe I have everything updated that needs to be. I am updating this because it's needed for a test that I'm adding in scala#15565, but thought it'd be best to do this bump in a separate pr.
Looking at the [commit](scala@fa063b6) that added 1.6.2 I believe I have everything updated that needs to be. I am updating this because it's needed for a test that I'm adding in scala#15565, but thought it'd be best to do this bump in a separate pr.
Looking at the [commit](scala@fa063b6) that added 1.6.2 I believe I have everything updated that needs to be. I am updating this because it's needed for a test that I'm adding in scala#15565, but thought it'd be best to do this bump in a separate pr.
NOTE: It's important that in `Problem` we don't construct the actual `DiagnosticCode` _unless_ the method is called to get it. By doing this we keep compatibility ensuring that older build tools can still use the bridge just fine. That's what the `sbt-test/sbt-bridge` tests ensuring that this is still usable by an older tool using the old `Problem`. This then unlocks forwarding the diagnostic code on for tools to use. refs: scala#14904
Btw just to make sure I understand the label @dwijnand. So this can't get merged until 3.2.x is released? |
I'll bring this up at the meeting (cc @Kordyjan). Generally I would prefer for such a change not to ship in a patch release. So, either we end up needing an RC4 for 3.2.0, in which case I would look to landing this in main and backporting it to https://github.com/lampepfl/dotty/commits/release-3.2.0 so it can be part of 3.2.0-RC4+. Or we wait keep it unmerged until main is targeting for 3.3.0 (as opposed to the 3.2.x releases we'll be doing). Unless we decide let's just ship this in a random patch release. |
At the moment this is just testing a bit. I see you already have a test PR to bump zinc in com-lihaoyi#1845 but one of the things that this brings in is the changes to `Problem` I made in sbt/sbt#6874 that expose the diagnostic code of the diagnostic coming from dotc. I have been doing some work on that on the compiler side in scala/scala3#15565 and wanted to try it out with Mill. I tried to mimic the way you currently have it set up, so let me know if it's not the direction you'd want to go. However, the idea here would be that the diagnostic code is forwarded when diagnostics are published via BSP so that Metals could then capture that code and know what code actions to offer. You can see more of the big picture in scala/scala3#14904.
This change is a continuation of the work that was done in sbt#6874 to allow the Scala 3 compiler to forward the `diagnosticCode` of an error as well as the other normal things. This change in dotty was merged in scala/scala3#15565 and also backported so it will be in the 3.2.x series release. This change captures the `diagnosticCode` and forwards it on via BSP so that tools like Metals can can use this code. You can see this in the BSP trace now for a diagnostic: For example with some code that contains the following: ```scala val x: Int = "hi" ``` You'll see the code in the BSP diagnostic: ``` "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" } ] ``` Co-authored-by: Adrien Piquerez <[email protected]> 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
This change is a continuation of the work that was done in sbt#6874 to allow the Scala 3 compiler to forward the `diagnosticCode` of an error as well as the other normal things. This change in dotty was merged in scala/scala3#15565 and also backported so it will be in the 3.2.x series release. This change captures the `diagnosticCode` and forwards it on via BSP so that tools like Metals can can use this code. You can see this in the BSP trace now for a diagnostic: For example with some code that contains the following: ```scala val x: Int = "hi" ``` You'll see the code in the BSP diagnostic: ``` "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" } ] ``` Co-authored-by: Adrien Piquerez <[email protected]> Refs: scala/scala3#14904
This change is a continuation of the work that was done in sbt#6874 to allow the Scala 3 compiler to forward the `diagnosticCode` of an error as well as the other normal things. This change in dotty was merged in scala/scala3#15565 and also backported so it will be in the 3.2.x series release. This change captures the `diagnosticCode` and forwards it on via BSP so that tools like Metals can can use this code. You can see this in the BSP trace now for a diagnostic: For example with some code that contains the following: ```scala val x: Int = "hi" ``` You'll see the code in the BSP diagnostic: ``` "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" } ] ``` Co-authored-by: Adrien Piquerez <[email protected]> Refs: scala/scala3#14904
At the moment this is just testing a bit. I see you already have a test PR to bump zinc in com-lihaoyi#1845 but one of the things that this brings in is the changes to `Problem` I made in sbt/sbt#6874 that expose the diagnostic code of the diagnostic coming from dotc. I have been doing some work on that on the compiler side in scala/scala3#15565 and wanted to try it out with Mill. I tried to mimic the way you currently have it set up, so let me know if it's not the direction you'd want to go. However, the idea here would be that the diagnostic code is forwarded when diagnostics are published via BSP so that Metals could then capture that code and know what code actions to offer. You can see more of the big picture in scala/scala3#14904.
At the moment this is just testing a bit. I see you already have a test PR to bump zinc in com-lihaoyi#1845 but one of the things that this brings in is the changes to `Problem` I made in sbt/sbt#6874 that expose the diagnostic code of the diagnostic coming from dotc. I have been doing some work on that on the compiler side in scala/scala3#15565 and wanted to try it out with Mill. I tried to mimic the way you currently have it set up, so let me know if it's not the direction you'd want to go. However, the idea here would be that the diagnostic code is forwarded when diagnostics are published via BSP so that Metals could then capture that code and know what code actions to offer. You can see more of the big picture in scala/scala3#14904.
Newer zinc brings in is the changes to `Problem` I made in sbt/sbt#6874 that expose the diagnostic code of the diagnostic coming from dotc. I have been doing some work on that on the compiler side in scala/scala3#15565 and wanted to try it out with Mill. I tried to mimic the way you currently have it set up, so let me know if it's not the direction you'd want to go. However, the idea here would be that the diagnostic code is forwarded when diagnostics are published via BSP so that Metals could then capture that code and know what code actions to offer. You can see more of the big picture in scala/scala3#14904. Pull request: #1912
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
NOTE: It's important that in
Problem
we don't construct the actualDiagnosticCode
unless the method is called to get it. By doing this wekeep compatibility ensuring that older build tools can still use the
bridge just fine. That's what the
sbt-test/sbt-bridge
tests ensuringthat this is still usable by an older tool using the old
Problem
. Thisthen unlocks forwarding the diagnostic code on for tools to use.
refs: #14904