mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[workspace model] Improve performance of hot method which affect highlighting
GitOrigin-RevId: 6af6d47433b6b84b7694c1444201409b49fa3bb3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b8b84a83b7
commit
d568ba9438
+10
-6
@@ -32,12 +32,13 @@ internal class SourceFolderViaTypedEntity(private val entry: ContentEntryViaType
|
||||
: ContentFolderViaTypedEntity(entry, sourceRootEntity.url), SourceFolder {
|
||||
|
||||
private var packagePrefixVar: String? = null
|
||||
private val sourceRootType: JpsModuleSourceRootType<*> by lazy { getSourceRootType(sourceRootEntity.rootType) }
|
||||
|
||||
override fun getRootType() = sourceRootType
|
||||
override fun isTestSource() = sourceRootEntity.tests
|
||||
override fun getPackagePrefix() = packagePrefixVar ?:
|
||||
sourceRootEntity.asJavaSourceRoot()?.packagePrefix ?:
|
||||
sourceRootEntity.asJavaResourceRoot()?.relativeOutputPath?.replace('/', '.') ?: ""
|
||||
override fun getRootType() = getSourceRootType(sourceRootEntity.rootType)
|
||||
|
||||
override fun getJpsElement(): JpsModuleSourceRoot {
|
||||
val javaExtensionService = JpsJavaExtensionService.getInstance()
|
||||
@@ -139,11 +140,14 @@ internal class SourceFolderViaTypedEntity(private val entry: ContentEntryViaType
|
||||
packagePrefixVar = packagePrefix
|
||||
}
|
||||
|
||||
private fun getSourceRootType(rootType: String): JpsModuleSourceRootType<*> =
|
||||
JpsModelSerializerExtension.getExtensions()
|
||||
.flatMap { it.moduleSourceRootPropertiesSerializers }
|
||||
.firstOrNull { it.typeId == rootType }
|
||||
?.type ?: JavaSourceRootType.SOURCE
|
||||
private fun getSourceRootType(rootType: String): JpsModuleSourceRootType<*> {
|
||||
JpsModelSerializerExtension.getExtensions().forEach { extensions ->
|
||||
extensions.moduleSourceRootPropertiesSerializers.forEach {
|
||||
if (it.typeId == rootType) return it.type
|
||||
}
|
||||
}
|
||||
return JavaSourceRootType.SOURCE
|
||||
}
|
||||
|
||||
companion object {
|
||||
val LOG by lazy { logger<ContentFolderViaTypedEntity>() }
|
||||
|
||||
Reference in New Issue
Block a user