From 5cc04e41fea50b3ff73bd5b18f667ccbf3070386 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Tue, 8 Dec 2015 14:06:23 +0300 Subject: [PATCH] Enable keyword highlighting in .kotlin_class, .kotlin_package files --- ...ighlighterProviderForDecompiledBuiltIns.kt | 33 +++++++++++++++++++ idea/src/META-INF/plugin.xml | 1 + 2 files changed, 34 insertions(+) create mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinSyntaxHighlighterProviderForDecompiledBuiltIns.kt diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinSyntaxHighlighterProviderForDecompiledBuiltIns.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinSyntaxHighlighterProviderForDecompiledBuiltIns.kt new file mode 100644 index 00000000000..09c2ddc9f50 --- /dev/null +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/builtIns/KotlinSyntaxHighlighterProviderForDecompiledBuiltIns.kt @@ -0,0 +1,33 @@ +/* + * Copyright 2010-2015 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.idea.decompiler.builtIns + +import com.intellij.openapi.fileTypes.FileType +import com.intellij.openapi.fileTypes.SyntaxHighlighter +import com.intellij.openapi.fileTypes.SyntaxHighlighterProvider +import com.intellij.openapi.project.Project +import com.intellij.openapi.vfs.VirtualFile +import org.jetbrains.kotlin.idea.highlighter.KotlinHighlighter + +class KotlinSyntaxHighlighterProviderForDecompiledBuiltIns : SyntaxHighlighterProvider { + override fun create(fileType: FileType, project: Project?, file: VirtualFile?): SyntaxHighlighter? { + if (fileType == KotlinBuiltInClassFileType || fileType == KotlinBuiltInPackageFileType) { + return KotlinHighlighter() + } + return null + } +} \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 903a44b0704..67e60cbd1e8 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -301,6 +301,7 @@ +