-
Notifications
You must be signed in to change notification settings - Fork 289
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
Allow to opt out of escaping for soft & modifier keywords #1229
Comments
Our general philosophy for this library is to prefer sane defaults and smaller API surface over customizability. Exposing and maintaining extra API to customize the look and feel of generated code is not something we want to do. I'm closing this issue, however, if there's a stronger reason for having the ability to enable/disable backticks - please let us know. |
@Egorand Hello, I ran into an annoying problem with this. It makes Ktlint throw an error because it contains an
|
@Omico this looks like a bug in Ktlint. That said, I do think we're being overly cautious by escaping all keywords. Escaping of all keywords was introduced by #994, and it has a link to an issue we had with |
Found something interesting, maybe we can follow this https://github.com/JetBrains/intellij-community/blob/master/plugins/kotlin/code-insight/inspections-shared/src/org/jetbrains/kotlin/idea/codeInsight/inspections/shared/RemoveRedundantBackticksInspection.kt This solves part of the problem but not the problem I mentioned above with |
Hi, I just created this for testing https://github.com/Omico/kotlin-keywords-test. Seem |
Soft keywords (eg.
get
) only act as keywords in very specific cases.There should be a way for codegen authors to explicitly opt out of escaping soft keywords in specific cases.
One example is generating ktor client code where generated code reads better without the backticks
The text was updated successfully, but these errors were encountered: