Add ProjectOpenProcessor for *.gradle.kts file to open it as project
#KT-19024 Fixed
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="gradle-and-groovy-plugin" level="project" />
|
||||
<orderEntry type="library" name="intellij-core" level="project" />
|
||||
<orderEntry type="library" name="kotlin-runtime" level="project" />
|
||||
<orderEntry type="library" name="idea-full" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.vfs.VirtualFile
|
||||
import org.jetbrains.plugins.gradle.service.project.wizard.GradleProjectImportBuilder
|
||||
import org.jetbrains.plugins.gradle.service.project.wizard.GradleProjectOpenProcessor
|
||||
import org.jetbrains.plugins.gradle.util.GradleConstants
|
||||
|
||||
class GradleKotlinDSLProjectOpenProcessor(builder: GradleProjectImportBuilder) : GradleProjectOpenProcessor(builder) {
|
||||
override fun canOpenProject(file: VirtualFile): Boolean = when {
|
||||
!file.isDirectory -> file.name.endsWith(".gradle.kts")
|
||||
supportedExtensions.any { file.findChild(it) != null } -> true
|
||||
else -> super.canOpenProject(file)
|
||||
}
|
||||
|
||||
override fun getSupportedExtensions(): Array<String> =
|
||||
arrayOf("${GradleConstants.DEFAULT_SCRIPT_NAME}.kts", GradleConstants.SETTINGS_FILE_NAME)
|
||||
}
|
||||
@@ -2477,6 +2477,7 @@
|
||||
<indexedRootsProvider implementation="org.jetbrains.kotlin.idea.core.script.dependencies.KotlinScriptDependenciesIndexableSetContributor"/>
|
||||
<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"/>
|
||||
|
||||
</extensions>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user