ZacSweers/redacted-compiler-plugin

IDE support

ZacSweers opened this issue · 10 comments

Not sure how this works but would be neat to support. Can look at the all-open (or similar) plugins for examples

https://github.com/JetBrains/kotlin/blob/master/plugins/allopen/allopen-ide

It looks like this is somewhat straightforward!

The iml facet has our plugin options in it

<option name="pluginOptions">
  <array>
    <option value="plugin:redacted-compiler-plugin:enabled=true" />
    <option value="plugin:redacted-compiler-plugin:replacementString=██" />
    <option value="plugin:redacted-compiler-plugin:redactedAnnotation=dev.zacsweers.redacted.sample.Redacted" />
  </array>
</option>

Well, I take that back. Implementation-wise, it seems quite straightforward. However, Kotlin does not publish idea artifacts. This appears to be why all their external compilers move back to the main kotlin repo when they're productionized, as they rely on these private dependencies.

In short - seems like only first-party plugins are allowed to implement IDE support.

One possible crazy idea - git submodule the kotlin repo and build against the idea APIs that way.

Or clone the Kotlin repo and publish idea artifacts to maven yourself :) not sure about the legal implications though

Yeah that's not something I'm going to do

What does IDE support mean in this context? Will the IDE just use the full .toString() and that's the only downside?

Basically just in decompiled bytecode

This may be possible in FIR

@ZacSweers it should be possible with FIR and you can test with a intellij community build, setting a registry key that allows non-official plugins to load.

see notes here:
https://kotlinlang.slack.com/archives/C7L3JB43G/p1695407727213849