I found that I can use ```implementation 'io.arrow...
# arrow-meta
r
I found that I can use
Copy code
implementation 'io.arrow-kt:arrow-meta:1.6.0'
But I still can't resolve
Copy code
import arrow.meta.quotes
If only this resolve issue is solved, everything will work just fine I looked into the downloaded arrow meta package and found arrow.meta.quotes doesn't even exist
r
Hi Raehat, quotes were removed from Arrow Meta about a year ago in https://github.com/arrow-kt/arrow-meta/pull/969 given the new direction the Kotlin compiler is going with K2 nd FIR, the quote system as implemented did not make sense and was not going to work down the road.
r
If that is the case, how can I use Transform.replace? Transform can be imported using import arrow.meta.quotes.Transform @raulraja
r
Looks like a bunch of dead code was left behind in the repo after that PR. We plan on removing all that and completely getting rid of any references to quoting. Quotes is not something that we can support with the current state of the Kotlin compiler and FIR. The compiler provides no entry points to replace or transform elements of the tree individually. The current FIR api is based on different access interfaces to generate members and provides no way to transform existing code on the fly. The quotes system was a hack over the PSI document but that is not something we can rely on for the long run or something that would work with current apis.
Regardless of Arrow Meta or these apis, what is it that you are trying to do with a compiler plugin? Perhaps we can help advising a different way to accomplish it.
r
I am developing an intellij idea plugin which will run some code when a breakpoint hits during a debugging session
now, I was able to write the logic to listen to breakpoints
as soon as some breakpoint hits, I want to run some code as if it was there at the line where breakpoint is mentioned let's say I want to develop an intellij plugin which executes Thread.currentThread().getName() at every breakpoint and I want to use this threadname back in my intellij plugin I thought I'll achive something like this by using arrow meta and adding my own code to the project when breakpoint hits
r
I understand, If I was writing this I'd probably take the following approach. 1. Create an annotation that you can use to select which methods should be instrumented to insert the statements.
@DebugThreadName
or similar. 2. Alternatively do not use an annotation if you want to intercept all methods. 3. Instead of using quotes use the backend IR to perform a transformation. https://github.com/arrow-kt/arrow-meta/blob/main/libs/arrow-meta/src/main/kotlin/arrow/meta/dsl/codegen/ir/IrSyntax.kt if you want to use Arrow Meta or use directly the IR compiler transformers:
Copy code
object : IrElementTransformer<Unit> {
  override fun visitSimpleFunction(declaration: IrSimpleFunction, data: Unit): IrStatement =
    // inject here statements in body to get thread name or whatever if the declaration is annotated with `@DebugThreadName`
}
The difference between the Backend IR and what you were trying to do with quotes is that quotes are part of the frontend whereas the backend IR works once the module is compiled. Transforming in the backend IR you guarantee you are just transforming already type-checked valid Kotlin code.
r
I looked into IR compiler transformers, now the thing is I found ways to make it work by making one kotlin plugin and one gradle plugin where gradle plugin is the one used in projects like in this diagram
but what I really want is to develop an intellij plugin, which once installed is able to make changes to the code
how will that work?
r
That is an entirely different API for Intellij IDEA plugins which you would have to integrate with a Kotlin compiler plugin as you showed in that diagram. I don't have much experience with IDEA plugins and most people in this slack are Kotlin focused but there is this other slack for IntelliJ IDEA platform developers. https://plugins.jetbrains.com/slack
r
I see, anyways thanks for your time and help, truly appreciated!