Temporarily modify formatter settings via comments

Answered

I recently learned about `// @formatter:off` and `// @formatter:on` and was wondering what family of functionalities this was part of. (For those who don't know, you simply put these in as comment lines and all code in between them is ignored by the auto formatter.) I asked ChatGPT about it, and it suggested something like this as an example: `// @formatter:settings(spaceBeforeParentheses = false, spaceAfterComma = false)` and then afterwards `// @formatter:restore`. I tried looking into it, and I'm fairly certain it just hallucinated this. But it honestly seems like a useful feature that could really come in handy in certain circumstances. It's basically the ability to modify any arbitrary formatter setting on the fly for a specific chunk of code. Unless this actually does exist and I just couldn't find it, I propose that something like this be considered for implementation.

0
1 comment

You can submit feature requests at https://youtrack.jetbrains.com/newIssue?project=IDEA.

This functionality doesn't exist at the moment.

0

Please sign in to leave a comment.