@opensumi/ide-terminal-next 3.0.1 → 3.0.2-next-1715589837.0

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.
Files changed (48) hide show
  1. package/lib/browser/component/terminal.view.d.ts.map +1 -1
  2. package/lib/browser/component/terminal.view.js +22 -7
  3. package/lib/browser/component/terminal.view.js.map +1 -1
  4. package/lib/browser/contribution/terminal.command.js +2 -2
  5. package/lib/browser/contribution/terminal.command.js.map +1 -1
  6. package/lib/browser/terminal.client.d.ts +6 -2
  7. package/lib/browser/terminal.client.d.ts.map +1 -1
  8. package/lib/browser/terminal.client.js +12 -7
  9. package/lib/browser/terminal.client.js.map +1 -1
  10. package/lib/browser/terminal.context-key.d.ts +1 -0
  11. package/lib/browser/terminal.context-key.d.ts.map +1 -1
  12. package/lib/browser/terminal.context-key.js +1 -0
  13. package/lib/browser/terminal.context-key.js.map +1 -1
  14. package/lib/browser/terminal.controller.d.ts +5 -1
  15. package/lib/browser/terminal.controller.d.ts.map +1 -1
  16. package/lib/browser/terminal.controller.js +11 -6
  17. package/lib/browser/terminal.controller.js.map +1 -1
  18. package/lib/browser/terminal.error.d.ts +3 -0
  19. package/lib/browser/terminal.error.d.ts.map +1 -1
  20. package/lib/browser/terminal.error.js +6 -6
  21. package/lib/browser/terminal.error.js.map +1 -1
  22. package/lib/browser/terminal.search.d.ts +6 -5
  23. package/lib/browser/terminal.search.d.ts.map +1 -1
  24. package/lib/browser/terminal.search.js +16 -20
  25. package/lib/browser/terminal.search.js.map +1 -1
  26. package/lib/common/controller.d.ts +4 -3
  27. package/lib/common/controller.d.ts.map +1 -1
  28. package/lib/common/controller.js.map +1 -1
  29. package/lib/common/error.d.ts +3 -1
  30. package/lib/common/error.d.ts.map +1 -1
  31. package/lib/common/error.js.map +1 -1
  32. package/lib/node/pty.proxy.js +1 -1
  33. package/lib/node/pty.proxy.js.map +1 -1
  34. package/lib/node/terminal.service.client.d.ts.map +1 -1
  35. package/lib/node/terminal.service.client.js +1 -0
  36. package/lib/node/terminal.service.client.js.map +1 -1
  37. package/package.json +16 -16
  38. package/src/browser/component/terminal.view.tsx +28 -8
  39. package/src/browser/contribution/terminal.command.ts +2 -2
  40. package/src/browser/terminal.client.ts +14 -5
  41. package/src/browser/terminal.context-key.ts +7 -2
  42. package/src/browser/terminal.controller.ts +14 -5
  43. package/src/browser/terminal.error.ts +8 -4
  44. package/src/browser/terminal.search.ts +16 -19
  45. package/src/common/controller.ts +6 -3
  46. package/src/common/error.ts +4 -1
  47. package/src/node/pty.proxy.ts +1 -1
  48. package/src/node/terminal.service.client.ts +1 -0
@@ -1,6 +1,5 @@
1
- import { makeObservable, observable } from 'mobx';
2
-
3
1
  import { Autowired, Injectable } from '@opensumi/di';
2
+ import { Emitter } from '@opensumi/ide-core-common';
4
3
 
5
4
  import {
6
5
  IPtyExitEvent,
@@ -13,9 +12,11 @@ import {
13
12
 
14
13
  @Injectable()
15
14
  export class TerminalErrorService implements ITerminalErrorService {
16
- @observable
17
15
  errors: Map<string, ITerminalError> = new Map();
18
16
 
17
+ protected _onErrorsChangeEmitter = new Emitter<void>();
18
+ onErrorsChange = this._onErrorsChangeEmitter.event;
19
+
19
20
  @Autowired(ITerminalService)
20
21
  protected readonly service: ITerminalService;
21
22
 
@@ -26,9 +27,9 @@ export class TerminalErrorService implements ITerminalErrorService {
26
27
  protected readonly view: ITerminalGroupViewService;
27
28
 
28
29
  constructor() {
29
- makeObservable(this);
30
30
  this.service.onError((error) => {
31
31
  this.errors.set(error.id, error);
32
+ this._onErrorsChangeEmitter.fire();
32
33
  });
33
34
 
34
35
  this.service.onExit((event: IPtyExitEvent) => {
@@ -44,6 +45,7 @@ export class TerminalErrorService implements ITerminalErrorService {
44
45
 
45
46
  this.controller.onDidCloseTerminal((e) => {
46
47
  this.errors.delete(e.id);
48
+ this._onErrorsChangeEmitter.fire();
47
49
  });
48
50
  }
49
51
 
@@ -52,6 +54,8 @@ export class TerminalErrorService implements ITerminalErrorService {
52
54
  if (client) {
53
55
  await 0; // 使后面的 delete 发生在下一个 microTask 中,避免在迭代过程中修改 this.errors
54
56
  this.errors.delete(clientId);
57
+ this._onErrorsChangeEmitter.fire();
58
+
55
59
  client.reset();
56
60
  return client.attached.promise;
57
61
  }
@@ -1,5 +1,3 @@
1
- import { makeObservable, observable } from 'mobx';
2
-
3
1
  import { Autowired, Injectable } from '@opensumi/di';
4
2
  import { Emitter, Event, debounce } from '@opensumi/ide-core-common';
5
3
 
@@ -7,11 +5,14 @@ import { ITerminalClient, ITerminalController, ITerminalGroupViewService, ITermi
7
5
 
8
6
  @Injectable()
9
7
  export class TerminalSearchService implements ITerminalSearchService {
10
- @observable
11
- show: boolean;
12
-
13
- @observable
14
- input = '';
8
+ protected _isVisible: boolean = false;
9
+ get isVisible() {
10
+ return this._isVisible;
11
+ }
12
+ set isVisible(value: boolean) {
13
+ this._isVisible = value;
14
+ this._onVisibleChange.fire(value);
15
+ }
15
16
 
16
17
  @Autowired(ITerminalController)
17
18
  controller: ITerminalController;
@@ -19,35 +20,31 @@ export class TerminalSearchService implements ITerminalSearchService {
19
20
  @Autowired(ITerminalGroupViewService)
20
21
  terminalView: ITerminalGroupViewService;
21
22
 
22
- protected _onOpen = new Emitter<void>();
23
-
24
- onOpen: Event<void> = this._onOpen.event;
25
-
26
- constructor() {
27
- makeObservable(this);
28
- }
23
+ protected _onVisibleChange = new Emitter<boolean>();
24
+ onVisibleChange: Event<boolean> = this._onVisibleChange.event;
29
25
 
30
26
  get client(): ITerminalClient | undefined {
31
27
  return this.controller.findClientFromWidgetId(this.terminalView.currentWidget.id);
32
28
  }
33
29
 
34
30
  open() {
35
- this.show = true;
36
- this._onOpen.fire();
31
+ this.isVisible = true;
37
32
  }
38
33
 
39
34
  close() {
40
35
  this.client?.closeSearch();
41
- this.show = false;
36
+ this.isVisible = false;
42
37
  }
43
38
 
44
39
  clear() {
45
40
  this.client?.closeSearch();
46
- this.input = '';
41
+ this.text = '';
47
42
  }
48
43
 
44
+ text = '';
45
+
49
46
  @debounce(150)
50
47
  search() {
51
- this.client?.findNext(this.input);
48
+ this.client?.findNext(this.text);
52
49
  }
53
50
  }
@@ -102,6 +102,7 @@ export interface ITerminalController extends Disposable {
102
102
  onDidCloseTerminal: Event<ITerminalExitEvent>;
103
103
  onDidTerminalTitleChange: Event<ITerminalTitleChangeEvent>;
104
104
  onDidChangeActiveTerminal: Event<string>;
105
+ onThemeBackgroundChange: Event<string>;
105
106
 
106
107
  requestStartExtensionTerminal(
107
108
  proxy: ITerminalProcessExtHostProxy,
@@ -115,13 +116,15 @@ export interface ITerminalController extends Disposable {
115
116
 
116
117
  export const ITerminalSearchService = Symbol('ITerminalSearchService');
117
118
  export interface ITerminalSearchService {
118
- show: boolean;
119
- input: string;
119
+ isVisible: boolean;
120
+ onVisibleChange: Event<boolean>;
121
+
122
+ text: string;
123
+
120
124
  open(): void;
121
125
  clear(): void;
122
126
  close(): void;
123
127
  search(): void;
124
- onOpen: Event<void>;
125
128
  }
126
129
 
127
130
  export const ITerminalGroupViewService = Symbol('ITerminalGroupViewService');
@@ -1,4 +1,6 @@
1
- import { IShellLaunchConfig } from '..';
1
+ import { Event } from '@opensumi/ide-core-common';
2
+
3
+ import type { IShellLaunchConfig } from './pty';
2
4
 
3
5
  export enum ETerminalErrorType {
4
6
  CREATE_FAIL = 0,
@@ -40,5 +42,6 @@ export function isTerminalError(data: any): data is ITerminalError {
40
42
  export const ITerminalErrorService = Symbol('ITerminalErrorService');
41
43
  export interface ITerminalErrorService {
42
44
  errors: Map<string, ITerminalError>;
45
+ onErrorsChange: Event<void>;
43
46
  fix(clientId: string): Promise<void>;
44
47
  }
@@ -174,7 +174,7 @@ export class PtyServiceProxy implements IPtyProxyRPCService {
174
174
  });
175
175
 
176
176
  const onDataDisposable = ptyInstance?.onData((e) => {
177
- this.debugLogger.debug('ptyServiceCenter: onData', JSON.stringify(e), 'pid:', pid, 'callId', callId);
177
+ this.debugLogger.debug('ptyServiceCenter: onData', e, 'pid:', pid, 'callId', callId);
178
178
  if (typeof e === 'string') {
179
179
  // 缓存数据的时候只存放前1024个字符,因为正常情况下也不会超过1024个,如果超过的话,基本上是用户误操作导致的cat 二进制文件或者其他未知问题
180
180
  // 比如说某个程序一直通过CSI转义命令来以用户不可见的方式增加终端输出内容
@@ -68,6 +68,7 @@ export class TerminalServiceClientImpl extends RPCService<IRPCTerminalService> i
68
68
 
69
69
  processChange(clientId: string, processName: string): void {
70
70
  if (this.client) {
71
+ this.logger.log(`processChange ${clientId} ${processName}`);
71
72
  this.client.$processChange(clientId, processName);
72
73
  }
73
74
  }