Add ProjectImportProvider for *.gradle.kts file to import it as module

#KT-19466 Fixed
This commit is contained in:
Vyacheslav Gerasimov
2017-08-08 18:51:46 +03:00
parent 4405021f85
commit adfc481c7a
2 changed files with 30 additions and 0 deletions
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.gradle
import com.intellij.openapi.externalSystem.service.project.wizard.AbstractExternalProjectImportProvider
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.plugins.gradle.service.project.wizard.GradleProjectImportBuilder
import org.jetbrains.plugins.gradle.util.GradleConstants
class GradleKotlinDSLProjectImportProvider(builder: GradleProjectImportBuilder)
: AbstractExternalProjectImportProvider(builder, GradleConstants.SYSTEM_ID) {
override fun canImportFromFile(file: VirtualFile): Boolean = file.name.endsWith(".${GradleConstants.EXTENSION}.kts")
override fun getFileSample(): String? = "<b>Gradle (Kotlin DSL)</b> build script (*.gradle.kts)"
}
+1
View File
@@ -2478,6 +2478,7 @@
<psi.clsCustomNavigationPolicy implementation="org.jetbrains.kotlin.idea.core.script.dependencies.ScriptDependencySourceNavigationPolicyForJavaClasses"/>
<resolveScopeProvider implementation="org.jetbrains.kotlin.idea.core.script.dependencies.KotlinScriptResolveScopeProvider"/>
<projectOpenProcessor implementation="org.jetbrains.kotlin.gradle.GradleKotlinDSLProjectOpenProcessor"/>
<projectImportProvider implementation="org.jetbrains.kotlin.gradle.GradleKotlinDSLProjectImportProvider"/>
</extensions>