Support suggested fixes
- Dominant language
- Kotlin
- Stars
- 3.5k
- Forks
- 415
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 53
Description
Along with supporting more specific node locations (#2550) it would be very useful to have the ability to suggest replacement code for nodes. This is something that can be done with Android Lint, but for KSP processors that need to do validation of user code and report errors it would be extremely valuable to not have to rely on an external tool when the processor itself has the information it needs to suggest a fix.
KSP doesn't model the whole syntax tree so I would't expect it to be able to do every kind of suggested fix one might want, but I believe there are still many things that _could_ be done through KSP.
I have a use-case, for example, where I need to prevent use of specific annotations, but for each I could suggest a different annotation to replace it with. Right now I can report an error with a message that suggests the replacement, but that isn't something tools could provide a way of automatically applying.
Contributor guide
Research direction
Start by reviewing KSP's existing node-location support discussed in #2550 and how KSP processors currently report validation errors. Compare the requested replacement annotations with Android Lint's suggested-fix behavior; done means defining and implementing a KSP mechanism that tools can use to apply processor-provided replacement code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100