diff --git a/ChangeLog.md b/ChangeLog.md
index 310522269c3..4750b20ba26 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -464,6 +464,16 @@ These artifacts include extensions for the types available in the latter JDKs, s
+ [`KT-12389`](https://youtrack.jetbrains.com/issue/KT-12389) Do not exit from REPL when toString() of user class throws an exception
+ [`KT-12129`](https://youtrack.jetbrains.com/issue/KT-12129) Fixed link on api reference page in KDoc
+## 1.0.7
+
+### IDE
+
+#### Intention actions, inspections and quickfixes
+
+##### New features
+
+- [`KT-15068`](https://youtrack.jetbrains.com/issue/KT-15068) Implement intention which rename file according to the top-level class name
+
## 1.0.6
### IDE
diff --git a/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/after.kt.template b/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/after.kt.template
new file mode 100644
index 00000000000..5ea8c3cf589
--- /dev/null
+++ b/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/after.kt.template
@@ -0,0 +1,5 @@
+// Foo.kt
+
+class Foo {
+
+}
diff --git a/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/before.kt.template b/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/before.kt.template
new file mode 100644
index 00000000000..fb542ec314e
--- /dev/null
+++ b/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/before.kt.template
@@ -0,0 +1,5 @@
+// bar.kt
+
+class Foo {
+
+}
diff --git a/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/description.html b/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/description.html
new file mode 100644
index 00000000000..36493980751
--- /dev/null
+++ b/idea/resources/intentionDescriptions/RenameFileToMatchClassIntention/description.html
@@ -0,0 +1,5 @@
+
+
+This intention renames file according to the top-level class name.
+
+
\ No newline at end of file
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index bb808b74f7f..a3830505d06 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -1479,6 +1479,11 @@
Kotlin
+
+ org.jetbrains.kotlin.idea.intentions.RenameFileToMatchClassIntention
+ Kotlin
+
+
(KtClassOrObject::class.java, "", "Rename file to match top-level class name") {
+ override fun applicabilityRange(element: KtClassOrObject): TextRange? {
+ if (!element.isTopLevel()) return null
+ val fileName = element.containingKtFile.name
+ if (FileUtil.getNameWithoutExtension(fileName) == element.name) return null
+ text = "Rename file to ${element.name}.${FileUtilRt.getExtension(fileName)}"
+ return element.nameIdentifier?.textRange
+ }
+
+ override fun startInWriteAction() = false
+
+ override fun applyTo(element: KtClassOrObject, editor: Editor?) {
+ val file = element.containingKtFile
+ val extension = FileUtilRt.getExtension(file.name)
+ RenameProcessor(
+ file.project,
+ file,
+ "${element.name}.$extension",
+ RefactoringSettings.getInstance().RENAME_SEARCH_IN_COMMENTS_FOR_FILE,
+ RefactoringSettings.getInstance().RENAME_SEARCH_FOR_TEXT_FOR_FILE).run()
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/quickfix/implement/annotation.kt b/idea/testData/quickfix/implement/annotation.kt
index 46f1cfbcfc0..33abe32400e 100644
--- a/idea/testData/quickfix/implement/annotation.kt
+++ b/idea/testData/quickfix/implement/annotation.kt
@@ -1,4 +1,5 @@
// "Create subclass" "false"
+// ACTION: Rename file to My.kt
annotation class My(val x: Int)
diff --git a/idea/testData/quickfix/implement/enum.kt b/idea/testData/quickfix/implement/enum.kt
index 63fa37df843..58aed637ba4 100644
--- a/idea/testData/quickfix/implement/enum.kt
+++ b/idea/testData/quickfix/implement/enum.kt
@@ -1,6 +1,7 @@
// "Create subclass" "false"
// ACTION: Create test
// ACTION: Convert to sealed class
+// ACTION: Rename file to My.kt
enum class My {
SINGLE {
diff --git a/idea/testData/quickfix/implement/finalClass.kt b/idea/testData/quickfix/implement/finalClass.kt
index b4d91eb74a6..e85a7cdbf9c 100644
--- a/idea/testData/quickfix/implement/finalClass.kt
+++ b/idea/testData/quickfix/implement/finalClass.kt
@@ -1,4 +1,5 @@
// "Create subclass" "false"
// ACTION: Create test
+// ACTION: Rename file to Base.kt
class Base
\ No newline at end of file
diff --git a/idea/testData/quickfix/modifiers/noAbstractForObject.kt b/idea/testData/quickfix/modifiers/noAbstractForObject.kt
index 373f5ced522..91e215f10ae 100644
--- a/idea/testData/quickfix/modifiers/noAbstractForObject.kt
+++ b/idea/testData/quickfix/modifiers/noAbstractForObject.kt
@@ -2,6 +2,7 @@
// ACTION: Create test
// ACTION: Implement members
// ACTION: Move 'Some' to separate file
+// ACTION: Rename file to Some.kt
// ERROR: Object 'Some' must be declared abstract or implement abstract member public abstract fun foo(): Unit defined in T
interface T {
fun foo()
diff --git a/idea/testData/quickfix/removeUnused/importEnumValues.kt b/idea/testData/quickfix/removeUnused/importEnumValues.kt
index ce4451dbe73..3348c4f6dae 100644
--- a/idea/testData/quickfix/removeUnused/importEnumValues.kt
+++ b/idea/testData/quickfix/removeUnused/importEnumValues.kt
@@ -1,6 +1,7 @@
// "Safe delete 'MyEnum'" "false"
// ACTION: Create test
// ACTION: Convert to sealed class
+// ACTION: Rename file to MyEnum.kt
import MyEnum.values
diff --git a/idea/testData/quickfix/removeUnused/importObjectFun.kt b/idea/testData/quickfix/removeUnused/importObjectFun.kt
index ca9d6ea576e..72e41b9a11f 100644
--- a/idea/testData/quickfix/removeUnused/importObjectFun.kt
+++ b/idea/testData/quickfix/removeUnused/importObjectFun.kt
@@ -1,5 +1,6 @@
// "Safe delete 'MyObj'" "false"
// ACTION: Create test
+// ACTION: Rename file to MyObj.kt
import MyObj.foo
diff --git a/idea/testData/quickfix/removeUnused/usedClassAsAlias.kt b/idea/testData/quickfix/removeUnused/usedClassAsAlias.kt
index 8edabb624e2..6f602a11bb3 100644
--- a/idea/testData/quickfix/removeUnused/usedClassAsAlias.kt
+++ b/idea/testData/quickfix/removeUnused/usedClassAsAlias.kt
@@ -1,6 +1,7 @@
// "Safe delete 'Imported'" "false"
// ACTION: Create test
// ACTION: Move 'ImportedClass' to separate file
+// ACTION: Rename file to ImportedClass.kt
import ImportedClass as ClassAlias
class ImportedClass
diff --git a/idea/testData/quickfix/removeUnused/usedObjectAsAlias.kt b/idea/testData/quickfix/removeUnused/usedObjectAsAlias.kt
index 88d13dbd3f5..14f43656234 100644
--- a/idea/testData/quickfix/removeUnused/usedObjectAsAlias.kt
+++ b/idea/testData/quickfix/removeUnused/usedObjectAsAlias.kt
@@ -1,6 +1,7 @@
// "Safe delete 'Imported'" "false"
// ACTION: Create test
// ACTION: Move 'Imported' to separate file
+// ACTION: Rename file to Imported.kt
import Imported as Alias
object Imported
diff --git a/idea/testData/quickfix/removeUnused/usedObjectAsAliasMulti.before.Main.kt b/idea/testData/quickfix/removeUnused/usedObjectAsAliasMulti.before.Main.kt
index 506b2eb6698..652b97f3944 100644
--- a/idea/testData/quickfix/removeUnused/usedObjectAsAliasMulti.before.Main.kt
+++ b/idea/testData/quickfix/removeUnused/usedObjectAsAliasMulti.before.Main.kt
@@ -1,3 +1,4 @@
// "Safe delete 'Imported'" "false"
// ACTION: Create test
+// ACTION: Rename file to Imported.kt
object Imported
\ No newline at end of file
diff --git a/idea/testData/quickfix/unusedSuppressAnnotation/notForJava.kt b/idea/testData/quickfix/unusedSuppressAnnotation/notForJava.kt
index 543b33adf53..07e49b7298d 100644
--- a/idea/testData/quickfix/unusedSuppressAnnotation/notForJava.kt
+++ b/idea/testData/quickfix/unusedSuppressAnnotation/notForJava.kt
@@ -1,5 +1,6 @@
// "Suppress for declarations annotated by 'java.lang.SuppressWarnings'" "false"
// ACTION: Safe delete 'Unused'
// ACTION: Create test
+// ACTION: Rename file to Unused.kt
@java.lang.SuppressWarnings("")
class Unused