Unregistered bunch directives and files test

This commit is contained in:
Darya Razumova
2019-08-30 12:18:22 +03:00
committed by Nikolay Krasko
parent 412c562572
commit 5fc6fa8619
3 changed files with 42 additions and 13 deletions
@@ -39,19 +39,6 @@ class ScratchFileModuleInfoProvider(val project: Project) : ProjectComponent {
val ktFile = scratchFile.getPsiFile() as? KtFile ?: return
val file = ktFile.virtualFile ?: return
// BUNCH: 181 scratch files are created with .kt extension
if (file.extension == KotlinFileType.EXTENSION) {
runWriteAction {
var newName = file.nameWithoutExtension + STD_SCRIPT_EXT
var i = 1
while (file.parent.findChild(newName) != null) {
newName = file.nameWithoutExtension + "_" + i + STD_SCRIPT_EXT
i++
}
file.rename(this, newName)
}
}
if (file.extension != STD_SCRIPT_SUFFIX) {
LOG.error("Kotlin Scratch file should have .kts extension. Cannot add scratch panel for ${file.path}")
return