-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: implement Convert to collect
code action
#6969
base: main
Are you sure you want to change the base?
Conversation
Convert to collect
code action
c542d5a
to
6b4d8c9
Compare
tests/unit/src/test/scala/tests/codeactions/FilterMapToCollectCodeActionSuite.scala
Outdated
Show resolved
Hide resolved
6b4d8c9
to
f4d2a4a
Compare
f4d2a4a
to
87fe644
Compare
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.
One thing I would want to improve is to make sure that the collect actually exist, for that I think we could reshuffle things a bit and use codeAction/resolve.
I haven't added it yet, but I can:
- change your PR to use codeAction/resolve and only verify that collect exists on resolving
- add the codeAction/resolve separately to use this week and let you use it
- if you are interested I can explain exactly what can be done and let you work on that
What do you think?
Overall, I think we can check the symbol with semanticdb and the check for collect using compilers.info() <- if that returns some sensible information we should be fine.
There is also an option of rewriting it to the presentation compiler, but that's a much bigger rewrite.
What do you think?
metals/src/main/scala/scala/meta/internal/metals/codeactions/FilterMapToCollectCodeAction.scala
Outdated
Show resolved
Hide resolved
sorry for late response, i accidentally marked notification to this as None. i'm fine with either approach; (to be honest, doesn't know which way is the best)
that would be great! |
87fe644
to
b0d38bb
Compare
I will try to merge #6978 tomorrow, but it adds the possibility of using codeAction/resolve. We can add something similar to
|
Ok, the other PR is merged, let me know if you have any problems with what I suggested, I can also help finish the PR |
currently stuck on NPE while converting to
I'd be grateful! |
b0d38bb
to
5c4d2a7
Compare
@tgodzik i've rebased and migrated to strangely, while it doesn't happen on my local machine the NPE still seems to happen in CI:
https://github.com/scalameta/metals/actions/runs/12094357358/job/33726319967?pr=6969#step:5:1816 |
override def resolveCodeAction(codeAction: l.CodeAction, token: CancelToken)( | ||
implicit ec: ExecutionContext | ||
): Option[Future[l.CodeAction]] = { | ||
println(codeAction.getData.toJson) |
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.
if data is null then this will throw an exception
metals/src/main/scala/scala/meta/internal/metals/codeactions/FilterMapToCollectCodeAction.scala
Outdated
Show resolved
Hide resolved
…ilterMapToCollectCodeAction.scala Co-authored-by: Tomasz Godzik <tgodzik@users.noreply.github.com>
collect.webm
resolves: scalameta/metals-feature-requests#288