3.4.5 • Published 2 months ago

@opensumi/ide-terminal-next v3.4.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

终端

实现方式

实现 src/common/term.ts 文件中的 ITerminalService 类型,并在 src/browser/index.ts 中替换默认的 service 类型。

export interface ITerminalService {
  /**
   * 集成方自定义会话唯一标识的函数
   */
  makeId(): string;
  /**
   * 集成方自定义写入到 localStorage 的键值的函数
   */
  restore(): string;
  /**
   * 当关闭 IDE 的时候,允许集成方额外向每一个会话标识写入一个字符串字段,
   * 信息内容由集成方决定
   *
   * @param sessionId 会话唯一标识
   */
  meta(sessionId: string): string;
  /**
   * Xterm 终端的构造选项
   */
  getOptions(): ITerminalOptions;
  /**
   * 用于获取特定会话的相关信息,包括进程 id 以及进程描述的 name,
   * 这个函数允许返回为空
   *
   * @param sessionId 会话唯一标识
   */
  intro(sessionId: string): { pid: number, name: string } | undefined;
  /**
   *
   * @param id 会话唯一标识
   * @param message 发送的字符串信息
   */
  sendText(id: string, message: string): Promise<void>;
  /**
   *
   * @param sessionId 会话唯一标识
   * @param term 返回的 Xterm 终端实例
   * @param restore 是否是恢复一个终端
   * @param meta 恢复终端所需要的额外字段
   * @param attachMethod 将 websocket 连接和 xterm 连接起来的函数
   * @param options 创建一个新终端的进程选项
   */
  attach(sessionId: string, term: Terminal, restore: boolean, meta: string, attachMethod: (s: WebSocket) => void, options?: TerminalOptions): Promise<void>;
  /**
   *
   * @param sessionId 会话唯一标识
   * @param cols resize 的列数
   * @param rows resize 的行数
   */
  resize(sessionId: string, cols: number, rows: number): Promise<void>;
  /**
   * 销毁一个终端进程
   *
   * @param sessionId 会话唯一标识
   */
  disposeById(sessionId: string): void;
  /**
   * 异步向后端获取一个会话的进程 id
   *
   * @param sessionId 会话唯一标识
   */
  getProcessId(sessionId: string): Promise<number>;

  /**
   * 报错处理的事件
   *
   * @param handler
   */
  onError(handler: (error: ITerminalError) => void): void;
}

外部和内部 API

对于 common 中默认导出的 api 认为为外部 api,而对于 common 中没有默认导出的类型则认为为内部 api,内部 api 依然可以通过子名称获取到类型进行覆盖或者使用,但是内部 api 的任何 api 修改不作为 bk,不推荐直接使用内部 api。

接下来

  • 终端首次初始化使用对比的外层 dom 节点需要可指定,这里可能需要使用 core 内部 api 手动计算
  • 终端 Singleton 模式
  • 终端后端 Pty 代码优化,需要支持开发时重连
  • Vim 显示优化
3.4.5

2 months ago

3.4.4

2 months ago

3.4.0

3 months ago

3.4.3

2 months ago

3.4.1

3 months ago

3.3.3

3 months ago

3.3.2

4 months ago

3.3.1

4 months ago

3.3.0

4 months ago

3.2.5

4 months ago

3.1.3

6 months ago

3.1.2

6 months ago

3.1.1

6 months ago

3.1.0

7 months ago

3.1.4

6 months ago

3.2.2

5 months ago

3.2.1

5 months ago

3.2.0

5 months ago

3.2.4

4 months ago

3.2.3

4 months ago

3.0.4

7 months ago

3.0.3

7 months ago

3.0.2

7 months ago

3.0.1

8 months ago

3.0.0

8 months ago

3.0.0-alpha.0

8 months ago

2.27.2

11 months ago

2.26.7

1 year ago

2.26.6

1 year ago

2.26.8

1 year ago

2.26.3

1 year ago

2.26.2

1 year ago

2.26.5

1 year ago

2.26.4

1 year ago

2.26.1

1 year ago

2.26.0

1 year ago

2.27.1

1 year ago

2.27.0

1 year ago

2.25.4

1 year ago

2.25.3

1 year ago

2.25.2

1 year ago

2.25.0

2 years ago

2.25.1

2 years ago

2.24.5

2 years ago

2.24.4

2 years ago

2.24.6

2 years ago

2.24.3

2 years ago

2.24.2

2 years ago

2.23.6

2 years ago

2.23.5

2 years ago

2.23.2

2 years ago

2.23.1

2 years ago

2.23.4

2 years ago

2.23.3

2 years ago

2.22.7

2 years ago

2.22.6

2 years ago

2.22.9

2 years ago

2.22.8

2 years ago

2.22.5

2 years ago

2.22.10

2 years ago

2.22.11

2 years ago

2.24.1

2 years ago

2.24.0

2 years ago

2.23.0

2 years ago

2.22.3

2 years ago

2.22.2

2 years ago

2.22.4

2 years ago

2.22.1

2 years ago

2.22.0

2 years ago

2.21.8

2 years ago

2.21.7

2 years ago

2.21.9

2 years ago

2.21.11

2 years ago

2.21.10

2 years ago

2.21.13

2 years ago

2.21.12

2 years ago

2.21.2

2 years ago

2.21.4

2 years ago

2.21.3

2 years ago

2.21.6

2 years ago

2.21.5

2 years ago

2.20.13

2 years ago

2.20.12

2 years ago

2.21.0

2 years ago

2.21.1

2 years ago

2.20.3

2 years ago

2.20.8

2 years ago

2.20.9

2 years ago

2.20.6

2 years ago

2.20.7

2 years ago

2.20.4

2 years ago

2.20.5

2 years ago

2.20.10

2 years ago

2.20.11

2 years ago

2.20.2

2 years ago

2.20.0

2 years ago

2.20.1

2 years ago

2.19.9

2 years ago

2.19.13

2 years ago

2.19.14

2 years ago

2.19.10

2 years ago

2.19.11

2 years ago

2.19.12

2 years ago

2.19.8

2 years ago

2.19.6

2 years ago

2.19.7

2 years ago

2.19.4

2 years ago

2.19.5

2 years ago

2.19.2

2 years ago

2.19.3

2 years ago

2.19.0

2 years ago

2.19.1

2 years ago

2.18.9

2 years ago

2.18.7

2 years ago

2.18.8

2 years ago

2.18.5

3 years ago

2.18.6

3 years ago

2.18.4

3 years ago

2.18.17

2 years ago

2.18.12

2 years ago

2.18.13

2 years ago

2.18.14

2 years ago

2.18.15

2 years ago

2.18.10

2 years ago

2.18.11

2 years ago

2.17.12

2 years ago

2.18.3

3 years ago

2.18.1

3 years ago

2.18.2

3 years ago

2.18.0

3 years ago

2.16.15

3 years ago

2.16.14

3 years ago

2.16.13

3 years ago

2.17.8

3 years ago

2.17.9

3 years ago

2.17.6

3 years ago

2.17.7

3 years ago

2.17.4

3 years ago

2.17.5

3 years ago

2.17.2

3 years ago

2.17.3

3 years ago

2.17.11

3 years ago

2.17.10

3 years ago

2.14.5

3 years ago

2.16.11

3 years ago

2.16.10

3 years ago

2.16.12

3 years ago

2.17.0

3 years ago

2.17.1

3 years ago

2.16.9

3 years ago

2.16.7

3 years ago

2.16.8

3 years ago

2.16.5

3 years ago

2.16.6

3 years ago

2.16.3

3 years ago

2.16.4

3 years ago

2.16.1

3 years ago

2.16.2

3 years ago

2.15.8

3 years ago

2.15.9

3 years ago

2.15.6

3 years ago

2.15.7

3 years ago

2.15.4

3 years ago

2.15.5

3 years ago

2.15.3

3 years ago

2.16.0

3 years ago

2.13.10

3 years ago

2.13.8

3 years ago

2.13.9

3 years ago

2.13.6

3 years ago

2.13.7

3 years ago

2.15.2

3 years ago

2.13.5

3 years ago

2.15.0

3 years ago

2.15.1

3 years ago

2.14.3

3 years ago

2.14.4

3 years ago

2.14.1

3 years ago

2.14.2

3 years ago

2.14.0

3 years ago

2.13.5-next.0

3 years ago

2.12.1-next.166

3 years ago

2.13.4

3 years ago

2.13.3

3 years ago

2.13.2

3 years ago

2.13.1

3 years ago

2.13.0

3 years ago