@opensumi/ide-core-browser 3.1.4 → 3.1.5-next-1719978700.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 (62) 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.d.ts +1 -0
  34. package/lib/components/layout/split-panel.d.ts.map +1 -1
  35. package/lib/components/layout/split-panel.js +2 -2
  36. package/lib/components/layout/split-panel.js.map +1 -1
  37. package/lib/components/layout/split-panel.service.d.ts +0 -1
  38. package/lib/components/layout/split-panel.service.d.ts.map +1 -1
  39. package/lib/components/layout/split-panel.service.js +17 -8
  40. package/lib/components/layout/split-panel.service.js.map +1 -1
  41. package/lib/contextkey/ai-native.d.ts +3 -0
  42. package/lib/contextkey/ai-native.d.ts.map +1 -1
  43. package/lib/contextkey/ai-native.js +4 -1
  44. package/lib/contextkey/ai-native.js.map +1 -1
  45. package/lib/logger/browser-logger.d.ts +10 -6
  46. package/lib/logger/browser-logger.d.ts.map +1 -1
  47. package/lib/logger/browser-logger.js +15 -5
  48. package/lib/logger/browser-logger.js.map +1 -1
  49. package/package.json +5 -5
  50. package/src/ai-native/command.ts +4 -0
  51. package/src/bootstrap/app.ts +2 -16
  52. package/src/bootstrap/connection.ts +6 -0
  53. package/src/bootstrap/inner-providers.ts +4 -0
  54. package/src/common/common.command.ts +7 -0
  55. package/src/components/actions/index.tsx +1 -35
  56. package/src/components/ai-native/ai-action/index.tsx +5 -5
  57. package/src/components/ai-native/enhanceIcon/index.tsx +15 -8
  58. package/src/components/ai-native/interactive-input/index.tsx +7 -0
  59. package/src/components/layout/split-panel.service.ts +16 -5
  60. package/src/components/layout/split-panel.tsx +4 -1
  61. package/src/contextkey/ai-native.ts +3 -0
  62. package/src/logger/browser-logger.ts +21 -9
@@ -1063,6 +1063,13 @@ export namespace QUICK_OPEN_COMMANDS {
1063
1063
  }
1064
1064
 
1065
1065
  export namespace SCM_COMMANDS {
1066
+ const category = 'SCM';
1067
+
1068
+ export const GetSCMResource = {
1069
+ id: 'scm.getResource',
1070
+ category,
1071
+ };
1072
+
1066
1073
  // git extension 1.71 版本之前存在下划线,这里为了做兼容处理: https://github.com/microsoft/vscode/blob/1.68.1/extensions/git/src/repository.ts#L613
1067
1074
  export const _GIT_OPEN_MERGE_EDITOR: Command = {
1068
1075
  id: '_git.openMergeEditor',
@@ -3,8 +3,7 @@ import React, { useMemo, useState } from 'react';
3
3
 
4
4
  import { Button, CheckBox, Icon } from '@opensumi/ide-components';
5
5
  import { ClickParam, Menu } from '@opensumi/ide-components/lib/menu';
6
- import { CommandRegistry, IDisposable, isBoolean, strings } from '@opensumi/ide-core-common';
7
- import { GitCommands } from '@opensumi/ide-core-common/lib/commands/git';
6
+ import { isBoolean, strings } from '@opensumi/ide-core-common';
8
7
 
9
8
  import {
10
9
  AbstractMenuService,
@@ -233,7 +232,6 @@ const InlineActionWidget: React.FC<
233
232
  > = React.memo(({ iconService, type = 'icon', data, context = [], className, afterClick, ...restProps }) => {
234
233
  const styles_iconAction = useDesignStyles(styles.iconAction, 'iconAction');
235
234
  const styles_btnAction = useDesignStyles(styles.btnAction, 'btnAction');
236
- const commandRegistry = useInjectable<CommandRegistry>(CommandRegistry);
237
235
 
238
236
  const [loading, setLoading] = useState(false);
239
237
  const handleClick = React.useCallback(
@@ -260,38 +258,6 @@ const InlineActionWidget: React.FC<
260
258
  [data, context],
261
259
  );
262
260
 
263
- React.useEffect(() => {
264
- let dispose: IDisposable | undefined;
265
- switch (data.id) {
266
- case GitCommands.Stage:
267
- {
268
- const firstArg = context[0];
269
- if (!firstArg) {
270
- break;
271
- }
272
- if (!firstArg.sourceUri) {
273
- break;
274
- }
275
- dispose = commandRegistry.registerHandler(`${data.id}-${firstArg.sourceUri.toString()}`, {
276
- execute: async () => {
277
- if (typeof data.execute === 'function') {
278
- await data.execute([...context]);
279
- }
280
- },
281
- });
282
- }
283
- break;
284
- default:
285
- break;
286
- }
287
-
288
- return () => {
289
- if (dispose) {
290
- dispose.dispose();
291
- }
292
- };
293
- }, [data.id]);
294
-
295
261
  const [title, label] = React.useMemo(() => {
296
262
  let title = data.tooltip || data.label;
297
263
  const label = data.label;
@@ -50,10 +50,10 @@ export interface AIActionItem {
50
50
  }
51
51
 
52
52
  export interface AIActionProps {
53
- operationList: AIActionItem[];
53
+ operationList?: AIActionItem[];
54
54
  moreOperation?: MenuNode[];
55
55
  showClose?: boolean;
56
- onClickItem: (id: string) => void;
56
+ onClickItem?: (id: string) => void;
57
57
  onClose?: () => void;
58
58
  loading?: boolean;
59
59
  customOperationRender?: React.ReactNode;
@@ -109,15 +109,15 @@ export const AIAction = (props: AIActionProps) => {
109
109
 
110
110
  const defaultOperationList = (
111
111
  <React.Fragment>
112
- {operationList.map(({ name, title, id }, i) =>
112
+ {operationList?.map(({ name, title, id }, i) =>
113
113
  title ? (
114
114
  <EnhancePopover id={id} title={title} key={`popover_${i}`}>
115
- <EnhanceIcon wrapperClassName={styles.operate_item} onClick={() => onClickItem(id)}>
115
+ <EnhanceIcon wrapperClassName={styles.operate_item} onClick={() => onClickItem?.(id)}>
116
116
  <span key={i}>{name}</span>
117
117
  </EnhanceIcon>
118
118
  </EnhancePopover>
119
119
  ) : (
120
- <EnhanceIcon wrapperClassName={styles.operate_item} onClick={() => onClickItem(id)} key={i}>
120
+ <EnhanceIcon wrapperClassName={styles.operate_item} onClick={() => onClickItem?.(id)} key={i}>
121
121
  <span>{name}</span>
122
122
  </EnhanceIcon>
123
123
  ),
@@ -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
  }
@@ -5,7 +5,7 @@ import { IEventBus } from '@opensumi/ide-core-common';
5
5
 
6
6
  import { ResizeEvent } from '../../layout';
7
7
  import { useInjectable } from '../../react-hooks';
8
- import { IResizeHandleDelegate, ResizeFlexMode } from '../resize/resize';
8
+ import { IResizeHandleDelegate, RESIZE_LOCK, ResizeFlexMode } from '../resize/resize';
9
9
 
10
10
  import { Layout } from './layout';
11
11
  import { SplitPanelManager } from './split-panel.service';
@@ -64,6 +64,7 @@ export interface SplitPanelProps extends SplitChildProps {
64
64
  className?: string;
65
65
  style?: React.CSSProperties;
66
66
  direction?: Layout.direction;
67
+ headerSize?: number;
67
68
  id: string;
68
69
  // setAbsoluteSize 时保证相邻节点总宽度不变
69
70
  resizeKeep?: boolean;
@@ -95,6 +96,7 @@ export const SplitPanel: React.FC<SplitPanelProps> = (props) => {
95
96
  const {
96
97
  id,
97
98
  className,
99
+ headerSize,
98
100
  resizeHandleClassName,
99
101
  style,
100
102
  children = [],
@@ -298,6 +300,7 @@ export const SplitPanel: React.FC<SplitPanelProps> = (props) => {
298
300
  splitPanelService.panels.push(ele);
299
301
  }
300
302
  }}
303
+ className={getElementSize(element, totalFlexNum) === `${headerSize}px` ? RESIZE_LOCK : ''}
301
304
  id={getProp(element, 'id') /* @deprecated: query by data-view-id */}
302
305
  style={{
303
306
  // 手风琴场景,固定尺寸和 flex 尺寸混合布局;需要在 Resize Flex 模式下禁用
@@ -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
+ }