Skip to content

Commit

Permalink
Avoid duplicate suppress warning suggestions through new API method.
Browse files Browse the repository at this point in the history
- Implement alreadyHasProposal to avoid duplicates

Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Jan 16, 2025
1 parent 78d72ee commit 2102508
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,14 @@ protected ProposalKindWrapper createFixCorrectionProposal(IProposableFix fix, IC
return CodeActionHandler.wrap(proposal, CodeActionKind.QuickFix);
}

@Override
protected boolean alreadyHasProposal(Collection<ProposalKindWrapper> proposals, String warningToken) {
for (ProposalKindWrapper element : proposals) {
if (element.getProposal() instanceof SuppressWarningsProposalCore swp && warningToken.equals(swp.getWarningToken())) {
return true; // only one at a time
}
}
return false;
}

}

0 comments on commit 2102508

Please sign in to comment.