@ia-ccun/idea-plugin-share 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugins/aicode-agent-0.1.0-223.zip +0 -0
- package/plugins/aicode-jcef-kylin-input-method-fix.md +182 -0
- package/plugins/aicode-agent-0.1.0-241.zip +0 -0
- package/plugins/backend.zip +0 -0
- package/plugins/demo_view/agent_call.png +0 -0
- package/plugins/demo_view/approve.png +0 -0
- package/plugins/demo_view/askuserquestion.png +0 -0
- package/plugins/demo_view/case0.png +0 -0
- package/plugins/demo_view/case1.png +0 -0
- package/plugins/demo_view/case2.png +0 -0
- package/plugins/demo_view/case4.png +0 -0
- package/plugins/demo_view/case5.png +0 -0
- package/plugins/demo_view/case6.png +0 -0
- package/plugins/demo_view/index.png +0 -0
- package/plugins/demo_view/mcp.png +0 -0
- package/plugins/demo_view/overview.png +0 -0
- package/plugins/demo_view/questioin.png +0 -0
- package/plugins/frontend.zip +0 -0
package/package.json
CHANGED
|
Binary file
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# AICode 插件 · 麒麟 Linux 中文输入法 & 焦点问题解决方案
|
|
2
|
+
|
|
3
|
+
> 适用:内网麒麟 V10 (UKUI 桌面) + fcitx 输入法 + IntelliJ IDEA 2022.3 (JBR 17.0.6) + AICode 插件 (JCEF 聊天面板)
|
|
4
|
+
>
|
|
5
|
+
> 症状:打开 AICode 聊天面板后,中文无法上屏;面板之外的 IDE 编辑区 / 项目树键盘失灵
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 根因(按确认度排序)
|
|
10
|
+
|
|
11
|
+
1. **环境变量未传进 IDEA 进程** — 国产 Linux 桌面(麒麟 UKUI / UOS DDE)默认把 `GTK_IM_MODULE=fcitx` 等隐式配置在 `.pam_environment` / `.xinputrc` 里,JetBrains 启动脚本 (idea.sh) 偶发不继承这些环境变量,JCEF 容器内的 Chromium 进程拿不到 IME context,**commit 不进**
|
|
12
|
+
2. **JBR 默认 XToolkit 后端对 fcitx 桥接不完整** — JBR 17 在 Linux 上默认走 `XToolkit`(非 GTK),fcitx 经 XIM 协议转发到 JCEF 时事件被吞;强制 `AWT_TOOLKIT=GTK` 后 Java AWT 用 GTK event loop 透传 IME,commit 正常
|
|
13
|
+
3. **JCEF heavyweight 容器跟 Swing lightweight 混排** — AWT 默认 mixing 允许 heavyweight (CEF) 与 lightweight (Swing) 组件共享 z-order,CEF grab 焦点后不回交,编辑区 / 项目树键盘失灵
|
|
14
|
+
4. ~~JDK 1.8 不支持 JCEF~~ — **已排除**:内网 IDEA Runtime version 实测 17.0.6+,不是 JDK 1.8
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 验证三步(动手前先确认)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# 1. 确认 IDEA 真的是 JBR 17(不是 JDK 1.8)
|
|
22
|
+
# IDEA → Help → About → "Runtime version:" 一行
|
|
23
|
+
# 应该是 "17.0.6+1-b653.34" 或类似,开头是 17/21
|
|
24
|
+
|
|
25
|
+
# 2. 确认 fcitx 在普通应用里能正常输中文
|
|
26
|
+
# 起个 xterm / gnome-terminal,切到中文,看状态栏是否跟着光标走
|
|
27
|
+
fcitx5-remote -c # fcitx5
|
|
28
|
+
# 或:fcitx-remote -c # 老版 fcitx 4
|
|
29
|
+
|
|
30
|
+
# 3. 确认补丁已生效(你应该在 idea.log 里看到)
|
|
31
|
+
grep "JCEF off-screen rendering disabled" ~/.cache/JetBrains/IdeaIC2022.3/log/idea.log 2>/dev/null
|
|
32
|
+
grep "JCEF off-screen rendering disabled" ~/.config/JetBrains/IdeaIC2022.3/log/idea.log 2>/dev/null
|
|
33
|
+
# 或直接:Help → Show Log in Explorer → 搜 "JCEF off-screen rendering disabled"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 方案 A(最快,2 分钟验证)
|
|
39
|
+
|
|
40
|
+
在启动 IDEA 的终端**手动 export 环境变量**然后启 IDEA:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
export GTK_IM_MODULE=fcitx
|
|
44
|
+
export QT_IM_MODULE=fcitx
|
|
45
|
+
export XMODIFIERS=@im=fcitx
|
|
46
|
+
export SDL_IM_MODULE=fcitx
|
|
47
|
+
export AWT_TOOLKIT=GTK # 关键:强制 JBR 走 GTK 后端,吃 fcitx 事件
|
|
48
|
+
export LC_ALL=zh_CN.UTF-8 # 顺手修中文字符集
|
|
49
|
+
|
|
50
|
+
/opt/idea-IC-2022.3.3/bin/idea.sh
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**AWT_TOOLKIT=GTK** 是关键一招——JBR 17 在 Linux 默认 XToolkit 对 fcitx 桥接残缺,强制 GTK 后端后 IME 事件从 GTK event loop 直接透传到 JCEF Chromium 进程。
|
|
54
|
+
|
|
55
|
+
如果这一步中文就能输了,跳到「方案 B」做持久化。
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 方案 B(持久化,重启免配)
|
|
60
|
+
|
|
61
|
+
写入 `~/.pam_environment`,**重新登录**(不是重启 shell,是 logout/login)让 PAM 生效:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
cat >> ~/.pam_environment <<'EOF'
|
|
65
|
+
GTK_IM_MODULE=fcitx
|
|
66
|
+
QT_IM_MODULE=fcitx
|
|
67
|
+
XMODIFIERS=@im=fcitx
|
|
68
|
+
SDL_IM_MODULE=fcitx
|
|
69
|
+
AWT_TOOLKIT=GTK
|
|
70
|
+
LC_ALL=zh_CN.UTF-8
|
|
71
|
+
EOF
|
|
72
|
+
|
|
73
|
+
# 验证写入
|
|
74
|
+
cat ~/.pam_environment
|
|
75
|
+
|
|
76
|
+
# 然后 **注销重新登录**
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
> 注意:麒麟 UKUI 部分版本不读 `~/.pam_environment`,fallback 用 `~/.xprofile`:
|
|
80
|
+
>
|
|
81
|
+
> ```bash
|
|
82
|
+
> cat > ~/.xprofile <<'EOF'
|
|
83
|
+
> export GTK_IM_MODULE=fcitx
|
|
84
|
+
> export QT_IM_MODULE=fcitx
|
|
85
|
+
> export XMODIFIERS=@im=fcitx
|
|
86
|
+
> export AWT_TOOLKIT=GTK
|
|
87
|
+
> export LC_ALL=zh_CN.UTF-8
|
|
88
|
+
> EOF
|
|
89
|
+
> # 同样重新登录
|
|
90
|
+
> ```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 方案 C(环境变量还救不了,叠 JCEF 启动参数)
|
|
95
|
+
|
|
96
|
+
如果方案 A/B 后**中文能输但焦点仍被面板拦截**,打开 `Help → Edit Custom VM Options`,加:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
-Dawt.useSystemAAFontSettings=on
|
|
100
|
+
-Dsun.awt.disableMixing=true # 关键:阻止 AWT 把 heavyweight CEF 与 lightweight Swing 混排
|
|
101
|
+
-Didea.browser.jcef.gpu.disable=true # 禁 GPU 加速,少一个焦点抢占源
|
|
102
|
+
-Dide.browser.jcef.osr.enabled=false # 跟代码里的 JcefRenderMode 等价
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`-Dsun.awt.disableMixing=true` 是治「焦点被面板拦截」的关键——默认 AWT 允许 CEF 容器 grab 焦点不放,混排关闭后 CEF 与 Swing 各管各的 z-order,IDE 编辑区焦点不丢。
|
|
106
|
+
|
|
107
|
+
保存后 **重启 IDEA**。
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 方案 D(终极保底:换 JBR 17 + 重打插件)
|
|
112
|
+
|
|
113
|
+
如果上面都失效——理论上极少见——说明当前 JBR 17.0.6 跟 fcitx 5 有版本不兼容(极个别 fcitx 5 commit 协议版本与 JBR 17.0.6 不匹配),可换更新的 JBR 17:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# 1. 下 JBR 17 (放到 ../idea-plugin-transform/plugins/ 下做归档)
|
|
117
|
+
# URL: https://github.com/JetBrains/JetBrainsRuntime/releases
|
|
118
|
+
# 找 jdk-17+xxx 系列稳定 release,下 jbr-*-linux-x64.tar.gz (~200MB)
|
|
119
|
+
|
|
120
|
+
# 2. 解压
|
|
121
|
+
mkdir -p ~/jbr17
|
|
122
|
+
tar -xzf jbr-17.0.13-linux-x64.tar.gz -C ~/jbr17 --strip-components=1
|
|
123
|
+
|
|
124
|
+
# 3. IDEA 启动前 export
|
|
125
|
+
export IDEA_JDK=$HOME/jbr17
|
|
126
|
+
|
|
127
|
+
# 4. 启 IDEA,Help → About 验证 Runtime version 换了
|
|
128
|
+
/opt/idea-IC-2022.3.3/bin/idea.sh
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## 快速决策树
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
fcitx 在普通应用里能输中文吗?
|
|
137
|
+
├─ 不能 → 修 fcitx 本身(chkconfig / fcitx5-diagnose),跟 AICode 无关
|
|
138
|
+
└─ 能
|
|
139
|
+
│
|
|
140
|
+
IDEA Runtime version 是 17+ 吗?
|
|
141
|
+
├─ 不是 (JDK 8) → 切 JBR 17,参考方案 D
|
|
142
|
+
└─ 是
|
|
143
|
+
│
|
|
144
|
+
idea.log 有 "JCEF off-screen rendering disabled" 吗?
|
|
145
|
+
├─ 没有 → 重新装 aicode-agent-0.1.0-223.zip,确保 plugin 真的加载
|
|
146
|
+
└─ 有
|
|
147
|
+
│
|
|
148
|
+
手动 export GTK_IM_MODULE=fcitx + AWT_TOOLKIT=GTK 后启 IDEA?
|
|
149
|
+
├─ 还不行 → 叠方案 C 的 vmoptions(disableMixing)
|
|
150
|
+
└─ 行了 → 写入 ~/.pam_environment 或 ~/.xprofile 持久化
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 与代码 / 插件包的关系
|
|
156
|
+
|
|
157
|
+
本问题**不需要改 Kotlin 代码**。`JcefRenderMode` 已正确在 Linux 上关掉 OSR,问题在 IDE 进程外部的环境配置。
|
|
158
|
+
|
|
159
|
+
但建议在 `AicodeChatPanel` 启动时打一条诊断日志,方便用户排查时确认自己走到了正确分支:
|
|
160
|
+
|
|
161
|
+
```kotlin
|
|
162
|
+
// 建议加在 initJcefChat() 里,浏览器构建之后
|
|
163
|
+
log.info("""
|
|
164
|
+
AICode chat panel initialized:
|
|
165
|
+
JBR version: ${System.getProperty("java.runtime.version")}
|
|
166
|
+
OS: ${System.getProperty("os.name")} ${System.getProperty("os.version")}
|
|
167
|
+
AWT_TOOLKIT: ${System.getProperty("awt.toolkit")}
|
|
168
|
+
GTK_IM_MODULE: ${System.getenv("GTK_IM_MODULE")}
|
|
169
|
+
""".trimIndent())
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
用户报问题时把这段日志贴回来能立刻定位是哪一环缺失。
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 相关文档
|
|
177
|
+
|
|
178
|
+
- JcefRenderMode.kt — Linux OSR 关闭实现(已编入 0.1.0-223)
|
|
179
|
+
- JetBrains Forum: JCEF Chinese IME on Wayland/X11 — 多方案对比
|
|
180
|
+
- fcitx5 官方文档: `man fcitx5` / `fcitx5-diagnose`
|
|
181
|
+
|
|
182
|
+
最后更新:2026-08-28
|
|
Binary file
|
package/plugins/backend.zip
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/plugins/frontend.zip
DELETED
|
Binary file
|