Switch off inspections on Kotlin files not in project source

To switch them off, KotlinDefaultHighlightingSettingsProvider
was introduced.
So #KT-19377 Fixed
This commit is contained in:
Mikhail Glukhikh
2018-06-15 15:08:57 +03:00
parent ef0eb5cbe9
commit 1819878c2b
7 changed files with 33 additions and 0 deletions
+2
View File
@@ -480,6 +480,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<codeInsight.linkHandler prefix="#kotlinClass/" handlerClass="org.jetbrains.kotlin.idea.highlighter.markers.KotlinClassTooltipLinkHandler"/>
<defaultHighlightingSettingProvider language="kotlin" implementation="org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider"/>
<typeDeclarationProvider implementation="org.jetbrains.kotlin.idea.codeInsight.KotlinTypeDeclarationProvider"/>
<completion.contributor language="kotlin"
+2
View File
@@ -481,6 +481,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<codeInsight.linkHandler prefix="#kotlinClass/" handlerClass="org.jetbrains.kotlin.idea.highlighter.markers.KotlinClassTooltipLinkHandler"/>
<defaultHighlightingSettingProvider language="kotlin" implementation="org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider"/>
<typeDeclarationProvider implementation="org.jetbrains.kotlin.idea.codeInsight.KotlinTypeDeclarationProvider"/>
<completion.contributor language="kotlin"
+2
View File
@@ -481,6 +481,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<codeInsight.linkHandler prefix="#kotlinClass/" handlerClass="org.jetbrains.kotlin.idea.highlighter.markers.KotlinClassTooltipLinkHandler"/>
<defaultHighlightingSettingProvider language="kotlin" implementation="org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider"/>
<typeDeclarationProvider implementation="org.jetbrains.kotlin.idea.codeInsight.KotlinTypeDeclarationProvider"/>
<completion.contributor language="kotlin"
+2
View File
@@ -482,6 +482,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<codeInsight.linkHandler prefix="#kotlinClass/" handlerClass="org.jetbrains.kotlin.idea.highlighter.markers.KotlinClassTooltipLinkHandler"/>
<defaultHighlightingSettingProvider language="kotlin" implementation="org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider"/>
<typeDeclarationProvider implementation="org.jetbrains.kotlin.idea.codeInsight.KotlinTypeDeclarationProvider"/>
<completion.contributor language="kotlin"
+2
View File
@@ -481,6 +481,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<codeInsight.linkHandler prefix="#kotlinClass/" handlerClass="org.jetbrains.kotlin.idea.highlighter.markers.KotlinClassTooltipLinkHandler"/>
<defaultHighlightingSettingProvider language="kotlin" implementation="org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider"/>
<typeDeclarationProvider implementation="org.jetbrains.kotlin.idea.codeInsight.KotlinTypeDeclarationProvider"/>
<completion.contributor language="kotlin"
+2
View File
@@ -481,6 +481,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<codeInsight.linkHandler prefix="#kotlinClass/" handlerClass="org.jetbrains.kotlin.idea.highlighter.markers.KotlinClassTooltipLinkHandler"/>
<defaultHighlightingSettingProvider language="kotlin" implementation="org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider"/>
<typeDeclarationProvider implementation="org.jetbrains.kotlin.idea.codeInsight.KotlinTypeDeclarationProvider"/>
<completion.contributor language="kotlin"
@@ -0,0 +1,21 @@
/*
* 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.idea.highlighter
import com.intellij.codeInsight.daemon.impl.analysis.DefaultHighlightingSettingProvider
import com.intellij.codeInsight.daemon.impl.analysis.FileHighlightingSetting
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
class KotlinDefaultHighlightingSettingsProvider : DefaultHighlightingSettingProvider() {
override fun getDefaultSetting(project: Project, file: VirtualFile): FileHighlightingSetting? {
return when {
ProjectRootsUtil.isProjectSourceFile(project, file) -> null
else -> FileHighlightingSetting.SKIP_INSPECTION
}
}
}