-
Notifications
You must be signed in to change notification settings - Fork 332
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: implement 'convert to named lambda parameters' code action #6669
base: main
Are you sure you want to change the base?
feat: implement 'convert to named lambda parameters' code action #6669
Conversation
6fd2149
to
601c8f7
Compare
601c8f7
to
0eabc2e
Compare
I wonder if we need to add a new method for this. Ideally each new code action feature would be able to reuse an existing method. Would it possible to implements it with the scalameta parser only? We could use go to type definition on wildcards to obtain its type symbol and construct a new name out of it. Alternatively, we could add a more universal method such as (ActionType interface should be binary compatible I think 🤔 otherwise we can use a string and some separate config parameter) CompletableFuture<List<TextEdit>> codeAction(OffsetParams params, ActionType actionType) { Adding a new method for each code action causes the interfaces to bloat and more complex to the users, which is why I am hesitant to continue with that. |
Using only the scalameta parser would be ideal, but my concern is that it isn't that obvious how to find the reference of the correct wildcard parameter. With |
There is only one, no? Not sure if I understand 🤔 |
I mean that there could be multiple wildcard params for one lambda and there can be nested wildcard lambdas. Plus the rules for resolving a wildcard param into its owning lambda are not 100% clear to me. In |
Ach, if it's more difficult with the scalameta parser then do not worry about that. I would however try to add a more universal interface for code actions |
0eabc2e
to
746a923
Compare
Add a code action that converts a wildcard lambda to a lambda with named parameters. It supports Scala 3 only at the moment.
e.g.
Disclaimer: I'm not sure what I'm doing 😃