Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions mpp-idea/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,31 @@ repositories {
}
}

// Global exclusions for heavy dependencies not needed in IntelliJ plugin
// These exclusions apply to ALL configurations including transitive dependencies from includeBuild projects
configurations.all {
exclude(group = "aws.sdk.kotlin") // AWS SDK (~30MB) - from ai.koog:prompt-executor-bedrock-client
exclude(group = "aws.smithy.kotlin") // AWS Smithy runtime
exclude(group = "org.apache.tika") // Apache Tika (~100MB) - document parsing
exclude(group = "org.apache.poi") // Apache POI - Office document parsing (from Tika)
exclude(group = "org.apache.pdfbox") // PDFBox (~10MB) - PDF parsing
exclude(group = "net.sourceforge.plantuml") // PlantUML (~20MB) - from dev.snipme:highlights
exclude(group = "org.jsoup") // Jsoup HTML parser
exclude(group = "ai.koog", module = "prompt-executor-bedrock-client") // Bedrock executor
// Redis/Lettuce - not needed in IDEA plugin (~5MB)
exclude(group = "io.lettuce")
exclude(group = "io.projectreactor")
// RxJava - not needed (~2.6MB)
exclude(group = "io.reactivex.rxjava3")
// RSyntaxTextArea - IDEA has its own editor (~1.3MB)
exclude(group = "com.fifesoft")
// Netty - not needed for IDEA plugin (~3MB)
exclude(group = "io.netty")
// pty4j/jediterm - IDEA has its own terminal (~3MB)
exclude(group = "org.jetbrains.pty4j")
exclude(group = "org.jetbrains.jediterm")
}

dependencies {
// Depend on mpp-ui and mpp-core JVM targets for shared UI components and ConfigManager
// For KMP projects, we need to depend on the JVM target specifically
Expand Down Expand Up @@ -98,6 +123,7 @@ dependencies {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-serialization-core-jvm")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-io-core")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-io-core-jvm")
// Note: Heavy dependencies (AWS, Tika, POI, PDFBox, PlantUML, Jsoup) are excluded globally above
}

// Use platform-provided kotlinx libraries to avoid classloader conflicts
Expand Down Expand Up @@ -192,6 +218,21 @@ tasks {
useJUnitPlatform()
}

// Exclude large font files from mpp-ui that are not needed in IDEA plugin
// These fonts are for Desktop/WASM apps, IDEA has its own fonts
named<org.jetbrains.intellij.platform.gradle.tasks.PrepareSandboxTask>("prepareSandbox") {
// Exclude font files from the plugin distribution
// NotoSansSC-Regular.ttf (~18MB), NotoColorEmoji.ttf (~11MB x2), FiraCode fonts (~1MB)
exclude("**/fonts/**")
exclude("**/composeResources/**/font/**")
exclude("**/*.ttf")
exclude("**/*.otf")
// Also exclude icon files meant for desktop app
exclude("**/icon.icns")
exclude("**/icon.ico")
exclude("**/icon-512.png")
}

// Task to verify no conflicting dependencies are included
register("verifyNoDuplicateDependencies") {
group = "verification"
Expand Down
6 changes: 3 additions & 3 deletions mpp-idea/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!-- Plugin Configuration File for mpp-idea Compose UI module -->
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
<id>cc.unitmesh.devins.idea</id>
<name>AutoDev Compose UI</name>
<vendor email="phodal@gmail.com" url="https://github.com/unit-mesh">UnitMesh</vendor>
<name>AutoDev Next</name>
<vendor email="h@phodal.com" url="https://github.com/unit-mesh">UnitMesh</vendor>

<description><![CDATA[
AutoDev Compose UI module - Provides Compose-based UI components for IntelliJ IDEA 2025.2+.
AutoDev Idea - Provides Compose-based UI components for IntelliJ IDEA 2025.2+.
This module leverages Jewel theme for native IDE integration with DevIn language support.
]]></description>

Expand Down
3 changes: 2 additions & 1 deletion mpp-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ tasks.register<DownloadWasmFontsTask>("downloadWasmFonts") {
group = "build"
description = "Download fonts for WASM UTF-8 support (not committed to Git)"

fontDir.set(file("src/commonMain/composeResources/font"))
// Fonts are only needed for WASM platform, so download to wasmJsMain
fontDir.set(file("src/wasmJsMain/composeResources/font"))
useCJKFont.set(project.findProperty("useCJKFont")?.toString()?.toBoolean() ?: true)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cc.unitmesh.devins.ui.compose.sketch

import androidx.compose.runtime.Composable
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -30,3 +31,10 @@ actual fun getFiraCodeFontFamily(): FontFamily {
FontFamily.Monospace
}
}

/**
* Android implementation - use default font family
* Android has good system font support for UTF-8
*/
@Composable
actual fun getUtf8FontFamily(): FontFamily = FontFamily.Default
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import autodev_intellij.mpp_ui.generated.resources.NotoSansSC_Regular
import autodev_intellij.mpp_ui.generated.resources.Res
import cc.unitmesh.agent.Platform
import cc.unitmesh.agent.render.TimelineItem
import cc.unitmesh.devins.llm.Message
import cc.unitmesh.devins.llm.MessageRole
import cc.unitmesh.devins.ui.compose.icons.AutoDevComposeIcons
import cc.unitmesh.devins.ui.compose.sketch.SketchRenderer
import cc.unitmesh.devins.ui.compose.sketch.getUtf8FontFamily
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.jetbrains.compose.resources.Font

@Composable
fun AgentMessageList(
Expand Down Expand Up @@ -278,7 +275,7 @@ fun MessageItem(
} else {
Text(
text = message.content,
fontFamily = if (Platform.isWasm) FontFamily(Font(Res.font.NotoSansSC_Regular)) else FontFamily.Monospace,
fontFamily = getUtf8FontFamily(),
style = MaterialTheme.typography.bodyMedium
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import autodev_intellij.mpp_ui.generated.resources.NotoSansSC_Regular
import autodev_intellij.mpp_ui.generated.resources.Res
import cc.unitmesh.agent.Platform
import cc.unitmesh.agent.mcp.McpClientManager
import cc.unitmesh.agent.mcp.McpConfig
Expand All @@ -41,13 +39,13 @@ import cc.unitmesh.devins.ui.compose.editor.completion.CompletionPopup
import cc.unitmesh.devins.ui.compose.editor.completion.CompletionTrigger
import cc.unitmesh.devins.ui.compose.editor.highlighting.DevInSyntaxHighlighter
import cc.unitmesh.devins.ui.config.ConfigManager
import cc.unitmesh.devins.ui.compose.sketch.getUtf8FontFamily
import cc.unitmesh.devins.workspace.WorkspaceManager
import cc.unitmesh.llm.KoogLLMService
import cc.unitmesh.llm.ModelConfig
import cc.unitmesh.llm.PromptEnhancer
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.jetbrains.compose.resources.Font

/**
* DevIn 编辑器输入组件
Expand Down Expand Up @@ -485,7 +483,7 @@ fun DevInEditorInput(
.onPreviewKeyEvent { handleKeyEvent(it) },
textStyle =
TextStyle(
fontFamily = if (Platform.isWasm) FontFamily(Font(Res.font.NotoSansSC_Regular)) else FontFamily.Monospace,
fontFamily = getUtf8FontFamily(),
fontSize = inputFontSize,
color = MaterialTheme.colorScheme.onSurface,
lineHeight = inputLineHeight
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cc.unitmesh.devins.ui.compose.sketch

import androidx.compose.runtime.Composable
import androidx.compose.ui.text.font.FontFamily

/**
Expand All @@ -12,3 +13,11 @@ expect fun getFiraCodeFontFamily(): FontFamily
* Get default monospace font family as fallback
*/
fun getDefaultMonospaceFontFamily(): FontFamily = FontFamily.Monospace

/**
* Get UTF-8 font family for text display
* On WASM, returns Noto Sans SC for CJK support
* On other platforms, returns default font family
*/
@Composable
expect fun getUtf8FontFamily(): FontFamily
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cc.unitmesh.devins.ui.compose.sketch

import androidx.compose.runtime.Composable
import androidx.compose.ui.text.font.FontFamily

/**
Expand All @@ -12,3 +13,10 @@ actual fun getFiraCodeFontFamily(): FontFamily {
return FontFamily.Monospace
}

/**
* iOS implementation - use default font family
* iOS has good system font support for UTF-8
*/
@Composable
actual fun getUtf8FontFamily(): FontFamily = FontFamily.Default

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cc.unitmesh.devins.ui.compose.sketch

import androidx.compose.runtime.Composable
import androidx.compose.ui.text.font.FontFamily

/**
Expand All @@ -14,3 +15,10 @@ actual fun getFiraCodeFontFamily(): FontFamily {
// The browser will use the system's monospace font
return FontFamily.Monospace
}

/**
* JS implementation - use default font family
* Browser has good system font support for UTF-8
*/
@Composable
actual fun getUtf8FontFamily(): FontFamily = FontFamily.Default
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package cc.unitmesh.devins.ui.compose.sketch

import androidx.compose.runtime.Composable
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.platform.Font
Expand Down Expand Up @@ -29,3 +30,10 @@ actual fun getFiraCodeFontFamily(): FontFamily {
FontFamily.Monospace
}
}

/**
* JVM implementation - use default font family
* JVM has good system font support for UTF-8
*/
@Composable
actual fun getUtf8FontFamily(): FontFamily = FontFamily.Default
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
package cc.unitmesh.devins.ui.compose.sketch

import androidx.compose.runtime.Composable
import androidx.compose.ui.text.font.FontFamily
import autodev_intellij.mpp_ui.generated.resources.NotoSansSC_Regular
import autodev_intellij.mpp_ui.generated.resources.Res
import org.jetbrains.compose.resources.Font

/**
* WASM JS implementation of FiraCode font loading
* Falls back to default monospace
*
*
* Note: This is non-composable to match the expect declaration in commonMain
*/
actual fun getFiraCodeFontFamily(): FontFamily {
// WASM uses default monospace for code
return FontFamily.Monospace
}

/**
* WASM implementation - use Noto Sans SC for CJK support
* This font is only bundled in WASM builds (~18MB)
*/
@Composable
actual fun getUtf8FontFamily(): FontFamily {
return FontFamily(Font(Res.font.NotoSansSC_Regular))
}
Loading