mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
Revert "[kotlin] K2: implement main.kts processing"
This reverts commit e28d0c131b70e529a19b6c09af984eecbdaa899f. GitOrigin-RevId: 1ab6f15415af8b05c77830fb5d25cb8638f9e5c8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9a260d7a93
commit
7b79dc0c6b
@@ -17,7 +17,7 @@ object MetadataStorageImpl: MetadataStorageBase() {
|
||||
|
||||
var typeMetadata: StorageTypeMetadata
|
||||
|
||||
typeMetadata = FinalClassMetadata.ClassMetadata(fqName = "org.jetbrains.kotlin.idea.core.script.KotlinScriptEntitySourceK2", properties = listOf(OwnPropertyMetadata(isComputable = false, isKey = false, isOpen = false, name = "virtualFileUrl", valueType = ValueTypeMetadata.SimpleType.CustomType(isNullable = false, typeMetadata = FinalClassMetadata.KnownClass(fqName = "com.intellij.platform.workspace.storage.url.VirtualFileUrl")), withDefault = false)), supertypes = listOf("com.intellij.platform.workspace.storage.EntitySource"))
|
||||
typeMetadata = FinalClassMetadata.ObjectMetadata(fqName = "org.jetbrains.kotlin.idea.core.script.KotlinK2ScriptEntitySource", properties = listOf(OwnPropertyMetadata(isComputable = false, isKey = false, isOpen = false, name = "virtualFileUrl", valueType = ValueTypeMetadata.SimpleType.CustomType(isNullable = true, typeMetadata = FinalClassMetadata.KnownClass(fqName = "com.intellij.platform.workspace.storage.url.VirtualFileUrl")), withDefault = false)), supertypes = listOf("com.intellij.platform.workspace.storage.EntitySource"))
|
||||
|
||||
addMetadata(typeMetadata)
|
||||
|
||||
@@ -71,7 +71,7 @@ OwnPropertyMetadata(isComputable = false, isKey = false, isOpen = false, name =
|
||||
addMetadataHash(typeFqn = "org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryRoot", metadataHash = 940316485)
|
||||
addMetadataHash(typeFqn = "org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryRootTypeId", metadataHash = -2068549764)
|
||||
addMetadataHash(typeFqn = "com.intellij.platform.workspace.storage.EntitySource", metadataHash = 1946578919)
|
||||
addMetadataHash(typeFqn = "org.jetbrains.kotlin.idea.core.script.KotlinScriptEntitySourceK2", metadataHash = -860768271)
|
||||
addMetadataHash(typeFqn = "org.jetbrains.kotlin.idea.core.script.KotlinK2ScriptEntitySource", metadataHash = 782346369)
|
||||
addMetadataHash(typeFqn = "org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptEntitySource", metadataHash = 236614476)
|
||||
addMetadataHash(typeFqn = "org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryEntitySource", metadataHash = 1353548779)
|
||||
addMetadataHash(typeFqn = "com.intellij.platform.workspace.storage.SymbolicEntityId", metadataHash = -194396395)
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.jetbrains.kotlin.idea.core.script.ucache
|
||||
|
||||
import com.intellij.platform.workspace.storage.*
|
||||
import com.intellij.platform.workspace.storage.EntitySource
|
||||
import com.intellij.platform.workspace.storage.EntityType
|
||||
import com.intellij.platform.workspace.storage.GeneratedCodeApiVersion
|
||||
import com.intellij.platform.workspace.storage.GeneratedCodeImplVersion
|
||||
import com.intellij.platform.workspace.storage.MutableEntityStorage
|
||||
@@ -20,281 +21,280 @@ import com.intellij.platform.workspace.storage.instrumentation.EntityStorageInst
|
||||
import com.intellij.platform.workspace.storage.instrumentation.EntityStorageInstrumentationApi
|
||||
import com.intellij.platform.workspace.storage.metadata.model.EntityMetadata
|
||||
import com.intellij.platform.workspace.storage.url.VirtualFileUrl
|
||||
import kotlin.jvm.JvmName
|
||||
import kotlin.jvm.JvmOverloads
|
||||
import kotlin.jvm.JvmStatic
|
||||
|
||||
@GeneratedCodeApiVersion(3)
|
||||
@GeneratedCodeImplVersion(5)
|
||||
open class KotlinScriptEntityImpl(private val dataSource: KotlinScriptEntityData) : KotlinScriptEntity, WorkspaceEntityBase(dataSource) {
|
||||
|
||||
private companion object {
|
||||
private companion object {
|
||||
|
||||
|
||||
private val connections = listOf<ConnectionId>(
|
||||
)
|
||||
private val connections = listOf<ConnectionId>(
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
override val path: String
|
||||
get() {
|
||||
readField("path")
|
||||
return dataSource.path
|
||||
}
|
||||
|
||||
override val dependencies: Set<KotlinScriptLibraryId>
|
||||
get() {
|
||||
readField("dependencies")
|
||||
return dataSource.dependencies
|
||||
}
|
||||
|
||||
override val entitySource: EntitySource
|
||||
get() {
|
||||
readField("entitySource")
|
||||
return dataSource.entitySource
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
|
||||
class Builder(result: KotlinScriptEntityData?) : ModifiableWorkspaceEntityBase<KotlinScriptEntity, KotlinScriptEntityData>(
|
||||
result), KotlinScriptEntity.Builder {
|
||||
constructor() : this(KotlinScriptEntityData())
|
||||
|
||||
override fun applyToBuilder(builder: MutableEntityStorage) {
|
||||
if (this.diff != null) {
|
||||
if (existsInBuilder(builder)) {
|
||||
this.diff = builder
|
||||
return
|
||||
override val path: String
|
||||
get() {
|
||||
readField("path")
|
||||
return dataSource.path
|
||||
}
|
||||
else {
|
||||
error("Entity KotlinScriptEntity is already created in a different builder")
|
||||
|
||||
override val dependencies: Set<KotlinScriptLibraryId>
|
||||
get() {
|
||||
readField("dependencies")
|
||||
return dataSource.dependencies
|
||||
}
|
||||
}
|
||||
|
||||
this.diff = builder
|
||||
addToBuilder()
|
||||
this.id = getEntityData().createEntityId()
|
||||
// After adding entity data to the builder, we need to unbind it and move the control over entity data to builder
|
||||
// Builder may switch to snapshot at any moment and lock entity data to modification
|
||||
this.currentEntityData = null
|
||||
|
||||
// Process linked entities that are connected without a builder
|
||||
processLinkedEntities(builder)
|
||||
checkInitialization() // TODO uncomment and check failed tests
|
||||
}
|
||||
|
||||
private fun checkInitialization() {
|
||||
val _diff = diff
|
||||
if (!getEntityData().isEntitySourceInitialized()) {
|
||||
error("Field WorkspaceEntity#entitySource should be initialized")
|
||||
}
|
||||
if (!getEntityData().isPathInitialized()) {
|
||||
error("Field KotlinScriptEntity#path should be initialized")
|
||||
}
|
||||
if (!getEntityData().isDependenciesInitialized()) {
|
||||
error("Field KotlinScriptEntity#dependencies should be initialized")
|
||||
}
|
||||
}
|
||||
override val entitySource: EntitySource
|
||||
get() {
|
||||
readField("entitySource")
|
||||
return dataSource.entitySource
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
override fun afterModification() {
|
||||
val collection_dependencies = getEntityData().dependencies
|
||||
if (collection_dependencies is MutableWorkspaceSet<*>) {
|
||||
collection_dependencies.cleanModificationUpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
// Relabeling code, move information from dataSource to this builder
|
||||
override fun relabel(dataSource: WorkspaceEntity, parents: Set<WorkspaceEntity>?) {
|
||||
dataSource as KotlinScriptEntity
|
||||
if (this.entitySource != dataSource.entitySource) this.entitySource = dataSource.entitySource
|
||||
if (this.path != dataSource.path) this.path = dataSource.path
|
||||
if (this.dependencies != dataSource.dependencies) this.dependencies = dataSource.dependencies.toMutableSet()
|
||||
updateChildToParentReferences(parents)
|
||||
return connections
|
||||
}
|
||||
|
||||
|
||||
override var entitySource: EntitySource
|
||||
get() = getEntityData().entitySource
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).entitySource = value
|
||||
changedProperty.add("entitySource")
|
||||
class Builder(result: KotlinScriptEntityData?) : ModifiableWorkspaceEntityBase<KotlinScriptEntity, KotlinScriptEntityData>(result),
|
||||
KotlinScriptEntity.Builder {
|
||||
constructor() : this(KotlinScriptEntityData())
|
||||
|
||||
}
|
||||
override fun applyToBuilder(builder: MutableEntityStorage) {
|
||||
if (this.diff != null) {
|
||||
if (existsInBuilder(builder)) {
|
||||
this.diff = builder
|
||||
return
|
||||
} else {
|
||||
error("Entity KotlinScriptEntity is already created in a different builder")
|
||||
}
|
||||
}
|
||||
|
||||
override var path: String
|
||||
get() = getEntityData().path
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).path = value
|
||||
changedProperty.add("path")
|
||||
}
|
||||
this.diff = builder
|
||||
addToBuilder()
|
||||
this.id = getEntityData().createEntityId()
|
||||
// After adding entity data to the builder, we need to unbind it and move the control over entity data to builder
|
||||
// Builder may switch to snapshot at any moment and lock entity data to modification
|
||||
this.currentEntityData = null
|
||||
|
||||
private val dependenciesUpdater: (value: Set<KotlinScriptLibraryId>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("dependencies")
|
||||
}
|
||||
override var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
get() {
|
||||
val collection_dependencies = getEntityData().dependencies
|
||||
if (collection_dependencies !is MutableWorkspaceSet) return collection_dependencies
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_dependencies.setModificationUpdateAction(dependenciesUpdater)
|
||||
// Process linked entities that are connected without a builder
|
||||
processLinkedEntities(builder)
|
||||
checkInitialization() // TODO uncomment and check failed tests
|
||||
}
|
||||
else {
|
||||
collection_dependencies.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_dependencies
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).dependencies = value
|
||||
dependenciesUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override fun getEntityClass(): Class<KotlinScriptEntity> = KotlinScriptEntity::class.java
|
||||
}
|
||||
private fun checkInitialization() {
|
||||
val _diff = diff
|
||||
if (!getEntityData().isEntitySourceInitialized()) {
|
||||
error("Field WorkspaceEntity#entitySource should be initialized")
|
||||
}
|
||||
if (!getEntityData().isPathInitialized()) {
|
||||
error("Field KotlinScriptEntity#path should be initialized")
|
||||
}
|
||||
if (!getEntityData().isDependenciesInitialized()) {
|
||||
error("Field KotlinScriptEntity#dependencies should be initialized")
|
||||
}
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
override fun afterModification() {
|
||||
val collection_dependencies = getEntityData().dependencies
|
||||
if (collection_dependencies is MutableWorkspaceSet<*>) {
|
||||
collection_dependencies.cleanModificationUpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
// Relabeling code, move information from dataSource to this builder
|
||||
override fun relabel(dataSource: WorkspaceEntity, parents: Set<WorkspaceEntity>?) {
|
||||
dataSource as KotlinScriptEntity
|
||||
if (this.entitySource != dataSource.entitySource) this.entitySource = dataSource.entitySource
|
||||
if (this.path != dataSource.path) this.path = dataSource.path
|
||||
if (this.dependencies != dataSource.dependencies) this.dependencies = dataSource.dependencies.toMutableSet()
|
||||
updateChildToParentReferences(parents)
|
||||
}
|
||||
|
||||
|
||||
override var entitySource: EntitySource
|
||||
get() = getEntityData().entitySource
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).entitySource = value
|
||||
changedProperty.add("entitySource")
|
||||
|
||||
}
|
||||
|
||||
override var path: String
|
||||
get() = getEntityData().path
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).path = value
|
||||
changedProperty.add("path")
|
||||
}
|
||||
|
||||
private val dependenciesUpdater: (value: Set<KotlinScriptLibraryId>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("dependencies")
|
||||
}
|
||||
override var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
get() {
|
||||
val collection_dependencies = getEntityData().dependencies
|
||||
if (collection_dependencies !is MutableWorkspaceSet) return collection_dependencies
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_dependencies.setModificationUpdateAction(dependenciesUpdater)
|
||||
} else {
|
||||
collection_dependencies.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_dependencies
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).dependencies = value
|
||||
dependenciesUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override fun getEntityClass(): Class<KotlinScriptEntity> = KotlinScriptEntity::class.java
|
||||
}
|
||||
}
|
||||
|
||||
class KotlinScriptEntityData : WorkspaceEntityData<KotlinScriptEntity>(), SoftLinkable {
|
||||
lateinit var path: String
|
||||
lateinit var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
lateinit var path: String
|
||||
lateinit var dependencies: MutableSet<KotlinScriptLibraryId>
|
||||
|
||||
internal fun isPathInitialized(): Boolean = ::path.isInitialized
|
||||
internal fun isDependenciesInitialized(): Boolean = ::dependencies.isInitialized
|
||||
internal fun isPathInitialized(): Boolean = ::path.isInitialized
|
||||
internal fun isDependenciesInitialized(): Boolean = ::dependencies.isInitialized
|
||||
|
||||
override fun getLinks(): Set<SymbolicEntityId<*>> {
|
||||
val result = HashSet<SymbolicEntityId<*>>()
|
||||
for (item in dependencies) {
|
||||
result.add(item)
|
||||
override fun getLinks(): Set<SymbolicEntityId<*>> {
|
||||
val result = HashSet<SymbolicEntityId<*>>()
|
||||
for (item in dependencies) {
|
||||
result.add(item)
|
||||
}
|
||||
return result
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun index(index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
for (item in dependencies) {
|
||||
index.index(this, item)
|
||||
override fun index(index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
for (item in dependencies) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLinksIndex(prev: Set<SymbolicEntityId<*>>, index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
// TODO verify logic
|
||||
val mutablePreviousSet = HashSet(prev)
|
||||
for (item in dependencies) {
|
||||
val removedItem_item = mutablePreviousSet.remove(item)
|
||||
if (!removedItem_item) {
|
||||
index.index(this, item)
|
||||
}
|
||||
override fun updateLinksIndex(prev: Set<SymbolicEntityId<*>>, index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
// TODO verify logic
|
||||
val mutablePreviousSet = HashSet(prev)
|
||||
for (item in dependencies) {
|
||||
val removedItem_item = mutablePreviousSet.remove(item)
|
||||
if (!removedItem_item) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
for (removed in mutablePreviousSet) {
|
||||
index.remove(this, removed)
|
||||
}
|
||||
}
|
||||
for (removed in mutablePreviousSet) {
|
||||
index.remove(this, removed)
|
||||
|
||||
override fun updateLink(oldLink: SymbolicEntityId<*>, newLink: SymbolicEntityId<*>): Boolean {
|
||||
var changed = false
|
||||
val dependencies_data = dependencies.map {
|
||||
val it_data = if (it == oldLink) {
|
||||
changed = true
|
||||
newLink as KotlinScriptLibraryId
|
||||
} else {
|
||||
null
|
||||
}
|
||||
if (it_data != null) {
|
||||
it_data
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
if (dependencies_data != null) {
|
||||
dependencies = dependencies_data as MutableSet<KotlinScriptLibraryId>
|
||||
}
|
||||
return changed
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLink(oldLink: SymbolicEntityId<*>, newLink: SymbolicEntityId<*>): Boolean {
|
||||
var changed = false
|
||||
val dependencies_data = dependencies.map {
|
||||
val it_data = if (it == oldLink) {
|
||||
changed = true
|
||||
newLink as KotlinScriptLibraryId
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
if (it_data != null) {
|
||||
it_data
|
||||
}
|
||||
else {
|
||||
it
|
||||
}
|
||||
override fun wrapAsModifiable(diff: MutableEntityStorage): WorkspaceEntity.Builder<KotlinScriptEntity> {
|
||||
val modifiable = KotlinScriptEntityImpl.Builder(null)
|
||||
modifiable.diff = diff
|
||||
modifiable.id = createEntityId()
|
||||
return modifiable
|
||||
}
|
||||
if (dependencies_data != null) {
|
||||
dependencies = dependencies_data as MutableSet<KotlinScriptLibraryId>
|
||||
|
||||
@OptIn(EntityStorageInstrumentationApi::class)
|
||||
override fun createEntity(snapshot: EntityStorageInstrumentation): KotlinScriptEntity {
|
||||
val entityId = createEntityId()
|
||||
return snapshot.initializeEntity(entityId) {
|
||||
val entity = KotlinScriptEntityImpl(this)
|
||||
entity.snapshot = snapshot
|
||||
entity.id = entityId
|
||||
entity
|
||||
}
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
override fun wrapAsModifiable(diff: MutableEntityStorage): WorkspaceEntity.Builder<KotlinScriptEntity> {
|
||||
val modifiable = KotlinScriptEntityImpl.Builder(null)
|
||||
modifiable.diff = diff
|
||||
modifiable.id = createEntityId()
|
||||
return modifiable
|
||||
}
|
||||
|
||||
@OptIn(EntityStorageInstrumentationApi::class)
|
||||
override fun createEntity(snapshot: EntityStorageInstrumentation): KotlinScriptEntity {
|
||||
val entityId = createEntityId()
|
||||
return snapshot.initializeEntity(entityId) {
|
||||
val entity = KotlinScriptEntityImpl(this)
|
||||
entity.snapshot = snapshot
|
||||
entity.id = entityId
|
||||
entity
|
||||
override fun getMetadata(): EntityMetadata {
|
||||
return MetadataStorageImpl.getMetadataByTypeFqn("org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptEntity") as EntityMetadata
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMetadata(): EntityMetadata {
|
||||
return MetadataStorageImpl.getMetadataByTypeFqn("org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptEntity") as EntityMetadata
|
||||
}
|
||||
|
||||
override fun clone(): KotlinScriptEntityData {
|
||||
val clonedEntity = super.clone()
|
||||
clonedEntity as KotlinScriptEntityData
|
||||
clonedEntity.dependencies = clonedEntity.dependencies.toMutableWorkspaceSet()
|
||||
return clonedEntity
|
||||
}
|
||||
|
||||
override fun getEntityInterface(): Class<out WorkspaceEntity> {
|
||||
return KotlinScriptEntity::class.java
|
||||
}
|
||||
|
||||
override fun createDetachedEntity(parents: List<WorkspaceEntity.Builder<*>>): WorkspaceEntity.Builder<*> {
|
||||
return KotlinScriptEntity(path, dependencies, entitySource) {
|
||||
override fun clone(): KotlinScriptEntityData {
|
||||
val clonedEntity = super.clone()
|
||||
clonedEntity as KotlinScriptEntityData
|
||||
clonedEntity.dependencies = clonedEntity.dependencies.toMutableWorkspaceSet()
|
||||
return clonedEntity
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRequiredParents(): List<Class<out WorkspaceEntity>> {
|
||||
val res = mutableListOf<Class<out WorkspaceEntity>>()
|
||||
return res
|
||||
}
|
||||
override fun getEntityInterface(): Class<out WorkspaceEntity> {
|
||||
return KotlinScriptEntity::class.java
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
override fun createDetachedEntity(parents: List<WorkspaceEntity.Builder<*>>): WorkspaceEntity.Builder<*> {
|
||||
return KotlinScriptEntity(path, dependencies, entitySource) {
|
||||
}
|
||||
}
|
||||
|
||||
other as KotlinScriptEntityData
|
||||
override fun getRequiredParents(): List<Class<out WorkspaceEntity>> {
|
||||
val res = mutableListOf<Class<out WorkspaceEntity>>()
|
||||
return res
|
||||
}
|
||||
|
||||
if (this.entitySource != other.entitySource) return false
|
||||
if (this.path != other.path) return false
|
||||
if (this.dependencies != other.dependencies) return false
|
||||
return true
|
||||
}
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
|
||||
override fun equalsIgnoringEntitySource(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
other as KotlinScriptEntityData
|
||||
|
||||
other as KotlinScriptEntityData
|
||||
if (this.entitySource != other.entitySource) return false
|
||||
if (this.path != other.path) return false
|
||||
if (this.dependencies != other.dependencies) return false
|
||||
return true
|
||||
}
|
||||
|
||||
if (this.path != other.path) return false
|
||||
if (this.dependencies != other.dependencies) return false
|
||||
return true
|
||||
}
|
||||
override fun equalsIgnoringEntitySource(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = entitySource.hashCode()
|
||||
result = 31 * result + path.hashCode()
|
||||
result = 31 * result + dependencies.hashCode()
|
||||
return result
|
||||
}
|
||||
other as KotlinScriptEntityData
|
||||
|
||||
override fun hashCodeIgnoringEntitySource(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + path.hashCode()
|
||||
result = 31 * result + dependencies.hashCode()
|
||||
return result
|
||||
}
|
||||
if (this.path != other.path) return false
|
||||
if (this.dependencies != other.dependencies) return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = entitySource.hashCode()
|
||||
result = 31 * result + path.hashCode()
|
||||
result = 31 * result + dependencies.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun hashCodeIgnoringEntitySource(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + path.hashCode()
|
||||
result = 31 * result + dependencies.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.core.script.ucache
|
||||
|
||||
import com.intellij.platform.workspace.storage.*
|
||||
import com.intellij.platform.workspace.storage.EntitySource
|
||||
import com.intellij.platform.workspace.storage.EntityType
|
||||
import com.intellij.platform.workspace.storage.GeneratedCodeApiVersion
|
||||
import com.intellij.platform.workspace.storage.GeneratedCodeImplVersion
|
||||
import com.intellij.platform.workspace.storage.MutableEntityStorage
|
||||
import com.intellij.platform.workspace.storage.SymbolicEntityId
|
||||
import com.intellij.platform.workspace.storage.WorkspaceEntity
|
||||
import com.intellij.platform.workspace.storage.WorkspaceEntityWithSymbolicId
|
||||
import com.intellij.platform.workspace.storage.impl.ConnectionId
|
||||
import com.intellij.platform.workspace.storage.impl.ModifiableWorkspaceEntityBase
|
||||
import com.intellij.platform.workspace.storage.impl.SoftLinkable
|
||||
@@ -23,352 +24,349 @@ import com.intellij.platform.workspace.storage.instrumentation.EntityStorageInst
|
||||
import com.intellij.platform.workspace.storage.metadata.model.EntityMetadata
|
||||
import com.intellij.platform.workspace.storage.url.VirtualFileUrl
|
||||
import java.io.Serializable
|
||||
import kotlin.jvm.JvmName
|
||||
import kotlin.jvm.JvmOverloads
|
||||
import kotlin.jvm.JvmStatic
|
||||
|
||||
@GeneratedCodeApiVersion(3)
|
||||
@GeneratedCodeImplVersion(5)
|
||||
open class KotlinScriptLibraryEntityImpl(private val dataSource: KotlinScriptLibraryEntityData) : KotlinScriptLibraryEntity, WorkspaceEntityBase(
|
||||
dataSource) {
|
||||
open class KotlinScriptLibraryEntityImpl(private val dataSource: KotlinScriptLibraryEntityData) : KotlinScriptLibraryEntity,
|
||||
WorkspaceEntityBase(dataSource) {
|
||||
|
||||
private companion object {
|
||||
private companion object {
|
||||
|
||||
|
||||
private val connections = listOf<ConnectionId>(
|
||||
)
|
||||
private val connections = listOf<ConnectionId>(
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
override val name: String
|
||||
get() {
|
||||
readField("name")
|
||||
return dataSource.name
|
||||
}
|
||||
|
||||
override val roots: List<KotlinScriptLibraryRoot>
|
||||
get() {
|
||||
readField("roots")
|
||||
return dataSource.roots
|
||||
}
|
||||
|
||||
override val indexSourceRoots: Boolean
|
||||
get() {
|
||||
readField("indexSourceRoots")
|
||||
return dataSource.indexSourceRoots
|
||||
}
|
||||
override val usedInScripts: Set<KotlinScriptId>
|
||||
get() {
|
||||
readField("usedInScripts")
|
||||
return dataSource.usedInScripts
|
||||
}
|
||||
|
||||
override val entitySource: EntitySource
|
||||
get() {
|
||||
readField("entitySource")
|
||||
return dataSource.entitySource
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
|
||||
class Builder(result: KotlinScriptLibraryEntityData?) : ModifiableWorkspaceEntityBase<KotlinScriptLibraryEntity, KotlinScriptLibraryEntityData>(
|
||||
result), KotlinScriptLibraryEntity.Builder {
|
||||
constructor() : this(KotlinScriptLibraryEntityData())
|
||||
|
||||
override fun applyToBuilder(builder: MutableEntityStorage) {
|
||||
if (this.diff != null) {
|
||||
if (existsInBuilder(builder)) {
|
||||
this.diff = builder
|
||||
return
|
||||
override val name: String
|
||||
get() {
|
||||
readField("name")
|
||||
return dataSource.name
|
||||
}
|
||||
else {
|
||||
error("Entity KotlinScriptLibraryEntity is already created in a different builder")
|
||||
|
||||
override val roots: List<KotlinScriptLibraryRoot>
|
||||
get() {
|
||||
readField("roots")
|
||||
return dataSource.roots
|
||||
}
|
||||
}
|
||||
|
||||
this.diff = builder
|
||||
addToBuilder()
|
||||
this.id = getEntityData().createEntityId()
|
||||
// After adding entity data to the builder, we need to unbind it and move the control over entity data to builder
|
||||
// Builder may switch to snapshot at any moment and lock entity data to modification
|
||||
this.currentEntityData = null
|
||||
override val indexSourceRoots: Boolean
|
||||
get() {
|
||||
readField("indexSourceRoots")
|
||||
return dataSource.indexSourceRoots
|
||||
}
|
||||
override val usedInScripts: Set<KotlinScriptId>
|
||||
get() {
|
||||
readField("usedInScripts")
|
||||
return dataSource.usedInScripts
|
||||
}
|
||||
|
||||
// Process linked entities that are connected without a builder
|
||||
processLinkedEntities(builder)
|
||||
checkInitialization() // TODO uncomment and check failed tests
|
||||
}
|
||||
|
||||
private fun checkInitialization() {
|
||||
val _diff = diff
|
||||
if (!getEntityData().isEntitySourceInitialized()) {
|
||||
error("Field WorkspaceEntity#entitySource should be initialized")
|
||||
}
|
||||
if (!getEntityData().isNameInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#name should be initialized")
|
||||
}
|
||||
if (!getEntityData().isRootsInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#roots should be initialized")
|
||||
}
|
||||
if (!getEntityData().isUsedInScriptsInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#usedInScripts should be initialized")
|
||||
}
|
||||
}
|
||||
override val entitySource: EntitySource
|
||||
get() {
|
||||
readField("entitySource")
|
||||
return dataSource.entitySource
|
||||
}
|
||||
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
override fun afterModification() {
|
||||
val collection_roots = getEntityData().roots
|
||||
if (collection_roots is MutableWorkspaceList<*>) {
|
||||
collection_roots.cleanModificationUpdateAction()
|
||||
}
|
||||
val collection_usedInScripts = getEntityData().usedInScripts
|
||||
if (collection_usedInScripts is MutableWorkspaceSet<*>) {
|
||||
collection_usedInScripts.cleanModificationUpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
// Relabeling code, move information from dataSource to this builder
|
||||
override fun relabel(dataSource: WorkspaceEntity, parents: Set<WorkspaceEntity>?) {
|
||||
dataSource as KotlinScriptLibraryEntity
|
||||
if (this.entitySource != dataSource.entitySource) this.entitySource = dataSource.entitySource
|
||||
if (this.name != dataSource.name) this.name = dataSource.name
|
||||
if (this.roots != dataSource.roots) this.roots = dataSource.roots.toMutableList()
|
||||
if (this.indexSourceRoots != dataSource.indexSourceRoots) this.indexSourceRoots = dataSource.indexSourceRoots
|
||||
if (this.usedInScripts != dataSource.usedInScripts) this.usedInScripts = dataSource.usedInScripts.toMutableSet()
|
||||
updateChildToParentReferences(parents)
|
||||
return connections
|
||||
}
|
||||
|
||||
|
||||
override var entitySource: EntitySource
|
||||
get() = getEntityData().entitySource
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).entitySource = value
|
||||
changedProperty.add("entitySource")
|
||||
class Builder(result: KotlinScriptLibraryEntityData?) :
|
||||
ModifiableWorkspaceEntityBase<KotlinScriptLibraryEntity, KotlinScriptLibraryEntityData>(result), KotlinScriptLibraryEntity.Builder {
|
||||
constructor() : this(KotlinScriptLibraryEntityData())
|
||||
|
||||
}
|
||||
override fun applyToBuilder(builder: MutableEntityStorage) {
|
||||
if (this.diff != null) {
|
||||
if (existsInBuilder(builder)) {
|
||||
this.diff = builder
|
||||
return
|
||||
} else {
|
||||
error("Entity KotlinScriptLibraryEntity is already created in a different builder")
|
||||
}
|
||||
}
|
||||
|
||||
override var name: String
|
||||
get() = getEntityData().name
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).name = value
|
||||
changedProperty.add("name")
|
||||
}
|
||||
this.diff = builder
|
||||
addToBuilder()
|
||||
this.id = getEntityData().createEntityId()
|
||||
// After adding entity data to the builder, we need to unbind it and move the control over entity data to builder
|
||||
// Builder may switch to snapshot at any moment and lock entity data to modification
|
||||
this.currentEntityData = null
|
||||
|
||||
private val rootsUpdater: (value: List<KotlinScriptLibraryRoot>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("roots")
|
||||
}
|
||||
override var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
get() {
|
||||
val collection_roots = getEntityData().roots
|
||||
if (collection_roots !is MutableWorkspaceList) return collection_roots
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_roots.setModificationUpdateAction(rootsUpdater)
|
||||
// Process linked entities that are connected without a builder
|
||||
processLinkedEntities(builder)
|
||||
checkInitialization() // TODO uncomment and check failed tests
|
||||
}
|
||||
else {
|
||||
collection_roots.cleanModificationUpdateAction()
|
||||
|
||||
private fun checkInitialization() {
|
||||
val _diff = diff
|
||||
if (!getEntityData().isEntitySourceInitialized()) {
|
||||
error("Field WorkspaceEntity#entitySource should be initialized")
|
||||
}
|
||||
if (!getEntityData().isNameInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#name should be initialized")
|
||||
}
|
||||
if (!getEntityData().isRootsInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#roots should be initialized")
|
||||
}
|
||||
if (!getEntityData().isUsedInScriptsInitialized()) {
|
||||
error("Field KotlinScriptLibraryEntity#usedInScripts should be initialized")
|
||||
}
|
||||
}
|
||||
return collection_roots
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).roots = value
|
||||
rootsUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override var indexSourceRoots: Boolean
|
||||
get() = getEntityData().indexSourceRoots
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).indexSourceRoots = value
|
||||
changedProperty.add("indexSourceRoots")
|
||||
}
|
||||
override fun connectionIdList(): List<ConnectionId> {
|
||||
return connections
|
||||
}
|
||||
|
||||
private val usedInScriptsUpdater: (value: Set<KotlinScriptId>) -> Unit = { value ->
|
||||
override fun afterModification() {
|
||||
val collection_roots = getEntityData().roots
|
||||
if (collection_roots is MutableWorkspaceList<*>) {
|
||||
collection_roots.cleanModificationUpdateAction()
|
||||
}
|
||||
val collection_usedInScripts = getEntityData().usedInScripts
|
||||
if (collection_usedInScripts is MutableWorkspaceSet<*>) {
|
||||
collection_usedInScripts.cleanModificationUpdateAction()
|
||||
}
|
||||
}
|
||||
|
||||
changedProperty.add("usedInScripts")
|
||||
// Relabeling code, move information from dataSource to this builder
|
||||
override fun relabel(dataSource: WorkspaceEntity, parents: Set<WorkspaceEntity>?) {
|
||||
dataSource as KotlinScriptLibraryEntity
|
||||
if (this.entitySource != dataSource.entitySource) this.entitySource = dataSource.entitySource
|
||||
if (this.name != dataSource.name) this.name = dataSource.name
|
||||
if (this.roots != dataSource.roots) this.roots = dataSource.roots.toMutableList()
|
||||
if (this.indexSourceRoots != dataSource.indexSourceRoots) this.indexSourceRoots = dataSource.indexSourceRoots
|
||||
if (this.usedInScripts != dataSource.usedInScripts) this.usedInScripts = dataSource.usedInScripts.toMutableSet()
|
||||
updateChildToParentReferences(parents)
|
||||
}
|
||||
|
||||
|
||||
override var entitySource: EntitySource
|
||||
get() = getEntityData().entitySource
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).entitySource = value
|
||||
changedProperty.add("entitySource")
|
||||
|
||||
}
|
||||
|
||||
override var name: String
|
||||
get() = getEntityData().name
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).name = value
|
||||
changedProperty.add("name")
|
||||
}
|
||||
|
||||
private val rootsUpdater: (value: List<KotlinScriptLibraryRoot>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("roots")
|
||||
}
|
||||
override var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
get() {
|
||||
val collection_roots = getEntityData().roots
|
||||
if (collection_roots !is MutableWorkspaceList) return collection_roots
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_roots.setModificationUpdateAction(rootsUpdater)
|
||||
} else {
|
||||
collection_roots.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_roots
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).roots = value
|
||||
rootsUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override var indexSourceRoots: Boolean
|
||||
get() = getEntityData().indexSourceRoots
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).indexSourceRoots = value
|
||||
changedProperty.add("indexSourceRoots")
|
||||
}
|
||||
|
||||
private val usedInScriptsUpdater: (value: Set<KotlinScriptId>) -> Unit = { value ->
|
||||
|
||||
changedProperty.add("usedInScripts")
|
||||
}
|
||||
override var usedInScripts: MutableSet<KotlinScriptId>
|
||||
get() {
|
||||
val collection_usedInScripts = getEntityData().usedInScripts
|
||||
if (collection_usedInScripts !is MutableWorkspaceSet) return collection_usedInScripts
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_usedInScripts.setModificationUpdateAction(usedInScriptsUpdater)
|
||||
} else {
|
||||
collection_usedInScripts.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_usedInScripts
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).usedInScripts = value
|
||||
usedInScriptsUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override fun getEntityClass(): Class<KotlinScriptLibraryEntity> = KotlinScriptLibraryEntity::class.java
|
||||
}
|
||||
override var usedInScripts: MutableSet<KotlinScriptId>
|
||||
get() {
|
||||
val collection_usedInScripts = getEntityData().usedInScripts
|
||||
if (collection_usedInScripts !is MutableWorkspaceSet) return collection_usedInScripts
|
||||
if (diff == null || modifiable.get()) {
|
||||
collection_usedInScripts.setModificationUpdateAction(usedInScriptsUpdater)
|
||||
}
|
||||
else {
|
||||
collection_usedInScripts.cleanModificationUpdateAction()
|
||||
}
|
||||
return collection_usedInScripts
|
||||
}
|
||||
set(value) {
|
||||
checkModificationAllowed()
|
||||
getEntityData(true).usedInScripts = value
|
||||
usedInScriptsUpdater.invoke(value)
|
||||
}
|
||||
|
||||
override fun getEntityClass(): Class<KotlinScriptLibraryEntity> = KotlinScriptLibraryEntity::class.java
|
||||
}
|
||||
}
|
||||
|
||||
class KotlinScriptLibraryEntityData : WorkspaceEntityData<KotlinScriptLibraryEntity>(), SoftLinkable {
|
||||
lateinit var name: String
|
||||
lateinit var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
var indexSourceRoots: Boolean = false
|
||||
lateinit var usedInScripts: MutableSet<KotlinScriptId>
|
||||
lateinit var name: String
|
||||
lateinit var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
var indexSourceRoots: Boolean = false
|
||||
lateinit var usedInScripts: MutableSet<KotlinScriptId>
|
||||
|
||||
internal fun isNameInitialized(): Boolean = ::name.isInitialized
|
||||
internal fun isRootsInitialized(): Boolean = ::roots.isInitialized
|
||||
internal fun isNameInitialized(): Boolean = ::name.isInitialized
|
||||
internal fun isRootsInitialized(): Boolean = ::roots.isInitialized
|
||||
|
||||
internal fun isUsedInScriptsInitialized(): Boolean = ::usedInScripts.isInitialized
|
||||
internal fun isUsedInScriptsInitialized(): Boolean = ::usedInScripts.isInitialized
|
||||
|
||||
override fun getLinks(): Set<SymbolicEntityId<*>> {
|
||||
val result = HashSet<SymbolicEntityId<*>>()
|
||||
for (item in roots) {
|
||||
override fun getLinks(): Set<SymbolicEntityId<*>> {
|
||||
val result = HashSet<SymbolicEntityId<*>>()
|
||||
for (item in roots) {
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
result.add(item)
|
||||
}
|
||||
return result
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
result.add(item)
|
||||
|
||||
override fun index(index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
for (item in roots) {
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun index(index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
for (item in roots) {
|
||||
override fun updateLinksIndex(prev: Set<SymbolicEntityId<*>>, index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
// TODO verify logic
|
||||
val mutablePreviousSet = HashSet(prev)
|
||||
for (item in roots) {
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
val removedItem_item = mutablePreviousSet.remove(item)
|
||||
if (!removedItem_item) {
|
||||
index.index(this, item)
|
||||
}
|
||||
}
|
||||
for (removed in mutablePreviousSet) {
|
||||
index.remove(this, removed)
|
||||
}
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
index.index(this, item)
|
||||
|
||||
override fun updateLink(oldLink: SymbolicEntityId<*>, newLink: SymbolicEntityId<*>): Boolean {
|
||||
var changed = false
|
||||
val usedInScripts_data = usedInScripts.map {
|
||||
val it_data = if (it == oldLink) {
|
||||
changed = true
|
||||
newLink as KotlinScriptId
|
||||
} else {
|
||||
null
|
||||
}
|
||||
if (it_data != null) {
|
||||
it_data
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
if (usedInScripts_data != null) {
|
||||
usedInScripts = usedInScripts_data as MutableSet<KotlinScriptId>
|
||||
}
|
||||
return changed
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLinksIndex(prev: Set<SymbolicEntityId<*>>, index: WorkspaceMutableIndex<SymbolicEntityId<*>>) {
|
||||
// TODO verify logic
|
||||
val mutablePreviousSet = HashSet(prev)
|
||||
for (item in roots) {
|
||||
override fun wrapAsModifiable(diff: MutableEntityStorage): WorkspaceEntity.Builder<KotlinScriptLibraryEntity> {
|
||||
val modifiable = KotlinScriptLibraryEntityImpl.Builder(null)
|
||||
modifiable.diff = diff
|
||||
modifiable.id = createEntityId()
|
||||
return modifiable
|
||||
}
|
||||
for (item in usedInScripts) {
|
||||
val removedItem_item = mutablePreviousSet.remove(item)
|
||||
if (!removedItem_item) {
|
||||
index.index(this, item)
|
||||
}
|
||||
|
||||
@OptIn(EntityStorageInstrumentationApi::class)
|
||||
override fun createEntity(snapshot: EntityStorageInstrumentation): KotlinScriptLibraryEntity {
|
||||
val entityId = createEntityId()
|
||||
return snapshot.initializeEntity(entityId) {
|
||||
val entity = KotlinScriptLibraryEntityImpl(this)
|
||||
entity.snapshot = snapshot
|
||||
entity.id = entityId
|
||||
entity
|
||||
}
|
||||
}
|
||||
for (removed in mutablePreviousSet) {
|
||||
index.remove(this, removed)
|
||||
|
||||
override fun getMetadata(): EntityMetadata {
|
||||
return MetadataStorageImpl.getMetadataByTypeFqn("org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryEntity") as EntityMetadata
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLink(oldLink: SymbolicEntityId<*>, newLink: SymbolicEntityId<*>): Boolean {
|
||||
var changed = false
|
||||
val usedInScripts_data = usedInScripts.map {
|
||||
val it_data = if (it == oldLink) {
|
||||
changed = true
|
||||
newLink as KotlinScriptId
|
||||
}
|
||||
else {
|
||||
null
|
||||
}
|
||||
if (it_data != null) {
|
||||
it_data
|
||||
}
|
||||
else {
|
||||
it
|
||||
}
|
||||
override fun clone(): KotlinScriptLibraryEntityData {
|
||||
val clonedEntity = super.clone()
|
||||
clonedEntity as KotlinScriptLibraryEntityData
|
||||
clonedEntity.roots = clonedEntity.roots.toMutableWorkspaceList()
|
||||
clonedEntity.usedInScripts = clonedEntity.usedInScripts.toMutableWorkspaceSet()
|
||||
return clonedEntity
|
||||
}
|
||||
if (usedInScripts_data != null) {
|
||||
usedInScripts = usedInScripts_data as MutableSet<KotlinScriptId>
|
||||
|
||||
override fun getEntityInterface(): Class<out WorkspaceEntity> {
|
||||
return KotlinScriptLibraryEntity::class.java
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
override fun wrapAsModifiable(diff: MutableEntityStorage): WorkspaceEntity.Builder<KotlinScriptLibraryEntity> {
|
||||
val modifiable = KotlinScriptLibraryEntityImpl.Builder(null)
|
||||
modifiable.diff = diff
|
||||
modifiable.id = createEntityId()
|
||||
return modifiable
|
||||
}
|
||||
|
||||
@OptIn(EntityStorageInstrumentationApi::class)
|
||||
override fun createEntity(snapshot: EntityStorageInstrumentation): KotlinScriptLibraryEntity {
|
||||
val entityId = createEntityId()
|
||||
return snapshot.initializeEntity(entityId) {
|
||||
val entity = KotlinScriptLibraryEntityImpl(this)
|
||||
entity.snapshot = snapshot
|
||||
entity.id = entityId
|
||||
entity
|
||||
override fun createDetachedEntity(parents: List<WorkspaceEntity.Builder<*>>): WorkspaceEntity.Builder<*> {
|
||||
return KotlinScriptLibraryEntity(name, roots, indexSourceRoots, usedInScripts, entitySource) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getMetadata(): EntityMetadata {
|
||||
return MetadataStorageImpl.getMetadataByTypeFqn(
|
||||
"org.jetbrains.kotlin.idea.core.script.ucache.KotlinScriptLibraryEntity") as EntityMetadata
|
||||
}
|
||||
|
||||
override fun clone(): KotlinScriptLibraryEntityData {
|
||||
val clonedEntity = super.clone()
|
||||
clonedEntity as KotlinScriptLibraryEntityData
|
||||
clonedEntity.roots = clonedEntity.roots.toMutableWorkspaceList()
|
||||
clonedEntity.usedInScripts = clonedEntity.usedInScripts.toMutableWorkspaceSet()
|
||||
return clonedEntity
|
||||
}
|
||||
|
||||
override fun getEntityInterface(): Class<out WorkspaceEntity> {
|
||||
return KotlinScriptLibraryEntity::class.java
|
||||
}
|
||||
|
||||
override fun createDetachedEntity(parents: List<WorkspaceEntity.Builder<*>>): WorkspaceEntity.Builder<*> {
|
||||
return KotlinScriptLibraryEntity(name, roots, indexSourceRoots, usedInScripts, entitySource) {
|
||||
override fun getRequiredParents(): List<Class<out WorkspaceEntity>> {
|
||||
val res = mutableListOf<Class<out WorkspaceEntity>>()
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
override fun getRequiredParents(): List<Class<out WorkspaceEntity>> {
|
||||
val res = mutableListOf<Class<out WorkspaceEntity>>()
|
||||
return res
|
||||
}
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
other as KotlinScriptLibraryEntityData
|
||||
|
||||
other as KotlinScriptLibraryEntityData
|
||||
if (this.entitySource != other.entitySource) return false
|
||||
if (this.name != other.name) return false
|
||||
if (this.roots != other.roots) return false
|
||||
if (this.indexSourceRoots != other.indexSourceRoots) return false
|
||||
if (this.usedInScripts != other.usedInScripts) return false
|
||||
return true
|
||||
}
|
||||
|
||||
if (this.entitySource != other.entitySource) return false
|
||||
if (this.name != other.name) return false
|
||||
if (this.roots != other.roots) return false
|
||||
if (this.indexSourceRoots != other.indexSourceRoots) return false
|
||||
if (this.usedInScripts != other.usedInScripts) return false
|
||||
return true
|
||||
}
|
||||
override fun equalsIgnoringEntitySource(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
|
||||
override fun equalsIgnoringEntitySource(other: Any?): Boolean {
|
||||
if (other == null) return false
|
||||
if (this.javaClass != other.javaClass) return false
|
||||
other as KotlinScriptLibraryEntityData
|
||||
|
||||
other as KotlinScriptLibraryEntityData
|
||||
if (this.name != other.name) return false
|
||||
if (this.roots != other.roots) return false
|
||||
if (this.indexSourceRoots != other.indexSourceRoots) return false
|
||||
if (this.usedInScripts != other.usedInScripts) return false
|
||||
return true
|
||||
}
|
||||
|
||||
if (this.name != other.name) return false
|
||||
if (this.roots != other.roots) return false
|
||||
if (this.indexSourceRoots != other.indexSourceRoots) return false
|
||||
if (this.usedInScripts != other.usedInScripts) return false
|
||||
return true
|
||||
}
|
||||
override fun hashCode(): Int {
|
||||
var result = entitySource.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + roots.hashCode()
|
||||
result = 31 * result + indexSourceRoots.hashCode()
|
||||
result = 31 * result + usedInScripts.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = entitySource.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + roots.hashCode()
|
||||
result = 31 * result + indexSourceRoots.hashCode()
|
||||
result = 31 * result + usedInScripts.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
override fun hashCodeIgnoringEntitySource(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + roots.hashCode()
|
||||
result = 31 * result + indexSourceRoots.hashCode()
|
||||
result = 31 * result + usedInScripts.hashCode()
|
||||
return result
|
||||
}
|
||||
override fun hashCodeIgnoringEntitySource(): Int {
|
||||
var result = javaClass.hashCode()
|
||||
result = 31 * result + name.hashCode()
|
||||
result = 31 * result + roots.hashCode()
|
||||
result = 31 * result + indexSourceRoots.hashCode()
|
||||
result = 31 * result + usedInScripts.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,4 @@ text.loading.kotlin.script.configuration=Loading script configuration
|
||||
notification.text.there.is.a.new.script.context.available=There is a new script context available.
|
||||
notification.action.text.apply.context=Apply context
|
||||
notification.action.text.enable.auto.reload=Enable auto-reload
|
||||
scripting.support.availability.name=Kotlin scripting
|
||||
|
||||
action.LoadMainKtsConfiguration.text=Refresh Script
|
||||
action.LoadMainKtsConfiguration.description=Load script dependencies and re-highlight
|
||||
scripting.support.availability.name=Kotlin scripting
|
||||
@@ -1,12 +1,18 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.core.script
|
||||
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.components.serviceIfCreated
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.scripting.definitions.LazyScriptDefinitionProvider
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionProvider
|
||||
import org.jetbrains.kotlin.scripting.resolve.KotlinScriptDefinitionFromAnnotatedTemplate
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.script.experimental.api.ScriptCompilationConfiguration
|
||||
import kotlin.script.experimental.api.SourceCode
|
||||
import kotlin.script.experimental.api.filePathPattern
|
||||
import kotlin.script.experimental.api.with
|
||||
import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration
|
||||
|
||||
/**
|
||||
@@ -15,18 +21,47 @@ import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration
|
||||
* Force-wrap legacy definitions into `ScriptDefinition.FromConfigurations` when updating.
|
||||
*/
|
||||
class K2ScriptDefinitionProvider(val project: Project) : LazyScriptDefinitionProvider() {
|
||||
private val _definitions: AtomicReference<List<ScriptDefinition>> = AtomicReference()
|
||||
|
||||
public override val currentDefinitions: Sequence<ScriptDefinition>
|
||||
get() = SCRIPT_DEFINITIONS_SOURCES.getExtensions(project).flatMap { it.definitions }.asSequence()
|
||||
get() = _definitions.get()?.takeIf { it.isNotEmpty() }?.asSequence() ?: sequenceOf(getDefaultDefinition())
|
||||
|
||||
fun updateDefinitions(templateDefinitions: List<ScriptDefinition>) {
|
||||
val definitionsFromConfigurations = templateDefinitions.map { definition ->
|
||||
val configuration = definition.compilationConfiguration.with {
|
||||
definition.asLegacyOrNull<KotlinScriptDefinitionFromAnnotatedTemplate>()?.let {
|
||||
// remove when fix pattern processing on compiler side
|
||||
filePathPattern(it.scriptFilePattern.pattern)
|
||||
}
|
||||
}
|
||||
|
||||
object : ScriptDefinition.FromConfigurations(
|
||||
definition.hostConfiguration,
|
||||
configuration,
|
||||
definition.evaluationConfiguration,
|
||||
definition.defaultCompilerOptions
|
||||
) {
|
||||
// remove when fix pattern processing on compiler side
|
||||
override fun isScript(script: SourceCode): Boolean {
|
||||
val extension = ".$fileExtension"
|
||||
val location = script.locationId ?: return false
|
||||
val name = script.name ?: location
|
||||
return name.endsWith(extension) && filePathPattern?.let { Regex(it).matches(name) } != false
|
||||
}
|
||||
}
|
||||
}
|
||||
_definitions.set(definitionsFromConfigurations)
|
||||
clearCache()
|
||||
}
|
||||
|
||||
override fun getDefaultDefinition(): ScriptDefinition =
|
||||
ScriptDefinition.FromConfigurations(defaultJvmScriptingHostConfiguration, ScriptCompilationConfiguration.Default, null)
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project): K2ScriptDefinitionProvider =
|
||||
project.service<ScriptDefinitionProvider>() as K2ScriptDefinitionProvider
|
||||
|
||||
fun getInstanceIfCreated(project: Project): K2ScriptDefinitionProvider? =
|
||||
project.serviceIfCreated<ScriptDefinitionProvider>() as? K2ScriptDefinitionProvider
|
||||
}
|
||||
|
||||
fun dropCache() {
|
||||
clearCache()
|
||||
}
|
||||
}
|
||||
@@ -103,20 +103,6 @@ class K2ScriptDependenciesProvider(project: Project) : ScriptDependenciesProvide
|
||||
|
||||
private val configurationsByFile = ConcurrentHashMap<VirtualFile, ResultWithDiagnostics<ScriptCompilationConfigurationWrapper>>()
|
||||
|
||||
fun addConfiguration(script: SourceCode): ScriptCompilationConfigurationResult {
|
||||
val definition = findScriptDefinition(project, script)
|
||||
val virtualFile = script.getVirtualFile(definition)
|
||||
|
||||
val previousConfiguration = getConfiguration(virtualFile)
|
||||
val configuration = project.runReadActionInSmartMode {
|
||||
refineScriptCompilationConfiguration(script, definition, project, previousConfiguration?.valueOrNull()?.configuration)
|
||||
}
|
||||
|
||||
configurationsByFile[virtualFile] = configuration
|
||||
|
||||
return configuration
|
||||
}
|
||||
|
||||
fun reloadConfigurations(scripts: Set<ScriptModel>, javaHome: String?) {
|
||||
val classes = mutableSetOf<VirtualFile>()
|
||||
val sources = mutableSetOf<VirtualFile>()
|
||||
|
||||
@@ -62,6 +62,8 @@ internal class IdeScriptDependenciesProvider(project: Project) : ScriptDependenc
|
||||
* of opened files when configuration will be loaded or updated.
|
||||
*/
|
||||
interface ScriptConfigurationManager : ScriptDependencyAware {
|
||||
fun loadPlugins()
|
||||
|
||||
/**
|
||||
* Get cached configuration for [file] or load it.
|
||||
* May return null even configuration was loaded but was not yet applied.
|
||||
|
||||
@@ -35,7 +35,7 @@ internal class ScriptTrafficLightRendererContributor : TrafficLightRendererContr
|
||||
|
||||
if (scriptingEnabled) {
|
||||
if (KotlinPluginModeProvider.isK2Mode()) {
|
||||
if (K2ScriptDependenciesProvider.getInstanceIfCreated(project)?.getScriptConfiguration(file) == null) {
|
||||
if (K2ScriptDependenciesProvider.getInstanceIfCreated(project)?.getConfiguration(file.virtualFile) == null) {
|
||||
status.reasonWhySuspended = KotlinBaseScriptingBundle.message("text.loading.kotlin.script.configuration")
|
||||
status.errorAnalyzingFinished = false
|
||||
}
|
||||
|
||||
@@ -68,6 +68,10 @@ class CompositeScriptConfigurationManager(val project: Project, val scope: Corou
|
||||
}
|
||||
}
|
||||
|
||||
override fun loadPlugins() {
|
||||
plugins
|
||||
}
|
||||
|
||||
fun updateScriptDependenciesIfNeeded(file: VirtualFile) {
|
||||
notifier.updateScriptDependenciesIfNeeded(file)
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class KotlinScriptResolveScopeProvider : ResolveScopeProvider() {
|
||||
private fun KtFile.calculateScopeForStandaloneScript(file: VirtualFile, project: Project): KotlinScriptSearchScope {
|
||||
val vFile = virtualFile ?: viewProvider.virtualFile
|
||||
val dependenciesScope =
|
||||
ScriptDependencyAware.getInstance(project).getScriptDependenciesClassFilesScope(vFile)
|
||||
ScriptDependencyAware.getInstance(project).getScriptDependenciesClassFilesScope(vFile) ?: GlobalSearchScope.EMPTY_SCOPE
|
||||
debugLog { "=> standalone" }
|
||||
return KotlinScriptSearchScope(project, GlobalSearchScope.fileScope(project, file).uniteWith(dependenciesScope))
|
||||
}
|
||||
|
||||
@@ -17,9 +17,11 @@ abstract class ScriptAdditionalIdeaDependenciesProvider {
|
||||
ExtensionPointName.create("org.jetbrains.kotlin.scriptAdditionalIdeaDependenciesProvider")
|
||||
|
||||
fun getRelatedModules(file: VirtualFile, project: Project): List<Module> = EP_NAME.getExtensionList(project)
|
||||
.filterIsInstance<ScriptAdditionalIdeaDependenciesProvider>()
|
||||
.flatMap { it.getRelatedModules(file, project) }
|
||||
|
||||
fun getRelatedLibraries(file: VirtualFile, project: Project): List<Library> = EP_NAME.getExtensionList(project)
|
||||
.filterIsInstance<ScriptAdditionalIdeaDependenciesProvider>()
|
||||
.flatMap { it.getRelatedLibraries(file, project) }
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class ScriptDependenciesResolveScopeProvider : ResolveScopeProvider() {
|
||||
if (RootKindMatcher.matches(project, file, RootKindFilter.libraryFiles.copy(includeScriptDependencies = false)))
|
||||
return null
|
||||
|
||||
if (ScriptDependencyAware.getInstance(project).getAllScriptsDependenciesClassFiles().isEmpty()) return null
|
||||
if ((ScriptDependencyAware.getInstance(project).getAllScriptsDependenciesClassFiles() ?: emptyList()).isEmpty()) return null
|
||||
|
||||
if (file !in ScriptDependencyAware.getInstance(project).getAllScriptsDependenciesClassFilesScope()
|
||||
&& file !in ScriptDependencyAware.getInstance(project).getAllScriptDependenciesSourcesScope()) {
|
||||
|
||||
@@ -42,7 +42,7 @@ class ScriptDependencySourceNavigationPolicyForJavaClasses : ClsCustomNavigation
|
||||
val packageName = file.packageName
|
||||
val relativePath = if (packageName.isEmpty()) sourceFileName else packageName.replace('.', '/') + '/' + sourceFileName
|
||||
|
||||
for (root in ScriptDependencyAware.getInstance(project).getAllScriptDependenciesSources().filter { it.isValid }) {
|
||||
for (root in (ScriptDependencyAware.getInstance(project).getAllScriptDependenciesSources() ?: emptyList()).filter { it.isValid }) {
|
||||
val sourceFile = root.findFileByRelativePath(relativePath)
|
||||
if (sourceFile != null && sourceFile.isValid) {
|
||||
val sourcePsi = file.manager.findFile(sourceFile)
|
||||
|
||||
@@ -10,9 +10,7 @@ import com.intellij.platform.backend.workspace.toVirtualFileUrl
|
||||
import com.intellij.platform.workspace.jps.entities.*
|
||||
import com.intellij.platform.workspace.storage.EntitySource
|
||||
import com.intellij.platform.workspace.storage.MutableEntityStorage
|
||||
import com.intellij.platform.workspace.storage.url.VirtualFileUrl
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager.Companion.toVfsRoots
|
||||
import org.jetbrains.kotlin.scripting.definitions.findScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.resolve.VirtualFileScriptSource
|
||||
import java.nio.file.Path
|
||||
import kotlin.script.experimental.api.valueOrNull
|
||||
@@ -20,7 +18,7 @@ import kotlin.time.measureTime
|
||||
|
||||
const val KOTLIN_SCRIPTS_MODULE_NAME = "Kotlin Scripts"
|
||||
|
||||
data class KotlinScriptEntitySourceK2(override val virtualFileUrl: VirtualFileUrl) : EntitySource
|
||||
object KotlinK2ScriptEntitySource : EntitySource
|
||||
|
||||
suspend fun Project.createScriptModules(scripts: Set<ScriptModel>) {
|
||||
val duration = measureTime { createPureScriptModules(scripts, this) }
|
||||
@@ -31,7 +29,6 @@ suspend fun Project.createScriptModules(scripts: Set<ScriptModel>) {
|
||||
private suspend fun createPureScriptModules(scriptPaths: Set<ScriptModel>, project: Project) {
|
||||
val projectPath = project.basePath?.let { Path.of(it) } ?: return
|
||||
|
||||
val sourcesToUpdate = mutableSetOf<KotlinScriptEntitySourceK2>()
|
||||
val updatedStorage = MutableEntityStorage.create()
|
||||
|
||||
for (scriptFile in scriptPaths.map { it.virtualFile }) {
|
||||
@@ -44,21 +41,21 @@ private suspend fun createPureScriptModules(scriptPaths: Set<ScriptModel>, proje
|
||||
val relativeLocation = FileUtil.getRelativePath(basePath, file) ?: continue
|
||||
|
||||
val definition =
|
||||
findScriptDefinition(project, VirtualFileScriptSource(scriptFile))
|
||||
K2ScriptDefinitionProvider.getInstance(project).findDefinition(VirtualFileScriptSource(scriptFile))
|
||||
|
||||
val definitionScriptModuleName = "$KOTLIN_SCRIPTS_MODULE_NAME.${definition.name}"
|
||||
val definitionName = definition?.name ?: continue
|
||||
|
||||
val definitionScriptModuleName = "$KOTLIN_SCRIPTS_MODULE_NAME.$definitionName"
|
||||
val locationName = relativeLocation.replace(VfsUtilCore.VFS_SEPARATOR_CHAR, ':')
|
||||
val moduleName = "$definitionScriptModuleName.$locationName"
|
||||
|
||||
val source = KotlinScriptEntitySourceK2(scriptFile.toVirtualFileUrl(WorkspaceModel.getInstance(project).getVirtualFileUrlManager()))
|
||||
sourcesToUpdate += source
|
||||
val dependencies = updatedStorage.createDependencies(moduleName, scriptFile, project, source)
|
||||
val dependencies = updatedStorage.createDependencies(moduleName, scriptFile, project)
|
||||
|
||||
updatedStorage.addEntity(ModuleEntity(moduleName, dependencies, source))
|
||||
updatedStorage.addEntity(ModuleEntity(moduleName, dependencies, KotlinK2ScriptEntitySource))
|
||||
}
|
||||
|
||||
WorkspaceModel.getInstance(project).update("Updating kotlin scripts modules") {
|
||||
it.replaceBySource({ entitySource -> entitySource in sourcesToUpdate }, updatedStorage)
|
||||
it.replaceBySource({ entitySource -> entitySource is KotlinK2ScriptEntitySource }, updatedStorage)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +84,7 @@ private fun getDependenciesFiles(scriptFile: VirtualFile, project: Project): Dep
|
||||
fun MutableEntityStorage.createDependencies(
|
||||
moduleName: String,
|
||||
scriptFile: VirtualFile,
|
||||
project: Project,
|
||||
entitySource: EntitySource
|
||||
project: Project
|
||||
): List<ModuleDependencyItem> {
|
||||
val (dependenciesClassFiles, dependenciesSourceFiles, sdk) = getDependenciesFiles(scriptFile, project)
|
||||
|
||||
@@ -104,7 +100,7 @@ fun MutableEntityStorage.createDependencies(
|
||||
|
||||
val libraryTableId = LibraryTableId.ModuleLibraryTableId(moduleId = ModuleId(moduleName))
|
||||
val dependencyLibrary =
|
||||
addEntity(LibraryEntity("$moduleName dependencies", libraryTableId, classRoots + sourceRoots, entitySource))
|
||||
addEntity(LibraryEntity("$moduleName dependencies", libraryTableId, classRoots + sourceRoots, KotlinK2ScriptEntitySource))
|
||||
|
||||
return listOfNotNull(LibraryDependency(dependencyLibrary.symbolicId, false, DependencyScope.COMPILE), sdk)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.intellij.openapi.application.Application
|
||||
import com.intellij.openapi.application.readAction
|
||||
import com.intellij.openapi.application.writeAction
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.extensions.ProjectExtensionPointName
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
@@ -20,12 +19,8 @@ import org.jetbrains.kotlin.idea.core.util.toPsiFile
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.NotNullableUserDataProperty
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionsSource
|
||||
import kotlin.script.experimental.api.ScriptDiagnostic
|
||||
|
||||
val SCRIPT_DEFINITIONS_SOURCES: ProjectExtensionPointName<ScriptDefinitionsSource> =
|
||||
ProjectExtensionPointName("org.jetbrains.kotlin.scriptDefinitionsSource")
|
||||
|
||||
@set: org.jetbrains.annotations.TestOnly
|
||||
var Application.isScriptChangesNotifierDisabled by NotNullableUserDataProperty(
|
||||
Key.create("SCRIPT_CHANGES_NOTIFIER_DISABLED"),
|
||||
@@ -86,7 +81,9 @@ suspend fun configureGradleScriptsK2(
|
||||
javaHome: String?,
|
||||
project: Project,
|
||||
scripts: Set<ScriptModel>,
|
||||
definitions: List<ScriptDefinition>,
|
||||
) {
|
||||
K2ScriptDefinitionProvider.getInstance(project).updateDefinitions(definitions)
|
||||
K2ScriptDependenciesProvider.getInstance(project).reloadConfigurations(scripts, javaHome)
|
||||
project.createScriptModules(scripts)
|
||||
|
||||
@@ -104,4 +101,4 @@ suspend fun configureGradleScriptsK2(
|
||||
}
|
||||
}
|
||||
|
||||
val scriptingEnabled = Registry.`is`("kotlin.k2.scripting.enabled", false)
|
||||
val scriptingEnabled = Registry.`is`("kotlin.k2.scripting.enabled", false)
|
||||
@@ -38,46 +38,46 @@ interface KotlinScriptLibraryEntity : WorkspaceEntityWithSymbolicId {
|
||||
override val symbolicId: KotlinScriptLibraryId
|
||||
get() = KotlinScriptLibraryId(name)
|
||||
|
||||
//region generated code
|
||||
@GeneratedCodeApiVersion(3)
|
||||
interface Builder : WorkspaceEntity.Builder<KotlinScriptLibraryEntity> {
|
||||
override var entitySource: EntitySource
|
||||
var name: String
|
||||
var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
var indexSourceRoots: Boolean
|
||||
var usedInScripts: MutableSet<KotlinScriptId>
|
||||
}
|
||||
|
||||
companion object : EntityType<KotlinScriptLibraryEntity, Builder>() {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@JvmName("create")
|
||||
operator fun invoke(
|
||||
name: String,
|
||||
roots: List<KotlinScriptLibraryRoot>,
|
||||
indexSourceRoots: Boolean,
|
||||
usedInScripts: Set<KotlinScriptId>,
|
||||
entitySource: EntitySource,
|
||||
init: (Builder.() -> Unit)? = null,
|
||||
): Builder {
|
||||
val builder = builder()
|
||||
builder.name = name
|
||||
builder.roots = roots.toMutableWorkspaceList()
|
||||
builder.indexSourceRoots = indexSourceRoots
|
||||
builder.usedInScripts = usedInScripts.toMutableWorkspaceSet()
|
||||
builder.entitySource = entitySource
|
||||
init?.invoke(builder)
|
||||
return builder
|
||||
//region generated code
|
||||
@GeneratedCodeApiVersion(3)
|
||||
interface Builder : WorkspaceEntity.Builder<KotlinScriptLibraryEntity> {
|
||||
override var entitySource: EntitySource
|
||||
var name: String
|
||||
var roots: MutableList<KotlinScriptLibraryRoot>
|
||||
var indexSourceRoots: Boolean
|
||||
var usedInScripts: MutableSet<KotlinScriptId>
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
|
||||
companion object : EntityType<KotlinScriptLibraryEntity, Builder>() {
|
||||
@JvmOverloads
|
||||
@JvmStatic
|
||||
@JvmName("create")
|
||||
operator fun invoke(
|
||||
name: String,
|
||||
roots: List<KotlinScriptLibraryRoot>,
|
||||
indexSourceRoots: Boolean,
|
||||
usedInScripts: Set<KotlinScriptId>,
|
||||
entitySource: EntitySource,
|
||||
init: (Builder.() -> Unit)? = null,
|
||||
): Builder {
|
||||
val builder = builder()
|
||||
builder.name = name
|
||||
builder.roots = roots.toMutableWorkspaceList()
|
||||
builder.indexSourceRoots = indexSourceRoots
|
||||
builder.usedInScripts = usedInScripts.toMutableWorkspaceSet()
|
||||
builder.entitySource = entitySource
|
||||
init?.invoke(builder)
|
||||
return builder
|
||||
}
|
||||
}
|
||||
//endregion
|
||||
}
|
||||
|
||||
//region generated code
|
||||
fun MutableEntityStorage.modifyEntity(
|
||||
entity: KotlinScriptLibraryEntity,
|
||||
modification: KotlinScriptLibraryEntity.Builder.() -> Unit,
|
||||
entity: KotlinScriptLibraryEntity,
|
||||
modification: KotlinScriptLibraryEntity.Builder.() -> Unit,
|
||||
): KotlinScriptLibraryEntity {
|
||||
return modifyEntity(KotlinScriptLibraryEntity.Builder::class.java, entity, modification)
|
||||
return modifyEntity(KotlinScriptLibraryEntity.Builder::class.java, entity, modification)
|
||||
}
|
||||
//endregion
|
||||
|
||||
@@ -12,14 +12,14 @@ object MetadataStorageImpl: MetadataStorageBase() {
|
||||
|
||||
var typeMetadata: StorageTypeMetadata
|
||||
|
||||
typeMetadata = FinalClassMetadata.ClassMetadata(fqName = "org.jetbrains.kotlin.idea.core.script.KotlinScriptEntitySourceK2", properties = listOf(OwnPropertyMetadata(isComputable = false, isKey = false, isOpen = false, name = "virtualFileUrl", valueType = ValueTypeMetadata.SimpleType.CustomType(isNullable = false, typeMetadata = FinalClassMetadata.KnownClass(fqName = "com.intellij.platform.workspace.storage.url.VirtualFileUrl")), withDefault = false)), supertypes = listOf("com.intellij.platform.workspace.storage.EntitySource"))
|
||||
typeMetadata = FinalClassMetadata.ObjectMetadata(fqName = "org.jetbrains.kotlin.idea.core.script.KotlinK2ScriptEntitySource", properties = listOf(OwnPropertyMetadata(isComputable = false, isKey = false, isOpen = false, name = "virtualFileUrl", valueType = ValueTypeMetadata.SimpleType.CustomType(isNullable = true, typeMetadata = FinalClassMetadata.KnownClass(fqName = "com.intellij.platform.workspace.storage.url.VirtualFileUrl")), withDefault = false)), supertypes = listOf("com.intellij.platform.workspace.storage.EntitySource"))
|
||||
|
||||
addMetadata(typeMetadata)
|
||||
}
|
||||
|
||||
override fun initializeMetadataHash() {
|
||||
addMetadataHash(typeFqn = "com.intellij.platform.workspace.storage.EntitySource", metadataHash = -771969063)
|
||||
addMetadataHash(typeFqn = "org.jetbrains.kotlin.idea.core.script.KotlinScriptEntitySourceK2", metadataHash = -860768271)
|
||||
addMetadataHash(typeFqn = "com.intellij.platform.workspace.storage.EntitySource", metadataHash = -216432311)
|
||||
addMetadataHash(typeFqn = "org.jetbrains.kotlin.idea.core.script.KotlinK2ScriptEntitySource", metadataHash = 782346369)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.gradleJava.scripting
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.idea.core.script.K2ScriptDefinitionProvider
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionsSource
|
||||
import org.jetbrains.kotlin.scripting.resolve.KotlinScriptDefinitionFromAnnotatedTemplate
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import kotlin.script.experimental.api.fileNamePattern
|
||||
import kotlin.script.experimental.api.with
|
||||
|
||||
class GradleScriptDefinitionsSource(val project: Project) : ScriptDefinitionsSource {
|
||||
private val _definitions: AtomicReference<List<ScriptDefinition>> = AtomicReference(listOf())
|
||||
|
||||
override val definitions: Sequence<ScriptDefinition>
|
||||
get() = _definitions.get().asSequence()
|
||||
|
||||
fun updateDefinitions(templateDefinitions: List<ScriptDefinition>) {
|
||||
val definitionsFromConfigurations = templateDefinitions.map { definition ->
|
||||
val configuration = definition.compilationConfiguration.with {
|
||||
definition.asLegacyOrNull<KotlinScriptDefinitionFromAnnotatedTemplate>()?.let {
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
fileNamePattern(it.scriptFilePattern.pattern)
|
||||
}
|
||||
}
|
||||
|
||||
ScriptDefinition.FromConfigurations(
|
||||
definition.hostConfiguration,
|
||||
configuration,
|
||||
definition.evaluationConfiguration,
|
||||
definition.defaultCompilerOptions
|
||||
)
|
||||
}
|
||||
_definitions.set(definitionsFromConfigurations)
|
||||
K2ScriptDefinitionProvider.getInstanceIfCreated(project)?.dropCache()
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,7 @@ internal class GradleScriptNotificationProvider : EditorNotificationProvider {
|
||||
}
|
||||
|
||||
return Function { fileEditor ->
|
||||
//if (k2ScriptingEnabled() && K2ScriptDependenciesProvider.getInstanceIfCreated(project)?.getConfiguration(file) != null) { return@Function null }
|
||||
when (scriptUnderRoot.notificationKind) {
|
||||
dontCare -> null
|
||||
legacy -> {
|
||||
|
||||
@@ -7,13 +7,11 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.core.script.SCRIPT_DEFINITIONS_SOURCES
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptModel
|
||||
import org.jetbrains.kotlin.idea.core.script.configureGradleScriptsK2
|
||||
import org.jetbrains.kotlin.idea.gradleJava.loadGradleDefinitions
|
||||
import org.jetbrains.kotlin.idea.gradleJava.scripting.roots.GradleBuildRootsManager
|
||||
import org.jetbrains.kotlin.idea.gradleJava.scripting.roots.Imported
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import org.jetbrains.plugins.gradle.service.GradleInstallationManager
|
||||
import org.jetbrains.plugins.gradle.settings.DistributionType
|
||||
import org.jetbrains.plugins.gradle.settings.GradleProjectSettings
|
||||
@@ -39,9 +37,6 @@ class ProjectGradleSettingsListener(val project: Project, private val cs: Corout
|
||||
|
||||
if (newRoot is Imported && KotlinPluginModeProvider.isK2Mode()) {
|
||||
val definitions = loadGradleDefinitions(it.externalProjectPath, newRoot.data.gradleHome, newRoot.data.javaHome, project)
|
||||
SCRIPT_DEFINITIONS_SOURCES.getExtensions(project)
|
||||
.filterIsInstance<GradleScriptDefinitionsSource>().firstOrNull()
|
||||
.safeAs<GradleScriptDefinitionsSource>()?.updateDefinitions(definitions)
|
||||
|
||||
val scripts = newRoot.data.models.mapNotNull {
|
||||
val path = Paths.get(it.file)
|
||||
@@ -55,7 +50,7 @@ class ProjectGradleSettingsListener(val project: Project, private val cs: Corout
|
||||
}
|
||||
}.toSet()
|
||||
|
||||
configureGradleScriptsK2(newRoot.data.javaHome, project, scripts)
|
||||
configureGradleScriptsK2(newRoot.data.javaHome, project, scripts, definitions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,15 +12,12 @@ import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginModeProvider
|
||||
import org.jetbrains.kotlin.idea.core.script.SCRIPT_DEFINITIONS_SOURCES
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionContributor
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptModel
|
||||
import org.jetbrains.kotlin.idea.core.script.configureGradleScriptsK2
|
||||
import org.jetbrains.kotlin.idea.gradleJava.loadGradleDefinitions
|
||||
import org.jetbrains.kotlin.idea.gradleJava.scripting.GradleScriptDefinitionsContributor
|
||||
import org.jetbrains.kotlin.idea.gradleJava.scripting.GradleScriptDefinitionsSource
|
||||
import org.jetbrains.kotlin.idea.gradleJava.scripting.roots.GradleBuildRootsManager
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
import org.jetbrains.plugins.gradle.service.GradleInstallationManager
|
||||
import org.jetbrains.plugins.gradle.settings.GradleExecutionSettings
|
||||
import org.jetbrains.plugins.gradle.settings.GradleSettings
|
||||
@@ -83,9 +80,6 @@ class KotlinDslSyncListener(val coroutineScope: CoroutineScope) : ExternalSystem
|
||||
|
||||
if (KotlinPluginModeProvider.isK2Mode()) {
|
||||
val definitions = loadGradleDefinitions(sync.workingDir, sync.gradleHome, sync.javaHome, project)
|
||||
SCRIPT_DEFINITIONS_SOURCES.getExtensions(project)
|
||||
.filterIsInstance<GradleScriptDefinitionsSource>().firstOrNull()
|
||||
.safeAs<GradleScriptDefinitionsSource>()?.updateDefinitions(definitions)
|
||||
|
||||
val scripts = sync.models.mapNotNull {
|
||||
val path = Path.of(it.file)
|
||||
@@ -93,7 +87,7 @@ class KotlinDslSyncListener(val coroutineScope: CoroutineScope) : ExternalSystem
|
||||
ScriptModel(virtualFile, it.classPath, it.sourcePath, it.imports)
|
||||
}
|
||||
}.toSet()
|
||||
coroutineScope.launch { configureGradleScriptsK2(sync.javaHome, project, scripts) }
|
||||
coroutineScope.launch { configureGradleScriptsK2(sync.javaHome, project, scripts, definitions) }
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
ScriptDefinitionContributor.find<GradleScriptDefinitionsContributor>(project)?.reloadIfNeeded(
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.jetbrains.kotlin.idea.base.plugin.artifacts.KotlinArtifacts
|
||||
import java.io.File
|
||||
import kotlin.script.experimental.intellij.ScriptDefinitionsProvider
|
||||
|
||||
class MainKtsScriptDefinitionProvider : ScriptDefinitionsProvider {
|
||||
class MainKtsScriptDefinitionSource : ScriptDefinitionsProvider {
|
||||
override val id: String = ".main.kts script"
|
||||
|
||||
override fun getDefinitionClasses(): Iterable<String> = emptyList()
|
||||
@@ -1,41 +0,0 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.script
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.idea.base.plugin.artifacts.KotlinArtifacts
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionsFromClasspathDiscoverySource
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionsSource
|
||||
import kotlin.script.experimental.api.ScriptCompilationConfiguration
|
||||
import kotlin.script.experimental.api.ScriptEvaluationConfiguration
|
||||
import kotlin.script.experimental.api.hostConfiguration
|
||||
import kotlin.script.experimental.jvm.defaultJvmScriptingHostConfiguration
|
||||
|
||||
class MainKtsScriptDefinitionSourceK2(val project: Project) : ScriptDefinitionsSource {
|
||||
override val definitions: Sequence<ScriptDefinition>
|
||||
get() {
|
||||
val baseHostConfiguration = defaultJvmScriptingHostConfiguration
|
||||
val classPath = listOf(
|
||||
KotlinArtifacts.kotlinMainKts,
|
||||
KotlinArtifacts.kotlinScriptRuntime,
|
||||
KotlinArtifacts.kotlinStdlib,
|
||||
KotlinArtifacts.kotlinReflect
|
||||
)
|
||||
|
||||
val discoveredDefinitions = ScriptDefinitionsFromClasspathDiscoverySource(
|
||||
classPath,
|
||||
baseHostConfiguration,
|
||||
::loggingReporter
|
||||
).definitions
|
||||
|
||||
return discoveredDefinitions.map {
|
||||
ScriptDefinition.FromConfigurations(
|
||||
it.compilationConfiguration[ScriptCompilationConfiguration.hostConfiguration]
|
||||
?: baseHostConfiguration,
|
||||
it.compilationConfiguration,
|
||||
it.evaluationConfiguration ?: ScriptEvaluationConfiguration.Default
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.idea.script
|
||||
|
||||
import com.intellij.diff.util.DiffUtil
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.application.writeAction
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.testFramework.LightVirtualFileBase
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.kotlin.analysis.providers.analysisMessageBus
|
||||
import org.jetbrains.kotlin.analysis.providers.topics.KotlinTopics
|
||||
import org.jetbrains.kotlin.idea.core.script.K2ScriptDependenciesProvider
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptModel
|
||||
import org.jetbrains.kotlin.idea.core.script.createScriptModules
|
||||
import org.jetbrains.kotlin.idea.util.isKotlinFileType
|
||||
import org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionProvider
|
||||
import org.jetbrains.kotlin.scripting.resolve.VirtualFileScriptSource
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import kotlin.script.experimental.api.ResultWithDiagnostics
|
||||
import kotlin.script.experimental.api.valueOrNull
|
||||
|
||||
internal class RefreshMainKtsScriptAction : DumbAwareAction() {
|
||||
|
||||
private val lastModifiedPerScript = ConcurrentHashMap<VirtualFile, Long>()
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project ?: return
|
||||
val editor = e.getData(CommonDataKeys.EDITOR) ?: return
|
||||
val file = getKotlinScriptFile(editor) ?: return
|
||||
|
||||
val configurationResult = K2ScriptDependenciesProvider.getInstance(project)
|
||||
.addConfiguration(VirtualFileScriptSource(file))
|
||||
|
||||
if (configurationResult is ResultWithDiagnostics.Failure) {
|
||||
configurationResult.reports
|
||||
}
|
||||
|
||||
val configuration = configurationResult.valueOrNull()
|
||||
|
||||
val model =
|
||||
ScriptModel(file, configuration?.dependenciesClassPath?.map { it.absolutePath } ?: emptyList())
|
||||
|
||||
GlobalScope.launch {
|
||||
project.createScriptModules(setOf(model))
|
||||
|
||||
writeAction {
|
||||
project.analysisMessageBus.syncPublisher(KotlinTopics.GLOBAL_MODULE_STATE_MODIFICATION).onModification()
|
||||
}
|
||||
}
|
||||
|
||||
lastModifiedPerScript[file] = file.modificationStamp
|
||||
}
|
||||
|
||||
override fun getActionUpdateThread() = ActionUpdateThread.BGT
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
val editor = e.getData(CommonDataKeys.EDITOR) ?: return
|
||||
|
||||
e.presentation.isEnabledAndVisible = getNotificationVisibility(editor)
|
||||
}
|
||||
|
||||
private fun getNotificationVisibility(editor: Editor): Boolean {
|
||||
if (DiffUtil.isDiffEditor(editor)) return false
|
||||
|
||||
val project = editor.project ?: return false
|
||||
|
||||
if (ScriptDefinitionProvider.getServiceIfCreated(project) == null) return false
|
||||
val file = getKotlinScriptFile(editor) ?: return false
|
||||
|
||||
val oldValue = lastModifiedPerScript[file]
|
||||
|
||||
return oldValue == null || oldValue < file.modificationStamp
|
||||
}
|
||||
}
|
||||
|
||||
private fun getKotlinScriptFile(editor: Editor): VirtualFile? = FileDocumentManager.getInstance()
|
||||
.getFile(editor.document)
|
||||
?.takeIf {
|
||||
it !is LightVirtualFileBase
|
||||
&& it.isValid
|
||||
&& it.isKotlinFileType()
|
||||
&& isMainKtsScript(it)
|
||||
}
|
||||
|
||||
private fun isMainKtsScript(virtualFile: VirtualFile) = virtualFile.name.endsWith(".main.kts")
|
||||
@@ -1,11 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensionPoints>
|
||||
<extensionPoint
|
||||
qualifiedName="org.jetbrains.kotlin.scriptDefinitionsSource"
|
||||
interface="org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionsSource"
|
||||
area="IDEA_PROJECT"
|
||||
dynamic="true"/>
|
||||
|
||||
<extensionPoint
|
||||
qualifiedName="org.jetbrains.kotlin.scripting.definitions.scriptDefinitionProvider"
|
||||
interface="org.jetbrains.kotlin.scripting.definitions.ScriptDefinitionProvider"
|
||||
@@ -99,16 +93,5 @@
|
||||
|
||||
<idea.base.projectStructure.moduleInfoProviderExtension
|
||||
implementation="org.jetbrains.kotlin.idea.base.scripting.ScriptingModuleInfoProviderExtension"/>
|
||||
|
||||
<scriptDefinitionsSource implementation="org.jetbrains.kotlin.idea.script.MainKtsScriptDefinitionSourceK2"/>
|
||||
<scriptDefinitionsSource implementation="org.jetbrains.kotlin.idea.gradleJava.scripting.GradleScriptDefinitionsSource"/>
|
||||
</extensions>
|
||||
|
||||
<actions resource-bundle="messages.KotlinBaseScriptingBundle">
|
||||
<action id="LoadMainKtsConfiguration"
|
||||
class="org.jetbrains.kotlin.idea.script.RefreshMainKtsScriptAction"
|
||||
icon="org.jetbrains.kotlin.idea.KotlinIcons.LOAD_SCRIPT_CONFIGURATION">
|
||||
<add-to-group group-id="EditorContextBarMenu"/>
|
||||
</action>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
@@ -52,8 +52,20 @@
|
||||
<scriptDefinitionContributor id="ScriptDefinitionForExtensionAndIdeConsoleRootsSource"
|
||||
implementation="org.jetbrains.kotlin.jsr223.ScriptDefinitionForExtensionAndIdeConsoleRootsSource"/>
|
||||
|
||||
<scriptDefinitionsProvider id="MainKtsScriptDefinitionProvider"
|
||||
implementation="org.jetbrains.kotlin.idea.script.MainKtsScriptDefinitionProvider"/>
|
||||
<scriptDefinitionsProvider id="MainKtsScriptDefinitionSource"
|
||||
implementation="org.jetbrains.kotlin.idea.script.MainKtsScriptDefinitionSource"/>
|
||||
|
||||
<scripting.support.checker.provider id="MainKtsScriptCheckerProvider"
|
||||
implementation="org.jetbrains.kotlin.idea.script.MainKtsScriptCheckerProvider"/>
|
||||
|
||||
<scripting.support.checker.provider id="SpaceKtsScriptCheckerProvider"
|
||||
implementation="org.jetbrains.kotlin.idea.script.SpaceKtsScriptCheckerProvider"/>
|
||||
|
||||
<scripting.support.checker.provider id="TeamCityKtsScriptCheckerProvider"
|
||||
implementation="org.jetbrains.kotlin.idea.script.TeamCityKtsScriptCheckerProvider"/>
|
||||
|
||||
<scripting.support.checker.provider id="WorkspaceKtsScriptCheckerProvider"
|
||||
implementation="org.jetbrains.kotlin.idea.script.WorkspaceKtsScriptCheckerProvider"/>
|
||||
|
||||
<ideScriptConfigurationControlFacade implementation="org.jetbrains.kotlin.idea.script.DefaultIdeScriptingConfigurationFacade"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user