Resource Bundles: Implement references on Kotlin string literals
#KT-6946 In Progress
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// PSI_ELEMENT: com.intellij.lang.properties.psi.PropertiesFile
|
||||
// FIND_BY_REF
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
public fun message(@PropertyKey(resourceBundle = "<caret>idea.testData.findUsages.kotlin.propertyFiles.propertyFileUsagesByRef.2") key: String) = key
|
||||
|
||||
fun test() {
|
||||
message("foo.bar")
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import org.jetbrains.annotations.PropertyKey;
|
||||
|
||||
class A {
|
||||
static String message(@PropertyKey(resourceBundle = "idea.testData.findUsages.kotlin.propertyFiles.propertyFileUsagesByRef.2") String key, Object... args) {
|
||||
return key;
|
||||
}
|
||||
|
||||
void test() {
|
||||
message("foo.bar");
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
foo.bar = test
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.jetbrains.annotations
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FIELD)
|
||||
public annotation class PropertyKey(public val resourceBundle: String)
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
[propertyFileUsagesByRef.0.kt] Usage in string constants (5: 51) public fun message(@PropertyKey(resourceBundle = "idea.testData.findUsages.kotlin.propertyFiles.propertyFileUsagesByRef.2") key: String) = key
|
||||
[propertyFileUsagesByRef.1.java] Method parameter declaration (4: 58) static String message(@PropertyKey(resourceBundle = "idea.testData.findUsages.kotlin.propertyFiles.propertyFileUsagesByRef.2") String key, Object... args) {
|
||||
@@ -0,0 +1,9 @@
|
||||
// PSI_ELEMENT: com.intellij.lang.properties.psi.Property
|
||||
// FIND_BY_REF
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
public fun message(@PropertyKey(resourceBundle = "idea.testData.findUsages.kotlin.propertyFiles.propertyUsagesByRef.2") key: String) = key
|
||||
|
||||
fun test() {
|
||||
message("<caret>foo.bar")
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
void test() {
|
||||
PropertyUsages_1Kt.message("foo.bar");
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
foo.bar = test
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.jetbrains.annotations
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FIELD)
|
||||
public annotation class PropertyKey(public val resourceBundle: String)
|
||||
@@ -0,0 +1,2 @@
|
||||
[propertyUsagesByRef.0.kt] Usage in string constants (8: 14) message("foo.bar")
|
||||
[propertyUsagesByRef.1.java] Usage in string constants (3: 37) PropertyUsages_1Kt.message("foo.bar");
|
||||
@@ -0,0 +1,2 @@
|
||||
## FIND_FILE_USAGES
|
||||
foo.bar = test
|
||||
@@ -0,0 +1,10 @@
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
private val BUNDLE_NAME = "idea.testData.findUsages.propertyFiles.propertyFileUsages.0"
|
||||
|
||||
public fun message(@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyFileUsages.0") key: String) = key
|
||||
public fun message2(@PropertyKey(resourceBundle = BUNDLE_NAME) key: String) = key
|
||||
|
||||
fun test() {
|
||||
message("foo.bar")
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.jetbrains.annotations
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FIELD)
|
||||
public annotation class PropertyKey(public val resourceBundle: String)
|
||||
@@ -0,0 +1,2 @@
|
||||
Usage in string constants (3: 28) private val BUNDLE_NAME = "idea.testData.findUsages.propertyFiles.propertyFileUsages.0"
|
||||
Usage in string constants (5: 51) public fun message(@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyFileUsages.0") key: String) = key
|
||||
@@ -0,0 +1 @@
|
||||
foo<caret>.bar = test
|
||||
@@ -0,0 +1,30 @@
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
public fun message(@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") key: String) = key
|
||||
|
||||
public fun String.infixMessage(@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") key: String) = key
|
||||
|
||||
public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.infixMessage2(s: String) = this
|
||||
|
||||
public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.minus() = this
|
||||
|
||||
public fun Int.get(@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") key: String) = this
|
||||
|
||||
public fun @receiver:PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String.get(s: String) = this
|
||||
|
||||
fun test() {
|
||||
@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") val s1 = "foo.bar"
|
||||
@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") val s2 = "foo.baz"
|
||||
message("foo.bar")
|
||||
message("foo.baz")
|
||||
|
||||
"test" infixMessage "foo.bar"
|
||||
"foo.bar" infixMessage "test"
|
||||
"foo.bar" infixMessage2 "test"
|
||||
"test" infixMessage2 "foo.bar"
|
||||
"foo.bar".infixMessage2("test")
|
||||
-"foo.bar"
|
||||
1["foo.bar"]
|
||||
"foo.bar"["test"]
|
||||
"test"["foo.bar"]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
void test() {
|
||||
@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String s1 = "foo.bar"
|
||||
@PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String s2 = "foo.baz"
|
||||
PropertyUsages_1Kt.message("foo.bar");
|
||||
PropertyUsages_1Kt.message("foo.baz");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.jetbrains.annotations
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FIELD)
|
||||
public annotation class PropertyKey(public val resourceBundle: String)
|
||||
@@ -0,0 +1,10 @@
|
||||
[propertyUsages.1.kt] Usage in string constants (16: 104) @PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") val s1 = "foo.bar"
|
||||
[propertyUsages.1.kt] Usage in string constants (18: 14) message("foo.bar")
|
||||
[propertyUsages.1.kt] Usage in string constants (21: 26) "test" infixMessage "foo.bar"
|
||||
[propertyUsages.1.kt] Usage in string constants (23: 6) "foo.bar" infixMessage2 "test"
|
||||
[propertyUsages.1.kt] Usage in string constants (25: 6) "foo.bar".infixMessage2("test")
|
||||
[propertyUsages.1.kt] Usage in string constants (26: 7) -"foo.bar"
|
||||
[propertyUsages.1.kt] Usage in string constants (27: 8) 1["foo.bar"]
|
||||
[propertyUsages.1.kt] Usage in string constants (28: 6) "foo.bar"["test"]
|
||||
[propertyUsages.2.java] Usage in string constants (3: 111) @PropertyKey(resourceBundle = "idea.testData.findUsages.propertyFiles.propertyUsages.0") String s1 = "foo.bar"
|
||||
[propertyUsages.2.java] Usage in string constants (5: 37) PropertyUsages_1Kt.message("foo.bar");
|
||||
Reference in New Issue
Block a user