Skip to content

Fix "Add placeholders for all missing methods" action - #5164

Merged
Aster89 merged 6 commits into
haskell:masterfrom
Aster89:repro
Nov 7, 2026
Merged

Aster89 merged 6 commits into
haskell:masterfrom
Aster89:repro

Conversation

@Aster89

@Aster89 Aster89 commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

This PR consists of 4 commits, the last one of which actually implements the solution to the bug. See commit messages for details.


Fixes #5165


  • I read and followed our AI policy
  • I proposed a solution draft in the corresponding issue (for non-trivial changes and new features)
    • This is especially encouraged for new contributors

@Aster89 Aster89 changed the title Repro of issue I haven't created yet Fix "Add placeholders for all missing methods" action Nov 3, 2026
@Aster89 Aster89 self-assigned this Nov 4, 2026
@Aster89
Aster89 force-pushed the repro branch 2 times, most recently from 3110293 to b8ddbdf Compare November 6, 2026 14:17
@Aster89
Aster89 marked this pull request as ready for review November 6, 2026 14:25
@Aster89
Aster89 requested review from crtschin and jhrcek and removed request for crtschin November 6, 2026 14:25

@fendor fendor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some nitpicks.

The commit message:

Implement solution
This commit actually implements the solution to https://github.com/haskell/haskell-> language-server/issues/5165:

Is not a great commit message, please write what the commit does :)

@Aster89

Aster89 commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

Is not a great commit message, please write what the commit does :)

@fendor, there's a list with 4 steps, don't you see it?

@fendor

fendor commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

there's a list with 4 steps, don't you see it?

The list is good, the title is not :) I should be able to guess what a commit is about by just reading the title of the commit message.

See https://cbea.ms/git-commit/

…hods"

In other words, prevent _"Add placeholders for all missing methods"_
action from erroneously inserting already implemented methods (hence
duplicating them), thus fixing haskell#5165.

Here's the approach:

1. extract the `instance` declarations from the "renamed AST",
2. detect the (only) one that overlaps with the given `Range`,
3. extract the methods defined in this `instance`,
4. `filter` such methods out of those "all the methods" that the plugin
   asks GHC for.
@Aster89
Aster89 enabled auto-merge (squash) November 7, 2026 16:59
@Aster89
Aster89 merged commit b2522ea into haskell:master Nov 7, 2026
42 checks passed
@Aster89
Aster89 deleted the repro branch November 7, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hls-class-plugin's "Add placeholders for all missing methods" action erroneously inserts also already implemented methods

2 participants