-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support terminal intelligence #3390
base: main
Are you sure you want to change the base?
Conversation
This PR was not deployed automatically as @life2015 does not have access to the Railway project. In order to get automatic PR deploys, please add @life2015 to the project inside the project settings page. |
@life2015 个人感觉补全逻辑不应该挪到 NodeJS,相应的数据逻辑倒是可以灵活有点,一个实际状况是这种补全能力,在纯前端上面应该是个痛点,在本地场景,可能还会与系统的一些 GhostText 补全(例如安装了 zsh)冲突 可以基于 WebC 搞个版本,接入 AI 的上下文补全来搞一下? |
是的,在纯前端场景上也能享受到终端智能补全能力是我把核心 Runtime 放到前端的主要原因。当时参考的 Fig 以及 inShellisense 都是基于 Node.js 来跑的,我做了一些前端的迁移和适配,理论上把 FS 读取和 Fig Generators 对 bash 的调用做后端代理之后,前后端的功能差异不会很大。 其实对于 OpenSumi 完整版而言,后端实现会更容易,前段实现难一些,不过目前前端实现我也已经跑通了,就是需要再衡量一下两条路线,我个人也是倾向于前端方案,这样会方便未来一些纯前端场景的接入。 目前来看,支持 WebC 的问题不大。我们后续需要把前端对后端的依赖层做一个抽象,然后分开传统场景,WebC,以及云终端各种场景做分别的注入。 |
d7eb345
to
dd4e0a1
Compare
全面更新终端补全能力的交互 99ad0be |
Terminal 智能的底层补全逻辑做了大规模重构,核心逻辑放置于 common,环境相关的逻辑可以单独在 Browser 或者 Node.js 层实现。目前是采用了 Node.js 层实现,通过覆写两个 Class 即可做到。 TODO: |
packages/terminal-next/src/browser/component/terminal-intell-complete-controller.tsx
Show resolved
Hide resolved
packages/terminal-next/src/browser/intell/intell-terminal.service.tsx
Outdated
Show resolved
Hide resolved
packages/terminal-next/src/browser/intell/intell-terminal.service.tsx
Outdated
Show resolved
Hide resolved
left: 0; | ||
|
||
// TODO 考虑动态设置字体 | ||
font-family: Menlo, Monaco, 'Courier New', monospace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
调整成 opensumi 全局用的 font-family 吧,代码库里搜一下
packages/terminal-next/src/browser/component/terminal-intell-complete-controller.tsx
Show resolved
Hide resolved
|
||
private initContainer() { | ||
this.popupContainer = document.createElement('div'); | ||
this.popupContainer.style.zIndex = '12'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不要 hard code,记在 StackingLevel
这个枚举值里
this.listenPromptState(client.term); | ||
} catch (e) { | ||
// eslint-disable-next-line no-console | ||
console.error('listenTerminalEvent', e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用 this.logger
private getConnection(xterm: Terminal): ITerminalConnection { | ||
// @ts-ignore | ||
// 目前需要强制取用 Addon 的 connection 能力 | ||
const attachAddon = xterm._addonManager._addons.find((addon) => !!addon?.instance?.connection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attachAddon 里就有 connection, attachAddon 可以在 TerminalClient 里拿到。
TerminalClient 是一个 xterm 渲染的起始位置,肯定是可以拿到这个 attachAddon 的
终端的智能补全能力
终端的智能补全能力是指终端在输入命令时,能够根据用户的输入,自动提示可能的命令或参数,交互方式类似于编程时的语言服务。
此功能可以增加用户使用终端时的易用性。
功能建设
功能建设进度
Types
实验性支持了终端的智能补全,体验打磨中。
Background or solution
目前 Warp, FIg 这类终端智能产品越来越多,相关的用户心智和社区基建也愈发成熟。
并且在前段时间我们完成了对 Xterm.js Decoration 相关技术的掌握,因此基于 Xterm.js Decoration 和 inShellisense 项目的 Runtime 做出了 OpenSumi 上终端智能的实现。
Changelog