mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Preserve annotation arguments in "Add use-site target" intention
So #KT-23634 Fixed GitOrigin-RevId: 608e617b701c05fa270ad9c8e7911e0b36e428f7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
fad53488cb
commit
c2b031e442
+1
-1
@@ -141,6 +141,6 @@ private fun KtAnnotationEntry.applicableUseSiteTargets(): List<AnnotationUseSite
|
||||
|
||||
private fun KtAnnotationEntry.addUseSiteTarget(useSiteTarget: AnnotationUseSiteTarget, project: Project) {
|
||||
project.executeWriteCommand("Add use-site target") {
|
||||
replace(KtPsiFactory(this).createAnnotationEntry("@${useSiteTarget.renderName}:$shortName"))
|
||||
replace(KtPsiFactory(this).createAnnotationEntry("@${useSiteTarget.renderName}:$shortName${valueArgumentList?.text ?: ""}"))
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -33,6 +33,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/intentions/addAnnotationUseSiteTarget"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("hasAnnotationArgs.kt")
|
||||
public void testHasAnnotationArgs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/addAnnotationUseSiteTarget/hasAnnotationArgs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("hasTarget1.kt")
|
||||
public void testHasTarget1() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/addAnnotationUseSiteTarget/hasTarget1.kt");
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// CHOOSE_USE_SITE_TARGET: field
|
||||
|
||||
annotation class A(val s: String)
|
||||
|
||||
class Test {
|
||||
@A("...")<caret>
|
||||
val foo: String = ""
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// CHOOSE_USE_SITE_TARGET: field
|
||||
|
||||
annotation class A(val s: String)
|
||||
|
||||
class Test {
|
||||
@field:A("...")
|
||||
val foo: String = ""
|
||||
}
|
||||
Reference in New Issue
Block a user