Skip to content

Commit

Permalink
Support isRecursive
Browse files Browse the repository at this point in the history
  • Loading branch information
Enaium committed Dec 9, 2024
1 parent 919d323 commit 2f51ad9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "cn.enaium.jimmer"
version = "1.0.0"
version = "1.0.2"

repositories {
mavenCentral()
Expand Down
9 changes: 9 additions & 0 deletions intellij/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
<![CDATA[<h1>A language server for Jimmer DTO</h1>
<p>Provides support for Jimmer DTO in IntelliJ IDEA.</p>]]>
</description>
<change-notes>
<![CDATA[<h1>Change notes</h1>
<p><b>1.0.2</b></p>
<ul><li>Support 'isRecursive'</li></ul>
<p><b>1.0.1</b></p>
<ul><li>Better to find classpath</li></ul>
<p><b>1.0.0</b></p>
<ul><li>First publish</li></ul>]]>
</change-notes>
<depends>com.intellij.modules.platform</depends>
<depends>com.redhat.devtools.lsp4ij</depends>
<extensions defaultExtensionNs="com.intellij">
Expand Down
2 changes: 1 addition & 1 deletion server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

val archiveName = "jimmer-dto-lsp"
group = "cn.enaium.jimmer"
version = "1.0.1"
version = "1.0.2"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package cn.enaium.jimmer.dto.lsp.compiler

import cn.enaium.jimmer.dto.lsp.Main.logger
import org.babyfish.jimmer.Formula
import org.babyfish.jimmer.Immutable
import org.babyfish.jimmer.dto.compiler.spi.BaseProp
Expand All @@ -28,6 +29,7 @@ import kotlin.reflect.KClass
*/
class ImmutableProp(
private val context: Context,
val declaringType: ImmutableType,
val member: KCallable<*>
) : BaseProp {
private val targetDeclaration = if (isList) {
Expand Down Expand Up @@ -106,7 +108,11 @@ class ImmutableProp(
override val isNullable: Boolean =
member.returnType.isMarkedNullable

override val isRecursive: Boolean = false
override val isRecursive: Boolean by lazy {
declaringType.isEntity && manyToManyViewBaseProp === null && targetDeclaration !== null && declaringType.klass.isAssignableFrom(
targetDeclaration
)
}

override val isTransient: Boolean =
member.annotations.any { it.annotationClass.qualifiedName == Transient::class.qualifiedName }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ class ImmutableType(
get() = klass.kotlin.members
.filter { it.annotations.any { it.annotationClass.qualifiedName == Id::class.qualifiedName } }
.associateBy({ it.name }) {
ImmutableProp(context, it)
ImmutableProp(context, this, it)
} + klass.kotlin.members
.filter { it.annotations.any { it.annotationClass.qualifiedName != Id::class.qualifiedName } || it.annotations.isEmpty() }
.associateBy({ it.name }) {
ImmutableProp(context, it)
ImmutableProp(context, this, it)
}

private val superPropMap: Map<String, ImmutableProp> = superTypes
Expand All @@ -67,7 +67,7 @@ class ImmutableType(
private val redefinedProps = superPropMap.filterKeys {
primarySuperType == null || !primarySuperType.properties.contains(it)
}.mapValues {
ImmutableProp(context, it.value.member)
ImmutableProp(context, this, it.value.member)
}

val properties: Map<String, ImmutableProp> =
Expand Down
2 changes: 1 addition & 1 deletion vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Jimmer DTO LSP",
"publisher": "enaium",
"author": "Enaium",
"version": "1.0.1",
"version": "1.0.2",
"description": "A language server for Jimmer DTO",
"icon": "icons/logo.png",
"main": "out/extensions",
Expand Down

0 comments on commit 2f51ad9

Please sign in to comment.