Help Developing Plugin (Reformat File Using Bash/gradle Command)

Answered

Hello,

I'd like to develop a plugin which is able to reformat code by executing a bash/gradle command e.g. `./gradlew formatApply` on file save or via menu item select. This command can either change the file passed in directly or else output the result to stdout. 

My questions are:

  1. What 'type' of plugin is this? Should this be an 'action' that just executes the command, or else an 'external code formatter '(https://plugins.jetbrains.com/docs/intellij/code-formatting.html#external-code-formatter)?
  2. Is there documentation out there telling me what properties certain classes have? For example, how would I get the absolute path of a file in an action / external formatter?
  3. For this, would it be possible to 'override' the included "Reformat code" functionality in Intellij, either by replacing it or disabling 'format on save' automatically when the plugin is added? Or should I just have it as a separate action?

Thank you for the help!

0

Please sign in to leave a comment.