improvement: Suggest to add using as a code action#23079
improvement: Suggest to add using as a code action#23079hamzaremmal merged 1 commit intoscala:mainfrom
Conversation
|
I added patching to "unused import" but by now I'd forgotten the mechanism. I remember being confused by the difference between a patch and an action patch. I see that I added action patches to my Is this a matter of "every message should be a Message"? and every patch should be an action patch in a Message? |
I think so? Especially if we can add a rewrite, we should also add it as an action. |
| ) | ||
| ) | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Could reduce parens by preferring colon syntax. I remember the impedance mismatch of supplying lists when there was always one patch and for action. Scala 2 had CodeAction.apply return a list of one action. If only Scala supported varargs...
There was a problem hiding this comment.
I just saw a deeply nested stack of colons in the parser and that is also a challenge (for me) to read. It happens that the args on the preceding line is supposed to be the unused args1, so there was additional cognitive load.
https://github.com/scala/scala3/blob/main/compiler/src/dotty/tools/dotc/parsing/Parsers.scala#L1803
| | Implicit parameters should be provided with a `using` clause. | ||
| | This code can be rewritten automatically under -rewrite -source 3.7-migration. | ||
| | To disable the warning, please use the following option: | ||
| | To disable the warning, please use the following option: |
There was a problem hiding this comment.
My editor removes the space and I couldn't be bothered to find the setting responsible for it :S
This should add the code action to both Metals and Intellij. I will try to go over the existing rewrites to see if we can add more actions easily. Fixes scala#23071

This should add the code action to both Metals and Intellij.
I will try to go over the existing rewrites to see if we can add more actions easily.
Fixes #23071