In IntelliJ IDEA (for Java code at least), it's poissble to instruct the code-formatter to ignore lines with these (see https://stackoverflow.com/a/19492318/117750):
// @formatter:off
...
// @formatter:on
What I'd like to do is automate adding these around a code block. Workflow I want:
- Select a block of code.
- Invoke an action (with a shortcut or a menu item etc. or with the
Cmd-Shit-A
).
This command needs to
- add
// @formatter:off
on a new line before the first selected line, at the correct indentation. - add
// @formatter:on
on a new line after the last selected line, at the correct indentation.
From what I am reading, it is not possible to do with a Macro. Is it?
If not, do I need to write a plugin to do this? I am happy to write one, can someone give me brief high-level get-started steps on:
- how to approach this action in a plugin
- and pointers to get-started with plugins