Code Insight: Support file path references inside of Kotlin string literals

#KT-11704 Fixed
This commit is contained in:
Alexey Sedunov
2016-04-11 19:42:13 +03:00
parent 6a309bdb4e
commit 4a65b1c65c
26 changed files with 128 additions and 21 deletions
@@ -0,0 +1,6 @@
// NUMBER: 1
// EXIST: foo.txt
fun foo() {
val s = "fo<caret>"
}
@@ -0,0 +1,8 @@
// NUMBER: 3
// EXIST: foo.txt
// EXIST: bar.txt
// EXIST: FileRefInStringLiteralNoPrefix.kt
fun foo() {
val s = "<caret>"
}
@@ -0,0 +1,3 @@
fun foo() {
val s = "fo<caret>something"
}
@@ -0,0 +1 @@
// Empty file to satisfy test framework requirements
@@ -0,0 +1,3 @@
fun foo() {
val s = "foo.txt"
}
@@ -0,0 +1,3 @@
fun foo() {
val s = "fo<caret>something"
}
@@ -0,0 +1 @@
// Empty file to satisfy test framework requirements
@@ -0,0 +1,3 @@
fun foo() {
val s = "foo.txt"
}
@@ -125,6 +125,18 @@ public class MultiFileJvmBasicCompletionTestGenerated extends AbstractMultiFileJ
doTest(fileName);
}
@TestMetadata("FileRefInStringLiteral")
public void testFileRefInStringLiteral() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/FileRefInStringLiteral/");
doTest(fileName);
}
@TestMetadata("FileRefInStringLiteralNoPrefix")
public void testFileRefInStringLiteralNoPrefix() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/FileRefInStringLiteralNoPrefix/");
doTest(fileName);
}
@TestMetadata("GroovyClassNameCompletionFromDefaultPackage")
public void testGroovyClassNameCompletionFromDefaultPackage() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-completion/testData/basic/multifile/GroovyClassNameCompletionFromDefaultPackage/");
@@ -85,6 +85,14 @@ class CompletionMultiFileHandlerTest : KotlinCompletionTestCase() {
doTest('\t', "TestBundle.properties")
}
fun testFileRefInStringLiteralEnter() {
doTest('\n', "foo.txt", "bar.txt")
}
fun testFileRefInStringLiteralTab() {
doTest('\t', "foo.txt", "bar.txt")
}
fun testNotImportedExtension() {
doTest()
}