-
Notifications
You must be signed in to change notification settings - Fork 384
(GRAM, PSI, FMT): introduce foreign_mod_body and mod_body #358
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
Conversation
| methods = [ | ||
| // FIXME(jajakobyly): This method is tagged as @Nullable while we want @NotNull | ||
| itemList = "/mod_body/item_" | ||
| ] |
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 overall problem here is, that file_mod_item extends mod_item but the former doesn't have anything like a mod_body. I decided to unify their apis (so users do not have to differentiate between mod and file mod) by creating artificial getItemList method on mod_item.
|
I am not happy about this Maybe we can make |
|
Seems reasonable. Implement this here? |
Definitely not here, I predict a massive fallout after this change, especially in the resolve area. It would be cool if you implement this, but I am not sure about the design, so expect quite a bit of back and forth. If you don't want to mess with it, I think I can fix this tomorrow. I'll be glad to accept |
|
I think you can take on this refactoring. Also the |
|
Ok, I really hope that I have not underestimate the amount of work the refactoring :) |
|
Are there any reasons for the new PSI element ( |
|
@matklad no, it's bad idea to fix indenter and expand-selection by introduction of the new PSI node. Can hardly spot any other reason for it to be introduced. |
|
@alexeykudinkin and what are the benefits of not introducing the PSI node? I don't feel that either way is significantly better, but simpler formatter is a nice to have. |
Mitigating introduction of the useless abstraction is the greatest benefit. The problem is with formatter & expand-selection not with the node. |
|
Sounds reasonable, @jajakobyly what do you think? |
|
I've looked at Java and Kotlin implementations, and the interesting pattern is that That is, in Java I think this is a reasonable approach. Based on this, in Rust there should be separate body elements for structs, enums and methods. Mods should not have a separate |
|
Your arguments sound reasonable for me too, though I prefer introducing separate PSI nodes for such things as Formatter can be easily adopted to the lack of So should I narrow this PR to |
|
No description provided.