Surround with braces when completing backing field in string template
This commit is contained in:
@@ -118,9 +118,12 @@ class LookupElementsCollector(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor is PropertyDescriptor) {
|
if (descriptor is PropertyDescriptor) {
|
||||||
val lookupElement = lookupElementFactory.createBackingFieldLookupElement(descriptor, inDescriptor, resolutionFacade)
|
var lookupElement = lookupElementFactory.createBackingFieldLookupElement(descriptor, inDescriptor, resolutionFacade)
|
||||||
if (lookupElement != null) {
|
if (lookupElement != null) {
|
||||||
addElement(lookupElement)
|
if (surroundCallsWithBraces) {
|
||||||
|
lookupElement = lookupElement!!.withBracesSurrounding()
|
||||||
|
}
|
||||||
|
addElement(lookupElement!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
class C {
|
||||||
|
var property = "abc"
|
||||||
|
get() = $property + 1
|
||||||
|
|
||||||
|
fun foo(){
|
||||||
|
"$<caret>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELEMENT: $property
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
class C {
|
||||||
|
var property = "abc"
|
||||||
|
get() = $property + 1
|
||||||
|
|
||||||
|
fun foo(){
|
||||||
|
"${$property<caret>}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ELEMENT: $property
|
||||||
+6
@@ -113,6 +113,12 @@ public class BasicCompletionHandlerTestGenerated extends AbstractBasicCompletion
|
|||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/completion/handlers/basic/stringTemplate"), Pattern.compile("^(.+)\\.kt$"), true);
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/completion/handlers/basic/stringTemplate"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("BackingField.kt")
|
||||||
|
public void testBackingField() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/basic/stringTemplate/BackingField.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("NotEmptyPrefix.kt")
|
@TestMetadata("NotEmptyPrefix.kt")
|
||||||
public void testNotEmptyPrefix() throws Exception {
|
public void testNotEmptyPrefix() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/basic/stringTemplate/NotEmptyPrefix.kt");
|
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/handlers/basic/stringTemplate/NotEmptyPrefix.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user