harper
harper copied to clipboard
feat: add `RemovePrefix` and `RemoveSuffix` to `Suggestion`
Issues
N/A
Description
While working on the "for free of charge" linter I realized it was not the first time a Suggestion involved chopping off the start or end of the matched Span.
Normally I do replace_with_match_case with a string literal, but this can change embedded whitespace from spaces to line breaks or vice versa. I'm also never 100% sure how all case variants can be affected.
I don't know the WASM or Desktop code so those parts need more attention during review.
🚨 In fact I just realized I'm not sure how this will affect what it shown in the editors. I tried cargo dev-desktop but it ran without showing its window?
How Has This Been Tested?
- A unit test for each based on the "for free of charge" linter I was working on when I had the idea for this.
- Altered the
Damageslinter to useRemoveSuffix. cargo test
AI Disclosure
- [ ] I am a human and didn't use any AI.
- [ ] I used LLM features of my editor, but not an agent.
- [x] I used an AI agent interactively.
- [ ] I am an agent or I got an agent to do the work autonomously.
Checklist
- [x] I have performed a self-review of my own code
- [x] I have added tests to cover my changes
- [ ] I have considered splitting this into smaller pull requests.