Hi again! I would like to enhance the `DebugLog` c...
# compiler
g
Hi again! I would like to enhance the
DebugLog
compiler plugin from the Brian Norman's series by making it print FQN and the first declaration line number of the function that is modified. For example,
Copy code
@DebugLog
fun foo() {
    ...
}
would print
Copy code
⇢ foo.bar.baz.foo(common.kt:7)()
instead of just
Copy code
⇢ foo()
I understand how to get FQN of the function. But how do i get the declaration's file and line number? Is it possible to do it from IR plugin?
1
d
There is an
IrFile.fileEntry
, which could be used for that
IrElement.startOffset/endOffset
are text offsets in the original source file
g
Got it. Made it work. Thank you very much!
👍 1
j
I have done it here at the refactor compiler plugin branch https://github.com/JavierSegoviaCordoba/mokoki Anyway you can use cite to get that data https://github.com/JakeWharton/cite
🔥 1
thank you color 1