Native: Register '.klib' extension through FileTypeFactory
This commit is contained in:
-31
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
|
||||||
* that can be found in the license/LICENSE.txt file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.kotlin.ide.konan
|
|
||||||
|
|
||||||
import com.intellij.ide.highlighter.ArchiveFileType
|
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
|
||||||
import com.intellij.openapi.components.ApplicationComponent
|
|
||||||
import com.intellij.openapi.fileTypes.FileTypeManager
|
|
||||||
import org.jetbrains.kotlin.konan.library.KLIB_FILE_EXTENSION
|
|
||||||
|
|
||||||
class KotlinNativeApplicationComponent : ApplicationComponent {
|
|
||||||
|
|
||||||
override fun getComponentName(): String = "KotlinNativeApplicationComponent"
|
|
||||||
|
|
||||||
override fun initComponent() {
|
|
||||||
ApplicationManager.getApplication().runWriteAction {
|
|
||||||
FileTypeManager.getInstance().associateExtension(ArchiveFileType.INSTANCE, KLIB_FILE_EXTENSION)
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Move this to Kotlin/Native plugin for CLion and AppCode (see KT-26717):
|
|
||||||
// val extensionPoint = Extensions.getRootArea().getExtensionPoint(TipAndTrickBean.EP_NAME)
|
|
||||||
// for (name in arrayOf("Kotlin.html", "Kotlin_project.html", "Kotlin_mix.html", "Kotlin_Java_convert.html")) {
|
|
||||||
// TipAndTrickBean.findByFileName(name)?.let {
|
|
||||||
// extensionPoint.unregisterExtension(it)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.ide.konan
|
||||||
|
|
||||||
|
import com.intellij.ide.highlighter.ArchiveFileType
|
||||||
|
import com.intellij.openapi.fileTypes.FileTypeConsumer
|
||||||
|
import com.intellij.openapi.fileTypes.FileTypeFactory
|
||||||
|
import org.jetbrains.kotlin.konan.library.KLIB_FILE_EXTENSION
|
||||||
|
|
||||||
|
class KotlinNativeFileTypeFactory : FileTypeFactory() {
|
||||||
|
override fun createFileTypes(consumer: FileTypeConsumer) {
|
||||||
|
consumer.consume(ArchiveFileType.INSTANCE, KLIB_FILE_EXTENSION)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
|
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<application-components>
|
<application-components>
|
||||||
<component>
|
|
||||||
<implementation-class>org.jetbrains.kotlin.ide.konan.KotlinNativeApplicationComponent</implementation-class>
|
|
||||||
</component>
|
|
||||||
<component>
|
<component>
|
||||||
<implementation-class>org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeLoadingMetadataCache</implementation-class>
|
<implementation-class>org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeLoadingMetadataCache</implementation-class>
|
||||||
</component>
|
</component>
|
||||||
@@ -16,6 +13,7 @@
|
|||||||
<filetype.stubBuilder filetype="KNM" implementationClass="com.intellij.psi.impl.compiled.ClassFileStubBuilder"/>
|
<filetype.stubBuilder filetype="KNM" implementationClass="com.intellij.psi.impl.compiled.ClassFileStubBuilder"/>
|
||||||
<filetype.decompiler filetype="KNM" implementationClass="com.intellij.psi.impl.compiled.ClassFileDecompiler"/>
|
<filetype.decompiler filetype="KNM" implementationClass="com.intellij.psi.impl.compiled.ClassFileDecompiler"/>
|
||||||
<fileTypeFactory implementation="org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeMetaFileTypeFactory"/>
|
<fileTypeFactory implementation="org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeMetaFileTypeFactory"/>
|
||||||
|
<fileTypeFactory implementation="org.jetbrains.kotlin.ide.konan.KotlinNativeFileTypeFactory"/>
|
||||||
<fileBasedIndex implementation="org.jetbrains.kotlin.ide.konan.index.KotlinNativeMetaFileIndex"/>
|
<fileBasedIndex implementation="org.jetbrains.kotlin.ide.konan.index.KotlinNativeMetaFileIndex"/>
|
||||||
<library.type implementation="org.jetbrains.kotlin.ide.konan.NativeLibraryType"/>
|
<library.type implementation="org.jetbrains.kotlin.ide.konan.NativeLibraryType"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|||||||
Reference in New Issue
Block a user