Do not highlight semantics in files not under module content
Related to KT-18221
This commit is contained in:
+5
-1
@@ -17,6 +17,8 @@
|
||||
package org.jetbrains.kotlin.idea.highlighter
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.NotUnderContentRootModuleInfo
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getModuleInfo
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
|
||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
@@ -24,7 +26,9 @@ import org.jetbrains.kotlin.psi.KtFile
|
||||
object KotlinHighlightingUtil {
|
||||
fun shouldHighlight(psiElement: PsiElement): Boolean {
|
||||
val ktFile = psiElement.containingFile as? KtFile ?: return false
|
||||
return (ktFile is KtCodeFragment && ktFile.context != null) || ktFile.isScript || ProjectRootsUtil.isInProjectOrLibraryContent(ktFile)
|
||||
return ktFile is KtCodeFragment && ktFile.context != null ||
|
||||
ktFile.isScript ||
|
||||
ProjectRootsUtil.isInProjectOrLibraryContent(ktFile) && ktFile.getModuleInfo() !is NotUnderContentRootModuleInfo
|
||||
}
|
||||
|
||||
fun shouldHighlightErrors(psiElement: PsiElement): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user