@opensumi/ide-core-browser 3.1.4 → 3.1.5-next-1719913150.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 (57) hide show
  1. package/lib/ai-native/command.d.ts +3 -0
  2. package/lib/ai-native/command.d.ts.map +1 -1
  3. package/lib/ai-native/command.js +4 -1
  4. package/lib/ai-native/command.js.map +1 -1
  5. package/lib/bootstrap/app.d.ts +0 -1
  6. package/lib/bootstrap/app.d.ts.map +1 -1
  7. package/lib/bootstrap/app.js +3 -14
  8. package/lib/bootstrap/app.js.map +1 -1
  9. package/lib/bootstrap/connection.d.ts.map +1 -1
  10. package/lib/bootstrap/connection.js +3 -0
  11. package/lib/bootstrap/connection.js.map +1 -1
  12. package/lib/bootstrap/inner-providers.d.ts.map +1 -1
  13. package/lib/bootstrap/inner-providers.js +4 -0
  14. package/lib/bootstrap/inner-providers.js.map +1 -1
  15. package/lib/common/common.command.d.ts +4 -0
  16. package/lib/common/common.command.d.ts.map +1 -1
  17. package/lib/common/common.command.js +5 -0
  18. package/lib/common/common.command.js.map +1 -1
  19. package/lib/components/actions/index.d.ts.map +1 -1
  20. package/lib/components/actions/index.js +0 -32
  21. package/lib/components/actions/index.js.map +1 -1
  22. package/lib/components/ai-native/ai-action/index.d.ts +2 -2
  23. package/lib/components/ai-native/ai-action/index.d.ts.map +1 -1
  24. package/lib/components/ai-native/ai-action/index.js +3 -3
  25. package/lib/components/ai-native/ai-action/index.js.map +1 -1
  26. package/lib/components/ai-native/enhanceIcon/index.d.ts +1 -0
  27. package/lib/components/ai-native/enhanceIcon/index.d.ts.map +1 -1
  28. package/lib/components/ai-native/enhanceIcon/index.js +14 -7
  29. package/lib/components/ai-native/enhanceIcon/index.js.map +1 -1
  30. package/lib/components/ai-native/interactive-input/index.d.ts.map +1 -1
  31. package/lib/components/ai-native/interactive-input/index.js +6 -1
  32. package/lib/components/ai-native/interactive-input/index.js.map +1 -1
  33. package/lib/components/layout/split-panel.service.d.ts +0 -1
  34. package/lib/components/layout/split-panel.service.d.ts.map +1 -1
  35. package/lib/components/layout/split-panel.service.js +17 -8
  36. package/lib/components/layout/split-panel.service.js.map +1 -1
  37. package/lib/contextkey/ai-native.d.ts +3 -0
  38. package/lib/contextkey/ai-native.d.ts.map +1 -1
  39. package/lib/contextkey/ai-native.js +4 -1
  40. package/lib/contextkey/ai-native.js.map +1 -1
  41. package/lib/logger/browser-logger.d.ts +10 -6
  42. package/lib/logger/browser-logger.d.ts.map +1 -1
  43. package/lib/logger/browser-logger.js +15 -5
  44. package/lib/logger/browser-logger.js.map +1 -1
  45. package/package.json +5 -5
  46. package/src/ai-native/command.ts +4 -0
  47. package/src/bootstrap/app.ts +2 -16
  48. package/src/bootstrap/connection.ts +6 -0
  49. package/src/bootstrap/inner-providers.ts +4 -0
  50. package/src/common/common.command.ts +7 -0
  51. package/src/components/actions/index.tsx +1 -35
  52. package/src/components/ai-native/ai-action/index.tsx +5 -5
  53. package/src/components/ai-native/enhanceIcon/index.tsx +15 -8
  54. package/src/components/ai-native/interactive-input/index.tsx +7 -0
  55. package/src/components/layout/split-panel.service.ts +16 -5
  56. package/src/contextkey/ai-native.ts +3 -0
  57. package/src/logger/browser-logger.ts +21 -9
@@ -1,6 +1,8 @@
1
1
  import cls from 'classnames';
2
2
  import React, { useCallback } from 'react';
3
3
 
4
+ import { CommandService } from '@opensumi/ide-core-common';
5
+
4
6
  import { Icon } from '../../../components';
5
7
  import { MenuNode } from '../../../menu/next/base';
6
8
  import { IBrowserCtxMenu } from '../../../menu/next/renderer/ctxmenu/browser';
@@ -40,6 +42,7 @@ export const EnhanceIcon = React.forwardRef<HTMLDivElement | null, IEnhanceIconP
40
42
  );
41
43
 
42
44
  interface IEnhanceIconWithCtxMenuProps extends IEnhanceIconProps {
45
+ id?: string;
43
46
  menuNodes: MenuNode[];
44
47
  skew?: { x: number; y: number };
45
48
  }
@@ -48,7 +51,8 @@ interface IEnhanceIconWithCtxMenuProps extends IEnhanceIconProps {
48
51
  * 包含下拉菜单的 icon 组件,可以自定义下拉菜单位置
49
52
  */
50
53
  export const EnhanceIconWithCtxMenu = (props: IEnhanceIconWithCtxMenuProps) => {
51
- const { children, menuNodes, skew, ...restProps } = props;
54
+ const { children, menuNodes, skew, id: commandId, ...restProps } = props;
55
+ const commandService = useInjectable<CommandService>(CommandService);
52
56
 
53
57
  const ctxMenuRenderer = useInjectable<IBrowserCtxMenu>(IBrowserCtxMenu);
54
58
  const [anchor, setAnchor] = React.useState<{ x: number; y: number } | undefined>(undefined);
@@ -89,14 +93,17 @@ export const EnhanceIconWithCtxMenu = (props: IEnhanceIconWithCtxMenuProps) => {
89
93
  if (!anchor) {
90
94
  return;
91
95
  }
92
-
93
- handleRefRect((_anchor) => {
94
- ctxMenuRenderer.show({
95
- anchor: _anchor,
96
- menuNodes,
96
+ if (menuNodes) {
97
+ handleRefRect((_anchor) => {
98
+ ctxMenuRenderer.show({
99
+ anchor: _anchor,
100
+ menuNodes,
101
+ });
97
102
  });
98
- });
99
- }, [iconRef.current, menuNodes, anchor]);
103
+ } else if (commandId) {
104
+ commandService.executeCommand(commandId);
105
+ }
106
+ }, [iconRef.current, menuNodes, anchor, commandId]);
100
107
 
101
108
  return (
102
109
  <EnhanceIcon ref={iconRef} onClick={handleClick} {...restProps}>
@@ -38,6 +38,7 @@ export const InteractiveInput = React.forwardRef(
38
38
  width,
39
39
  sendBtnClassName,
40
40
  popoverPosition,
41
+ autoFocus,
41
42
  } = props;
42
43
 
43
44
  const internalRef = useRef<HTMLTextAreaElement>(null);
@@ -48,6 +49,12 @@ export const InteractiveInput = React.forwardRef(
48
49
 
49
50
  useImperativeHandle(ref, () => internalRef.current as HTMLTextAreaElement);
50
51
 
52
+ useEffect(() => {
53
+ if (internalRef && internalRef.current && autoFocus) {
54
+ internalRef.current.focus();
55
+ }
56
+ }, [internalRef]);
57
+
51
58
  useEffect(() => {
52
59
  const value = props.value;
53
60
  if (isUndefined(value)) {
@@ -3,6 +3,8 @@ import React from 'react';
3
3
  import { Autowired, INJECTOR_TOKEN, Injectable, Injector } from '@opensumi/di';
4
4
  import { Deferred, Disposable, IDisposable } from '@opensumi/ide-core-common';
5
5
 
6
+ import { RESIZE_LOCK } from '../resize/resize';
7
+
6
8
  import { SplitPanelProps } from './split-panel';
7
9
 
8
10
  export const ISplitPanelService = Symbol('ISplitPanelService');
@@ -23,7 +25,6 @@ export interface ISplitPanelService extends IDisposable {
23
25
 
24
26
  @Injectable({ multiple: true })
25
27
  export class SplitPanelService extends Disposable implements ISplitPanelService {
26
- private static MIN_SIZE = 120;
27
28
  constructor(protected readonly panelId: string) {
28
29
  super();
29
30
  }
@@ -50,20 +51,30 @@ export class SplitPanelService extends Disposable implements ISplitPanelService
50
51
  getFirstResizablePanel(index: number, direction: boolean, isPrev?: boolean): HTMLElement | undefined {
51
52
  if (isPrev) {
52
53
  if (direction) {
53
- return this.panels[index];
54
+ for (let i = index; i >= 0; i--) {
55
+ if (!this.panels[i].classList.contains(RESIZE_LOCK)) {
56
+ // 跳过无法调整的面板
57
+ return this.panels[i];
58
+ }
59
+ }
54
60
  } else {
55
61
  for (let i = index; i >= 0; i--) {
56
- if (this.panels[i].clientHeight > SplitPanelService.MIN_SIZE) {
62
+ if (!this.panels[i].classList.contains(RESIZE_LOCK)) {
57
63
  return this.panels[i];
58
64
  }
59
65
  }
60
66
  }
61
67
  } else {
62
68
  if (!direction) {
63
- return this.panels[index + 1];
69
+ for (let i = index + 1; i < this.panels.length; i++) {
70
+ if (!this.panels[i].classList.contains(RESIZE_LOCK)) {
71
+ // 跳过无法调整的面板
72
+ return this.panels[i];
73
+ }
74
+ }
64
75
  } else {
65
76
  for (let i = index + 1; i < this.panels.length; i++) {
66
- if (this.panels[i].clientHeight > SplitPanelService.MIN_SIZE) {
77
+ if (!this.panels[i].classList.contains(RESIZE_LOCK)) {
67
78
  return this.panels[i];
68
79
  }
69
80
  }
@@ -2,3 +2,6 @@ import { RawContextKey } from '../raw-context-key';
2
2
 
3
3
  export const InlineChatIsVisible = new RawContextKey('ai.native.inlineChatIsVisible', false);
4
4
  export const InlineCompletionIsTrigger = new RawContextKey('ai.native.inlineCompletionIsTrigger', false);
5
+ export const InlineHintWidgetIsVisible = new RawContextKey('ai.native.inlineHintWidgetIsVisible', false);
6
+ export const InlineInputWidgetIsVisible = new RawContextKey('ai.native.inlineInputWidgetIsVisible', false);
7
+ export const InlineDiffPartialEditsIsVisible = new RawContextKey('ai.native.inlineDiffPartialEditsIsVisible', false);
@@ -3,19 +3,15 @@ import { ILogServiceClient, ILoggerManagerClient, LogLevel, SupportLogNamespace
3
3
 
4
4
  export { ILogger } from '@opensumi/ide-core-common';
5
5
 
6
- @Injectable()
7
- export class Logger implements ILogServiceClient {
8
- @Autowired(ILoggerManagerClient)
9
- private LoggerManager: ILoggerManagerClient;
6
+ class LoggerWrapper implements ILogServiceClient {
7
+ protected logger: ILogServiceClient;
10
8
 
11
- private logger: ILogServiceClient;
12
-
13
- constructor() {
14
- this.logger = this.LoggerManager.getLogger(SupportLogNamespace.Browser);
9
+ setup(logger: ILogServiceClient) {
10
+ this.logger = logger;
15
11
  }
16
12
 
17
13
  public getLevel() {
18
- return this.getLevel();
14
+ return this.logger.getLevel();
19
15
  }
20
16
 
21
17
  public setLevel(level: LogLevel) {
@@ -49,3 +45,19 @@ export class Logger implements ILogServiceClient {
49
45
  return this.logger.dispose();
50
46
  }
51
47
  }
48
+
49
+ @Injectable()
50
+ export class Logger extends LoggerWrapper implements ILogServiceClient {
51
+ @Autowired(ILoggerManagerClient)
52
+ protected loggerManager: ILoggerManagerClient;
53
+
54
+ constructor() {
55
+ super();
56
+ this.logger = this.loggerManager.getBrowserLogger(SupportLogNamespace.Browser);
57
+ }
58
+
59
+ public reportToServer() {
60
+ this.logger.dispose();
61
+ this.logger = this.loggerManager.getLogger(SupportLogNamespace.Browser);
62
+ }
63
+ }