mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
The existing `ExtractFunctionDescriptorModifier::modifyDescriptor(..)`
that allows us to update the extraction descriptor returns
`ExtractableCodeDescriptor`. We have some cases like compose editor
of Android Studio that needs to change the behavior of the extraction
by updating the annotation rendering. The current annotation rendering
has a limitation that the rendered annotations must be from the
annotations of the container class. However, in the following example
the lambda argument must have `@Composable` annotation after extraction
even though its container function does not have it:
```
@Composable
fun myWidget(context: @Composable () -> Unit) {}
fun containerFunction() {
myWidget { // This lambda argument is composable!
<selection>print(true)</selection>
}
}
```
Since we cannot handle the above case i.e., adding `@Composable` to the
extracted function for the lambda argument, this commit allows us to
use the rendered annotations instead of class Ids for
`ExtractableCodeDescriptor`.
^KTIJ-30695
Signed-off-by: Anna Kozlova <anna.kozlova@jetbrains.com>
GitOrigin-RevId: e4f2039882092544b67896f4f06a91ffee05d6d8
10 lines
239 B
Kotlin
10 lines
239 B
Kotlin
package com.example
|
|
|
|
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.TYPE_PARAMETER,
|
|
AnnotationTarget.VALUE_PARAMETER)
|
|
annotation class MyComposable
|
|
|
|
@MyComposable
|
|
fun sourceFunction() {
|
|
<selection>print(true)</selection>
|
|
} |