-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
hls-class-plugin - Add placeholders for all class methods #3394
Conversation
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.
I don't have enough time at least for now, sorry for the delay. This is some minor comment. Hopefully I could have some timespan soon for a fuller review.
$ fmap (filter (\(bind, _) -> bind `notElem` implemented)) | ||
$ minDefToMethodGroups range sigs | ||
$ classMinimalDef cls | ||
$ nubBy (\(_, x) (_,y) -> x == y) |
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 performance is probably better with nubOrdOn snd
instead of this.
$ nubBy (\(_, x) (_,y) -> x == y) | |
$ nubOrdOn snd |
Maybe @July541 could take a look? |
I can do a review this weekend if @Ailrun is busy still. |
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.
Many thanks for your improvement! please add tests for it robust.
class-plugin relies on ghc diagnostic to produce code actions, you can't have code actions for all instances under the current mechanism. haskell-language-server/plugins/hls-class-plugin/src/Ide/Plugin/Class/CodeAction.hs Lines 207 to 208 in dfd8f0b
|
Thanks for review, @July541 👍
Yeah I noticed that, I was just wondering if there's a nicer way to do that 🤔 But I don't know GHC codebase that well (not to say at all) 😅 |
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.
Everything looks fine, thank you for your work!
I think we can ignore diagnostics and emit the code actions directly. |
Added code action for creating placeholders for all not implemented class methods. Action is skipped when only required methods are missing to avoid duplication.
Currently it's available only when minimal class definition is not met, wasn't sure how to locate class instances 🤔
Close #3017