@opensumi/ide-editor 3.2.6-next-1725007925.0 → 3.2.6-next-1725270864.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 (47) hide show
  1. package/lib/browser/doc-model/types.d.ts +1 -4
  2. package/lib/browser/doc-model/types.d.ts.map +1 -1
  3. package/lib/browser/doc-model/types.js.map +1 -1
  4. package/lib/browser/editor-collection.service.d.ts +1 -3
  5. package/lib/browser/editor-collection.service.d.ts.map +1 -1
  6. package/lib/browser/editor-collection.service.js +10 -14
  7. package/lib/browser/editor-collection.service.js.map +1 -1
  8. package/lib/browser/grid/grid.service.d.ts.map +1 -1
  9. package/lib/browser/grid/grid.service.js +1 -0
  10. package/lib/browser/grid/grid.service.js.map +1 -1
  11. package/lib/browser/navigation.view.d.ts.map +1 -1
  12. package/lib/browser/navigation.view.js +7 -5
  13. package/lib/browser/navigation.view.js.map +1 -1
  14. package/lib/browser/preference/converter.d.ts +6 -6
  15. package/lib/browser/preference/converter.d.ts.map +1 -1
  16. package/lib/browser/preference/converter.js +49 -96
  17. package/lib/browser/preference/converter.js.map +1 -1
  18. package/lib/browser/tab.view.d.ts.map +1 -1
  19. package/lib/browser/tab.view.js +44 -47
  20. package/lib/browser/tab.view.js.map +1 -1
  21. package/lib/browser/types.d.ts +1 -0
  22. package/lib/browser/types.d.ts.map +1 -1
  23. package/lib/browser/types.js +3 -0
  24. package/lib/browser/types.js.map +1 -1
  25. package/lib/browser/workbench-editor.service.d.ts +1 -0
  26. package/lib/browser/workbench-editor.service.d.ts.map +1 -1
  27. package/lib/browser/workbench-editor.service.js +25 -13
  28. package/lib/browser/workbench-editor.service.js.map +1 -1
  29. package/lib/common/editor.d.ts +6 -7
  30. package/lib/common/editor.d.ts.map +1 -1
  31. package/lib/common/editor.js.map +1 -1
  32. package/lib/common/types.d.ts +5 -0
  33. package/lib/common/types.d.ts.map +1 -0
  34. package/lib/common/types.js +3 -0
  35. package/lib/common/types.js.map +1 -0
  36. package/package.json +14 -14
  37. package/src/browser/doc-model/types.ts +1 -5
  38. package/src/browser/editor-collection.service.ts +7 -14
  39. package/src/browser/grid/grid.service.ts +1 -0
  40. package/src/browser/navigation.view.tsx +8 -5
  41. package/src/browser/preference/converter.ts +62 -104
  42. package/src/browser/preference/schema.ts +1 -1
  43. package/src/browser/tab.view.tsx +44 -46
  44. package/src/browser/types.ts +5 -1
  45. package/src/browser/workbench-editor.service.ts +36 -15
  46. package/src/common/editor.ts +13 -11
  47. package/src/common/types.ts +5 -0
@@ -8,6 +8,7 @@ import { Icon, Scrollbars } from '@opensumi/ide-components';
8
8
  import {
9
9
  Disposable,
10
10
  DomListener,
11
+ fastdom,
11
12
  getIcon,
12
13
  useDesignStyles,
13
14
  useInjectable,
@@ -122,16 +123,18 @@ export const NavigationMenu = observer(({ model }: { model: NavigationMenuModel
122
123
  const viewService = useInjectable(NavigationBarViewService) as NavigationBarViewService;
123
124
 
124
125
  const scrollToCurrent = useCallback(() => {
125
- if (scrollerContainer.current) {
126
+ fastdom.measure(() => {
126
127
  try {
127
- const current = scrollerContainer.current.querySelector(`.${styles.navigation_menu_item_current}`);
128
- if (current) {
129
- current.scrollIntoView({ behavior: 'auto', block: 'center' });
128
+ if (scrollerContainer.current) {
129
+ const current = scrollerContainer.current.querySelector(`.${styles.navigation_menu_item_current}`);
130
+ if (current) {
131
+ current.scrollIntoView({ behavior: 'auto', block: 'center' });
132
+ }
130
133
  }
131
134
  } catch (e) {
132
135
  // noop
133
136
  }
134
- }
137
+ });
135
138
  }, [scrollerContainer.current]);
136
139
 
137
140
  return (
@@ -1,114 +1,10 @@
1
1
  import { Uri, objects } from '@opensumi/ide-core-browser';
2
- import * as monaco from '@opensumi/ide-monaco';
3
2
  import { IConfigurationService } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration';
4
3
 
5
4
  import { IConvertedMonacoOptions } from '../types';
6
5
 
7
6
  const { removeUndefined } = objects;
8
7
 
9
- /**
10
- * 计算由ConfigurationService设置值带来的monaco编辑器的属性
11
- * @param configurationService IConfigurationService
12
- * @param updatingKey 需要处理的Preference key。如果没有这个值,默认处理全部。
13
- */
14
- export function getConvertedMonacoOptions(
15
- configurationService: IConfigurationService,
16
- resourceUri?: string,
17
- language?: string,
18
- updatingKey?: string[],
19
- ): IConvertedMonacoOptions {
20
- const editorOptions: Partial<monaco.editor.IEditorOptions> = {};
21
- const diffOptions: Partial<monaco.editor.IDiffEditorOptions> = {};
22
- const modelOptions: Partial<monaco.editor.ITextModelUpdateOptions> = {};
23
- const editorOptionsKeys = [] as string[];
24
- const textModelUpdateOptionsKeys = [] as string[];
25
- const diffEditorOptionsKeys = [] as string[];
26
-
27
- if (updatingKey) {
28
- updatingKey.forEach((key) => {
29
- if (editorOptionsConverters.has(key)) {
30
- editorOptionsKeys.push(key);
31
- } else if (textModelUpdateOptionsConverters.has(key)) {
32
- textModelUpdateOptionsKeys.push(key);
33
- } else if (diffEditorOptionsConverters.has(key)) {
34
- diffEditorOptionsKeys.push(key);
35
- }
36
- });
37
- } else {
38
- editorOptionsKeys.push(...editorOptionsConverters.keys());
39
- textModelUpdateOptionsKeys.push(...textModelUpdateOptionsConverters.keys());
40
- diffEditorOptionsKeys.push(...diffEditorOptionsConverters.keys());
41
- }
42
-
43
- editorOptionsKeys.forEach((key) => {
44
- const value = configurationService.getValue(key, {
45
- resource: resourceUri ? Uri.parse(resourceUri) : undefined,
46
- overrideIdentifier: language,
47
- });
48
- if (value === undefined) {
49
- return;
50
- }
51
- if (!editorOptionsConverters.get(key)) {
52
- editorOptions[key] = value;
53
- } else {
54
- const converter: IMonacoOptionsConverter = editorOptionsConverters.get(key)! as IMonacoOptionsConverter;
55
- if (!editorOptions[converter.monaco]) {
56
- editorOptions[converter.monaco] = converter.convert ? converter.convert(value) : value;
57
- } else {
58
- editorOptions[converter.monaco] = {
59
- ...editorOptions[converter.monaco],
60
- ...(converter.convert ? converter.convert(value) : value),
61
- };
62
- }
63
- }
64
- });
65
-
66
- textModelUpdateOptionsKeys.forEach((key) => {
67
- const value = configurationService.getValue(key, {
68
- resource: resourceUri ? Uri.parse(resourceUri) : undefined,
69
- overrideIdentifier: language,
70
- });
71
- if (value === undefined) {
72
- return;
73
- }
74
- if (!textModelUpdateOptionsConverters.get(key)) {
75
- modelOptions[key] = value;
76
- } else {
77
- const converter: IMonacoOptionsConverter = textModelUpdateOptionsConverters.get(key)! as IMonacoOptionsConverter;
78
- modelOptions[converter.monaco] = converter.convert ? converter.convert(value) : value;
79
- }
80
- });
81
-
82
- diffEditorOptionsKeys.forEach((key) => {
83
- const value = configurationService.getValue(key, {
84
- resource: resourceUri ? Uri.parse(resourceUri) : undefined,
85
- overrideIdentifier: language,
86
- });
87
- if (value === undefined) {
88
- return;
89
- }
90
- if (!diffEditorOptionsConverters.get(key)) {
91
- editorOptions[key] = value;
92
- } else {
93
- const converter: IMonacoOptionsConverter = diffEditorOptionsConverters.get(key)! as IMonacoOptionsConverter;
94
- if (diffOptions[converter.monaco]) {
95
- diffOptions[converter.monaco] = {
96
- ...diffOptions[converter.monaco],
97
- ...(converter.convert ? converter.convert(value) : value),
98
- };
99
- } else {
100
- diffOptions[converter.monaco] = converter.convert ? converter.convert(value) : value;
101
- }
102
- }
103
- });
104
-
105
- return {
106
- editorOptions: removeUndefined(editorOptions),
107
- modelOptions: removeUndefined(modelOptions),
108
- diffOptions: removeUndefined(diffOptions),
109
- };
110
- }
111
-
112
8
  type NoConverter = false;
113
9
  type KaitianPreferenceKey = string;
114
10
  type MonacoPreferenceKey = string;
@@ -900,3 +796,65 @@ export function isEditorOption(key: string) {
900
796
  export function isDiffEditorOption(key: string): boolean {
901
797
  return isContainOptionKey(key, diffEditorOptionsConverters);
902
798
  }
799
+
800
+ const editorOptionsConvertersKey = [...editorOptionsConverters.keys()];
801
+ const textModelUpdateOptionsConvertersKey = [...textModelUpdateOptionsConverters.keys()];
802
+ const diffEditorOptionsConvertersKey = [...diffEditorOptionsConverters.keys()];
803
+
804
+ /**
805
+ * 计算由ConfigurationService设置值带来的monaco编辑器的属性
806
+ * @param configurationService IConfigurationService
807
+ * @param updatingKey 需要处理的Preference key。如果没有这个值,默认处理全部。
808
+ */
809
+ export function getConvertedMonacoOptions(
810
+ configurationService: IConfigurationService,
811
+ resourceUri?: string,
812
+ language?: string,
813
+ updatingKey?: string[],
814
+ ): IConvertedMonacoOptions {
815
+ const resource = resourceUri ? Uri.parse(resourceUri) : undefined;
816
+
817
+ const getOptions = (keys: string[], converters: Map<string, NoConverter | IMonacoOptionsConverter>): Partial<any> =>
818
+ keys.reduce((options, key) => {
819
+ const value = configurationService.getValue(key, { resource, overrideIdentifier: language });
820
+ if (value !== undefined) {
821
+ const converter = converters.get(key);
822
+ if (!converter) {
823
+ options[key] = value;
824
+ return options;
825
+ }
826
+
827
+ const targetKey = converter ? converter.monaco : key;
828
+ const convertedValue = converter?.convert ? converter.convert(value) : value;
829
+
830
+ if (!options[targetKey]) {
831
+ options[targetKey] = convertedValue;
832
+ } else {
833
+ Object.assign(options[targetKey], convertedValue);
834
+ }
835
+ }
836
+ return options;
837
+ }, {});
838
+
839
+ const editorOptionsKeys = updatingKey
840
+ ? updatingKey.filter((key) => editorOptionsConverters.has(key))
841
+ : [...editorOptionsConvertersKey];
842
+
843
+ const textModelUpdateOptionsKeys = updatingKey
844
+ ? updatingKey.filter((key) => textModelUpdateOptionsConverters.has(key))
845
+ : [...textModelUpdateOptionsConvertersKey];
846
+
847
+ const diffEditorOptionsKeys = updatingKey
848
+ ? updatingKey.filter((key) => diffEditorOptionsConverters.has(key))
849
+ : [...diffEditorOptionsConvertersKey];
850
+
851
+ const editorOptions = removeUndefined(getOptions(editorOptionsKeys, editorOptionsConverters));
852
+ const modelOptions = removeUndefined(getOptions(textModelUpdateOptionsKeys, textModelUpdateOptionsConverters));
853
+ const diffOptions = removeUndefined(getOptions(diffEditorOptionsKeys, diffEditorOptionsConverters));
854
+
855
+ return {
856
+ editorOptions,
857
+ modelOptions,
858
+ diffOptions,
859
+ };
860
+ }
@@ -112,7 +112,7 @@ export const EDITOR_DEFAULTS = {
112
112
  readOnly: false,
113
113
  mouseStyle: 'text',
114
114
  disableLayerHinting: false,
115
- automaticLayout: true, // Modified
115
+ automaticLayout: true,
116
116
  wordWrap: 'off',
117
117
  wordWrapColumn: 80,
118
118
  wordWrapMinified: true,
@@ -26,6 +26,7 @@ import {
26
26
  PreferenceService,
27
27
  ResizeEvent,
28
28
  URI,
29
+ fastdom,
29
30
  getExternalIcon,
30
31
  getIcon,
31
32
  getSlotLocation,
@@ -184,9 +185,9 @@ export const Tabs = ({ group }: ITabsProps) => {
184
185
  );
185
186
 
186
187
  const scrollToCurrent = useCallback(() => {
187
- if (tabContainer.current) {
188
- if (group.currentResource) {
189
- try {
188
+ fastdom.measure(() => {
189
+ try {
190
+ if (tabContainer.current && group.currentResource) {
190
191
  const currentTab = tabContainer.current.querySelector(
191
192
  '.' + styles.kt_editor_tab + "[data-uri='" + group.currentResource.uri.toString() + "']",
192
193
  );
@@ -196,24 +197,25 @@ export const Tabs = ({ group }: ITabsProps) => {
196
197
  inline: 'nearest',
197
198
  });
198
199
  }
199
- } catch (e) {
200
- // noop
201
200
  }
201
+ } catch (e) {
202
+ // noop
202
203
  }
203
- }
204
+ });
204
205
  }, [group, tabContainer.current]);
205
206
 
206
207
  const updateTabMarginRight = useCallback(() => {
207
208
  if (editorActionUpdateTimer.current) {
208
209
  clearTimeout(editorActionUpdateTimer.current);
209
- editorActionUpdateTimer.current = null;
210
210
  }
211
- const timer = setTimeout(() => {
212
- if (editorActionRef.current?.offsetWidth !== lastMarginRight) {
213
- setLastMarginRight(editorActionRef.current?.offsetWidth);
214
- }
211
+ editorActionUpdateTimer.current = setTimeout(() => {
212
+ fastdom.measure(() => {
213
+ const _marginReight = editorActionRef.current?.offsetWidth;
214
+ if (_marginReight !== lastMarginRight) {
215
+ setLastMarginRight(_marginReight);
216
+ }
217
+ });
215
218
  }, 200);
216
- editorActionUpdateTimer.current = timer;
217
219
  }, [editorActionRef.current, editorActionUpdateTimer.current, lastMarginRight]);
218
220
 
219
221
  useEffect(() => {
@@ -231,17 +233,13 @@ export const Tabs = ({ group }: ITabsProps) => {
231
233
  disposer.addDispose(new DomListener(tabContainer.current, 'mousewheel', preventNavigation));
232
234
  }
233
235
  disposer.addDispose(
234
- eventBus.on(ResizeEvent, (event) => {
235
- if (event.payload.slotLocation === slotLocation) {
236
- scrollToCurrent();
237
- }
236
+ eventBus.onDirective(ResizeEvent.createDirective(slotLocation), () => {
237
+ scrollToCurrent();
238
238
  }),
239
239
  );
240
240
  disposer.addDispose(
241
- eventBus.on(GridResizeEvent, (event) => {
242
- if (event.payload.gridId === group.grid.uid) {
243
- scrollToCurrent();
244
- }
241
+ eventBus.onDirective(GridResizeEvent.createDirective(group.grid.uid), () => {
242
+ scrollToCurrent();
245
243
  }),
246
244
  );
247
245
  return () => {
@@ -251,27 +249,29 @@ export const Tabs = ({ group }: ITabsProps) => {
251
249
  }, [wrapMode]);
252
250
 
253
251
  const layoutLastInRow = useCallback(() => {
254
- if (contentRef.current && wrapMode) {
255
- const newMap: Map<number, boolean> = new Map();
256
-
257
- let currentTabY: number | undefined;
258
- let lastTab: HTMLDivElement | undefined;
259
- const tabs = Array.from(contentRef.current.children);
260
- // 最后一个元素是editorAction
261
- tabs.pop();
262
- tabs.forEach((child: HTMLDivElement) => {
263
- if (child.offsetTop !== currentTabY) {
264
- currentTabY = child.offsetTop;
265
- if (lastTab) {
266
- newMap.set(tabs.indexOf(lastTab), true);
252
+ fastdom.measureAtNextFrame(() => {
253
+ if (contentRef.current && wrapMode) {
254
+ const newMap: Map<number, boolean> = new Map();
255
+
256
+ let currentTabY: number | undefined;
257
+ let lastTab: HTMLDivElement | undefined;
258
+ const tabs = Array.from(contentRef.current.children);
259
+ // 最后一个元素是editorAction
260
+ tabs.pop();
261
+ tabs.forEach((child: HTMLDivElement) => {
262
+ if (child.offsetTop !== currentTabY) {
263
+ currentTabY = child.offsetTop;
264
+ if (lastTab) {
265
+ newMap.set(tabs.indexOf(lastTab), true);
266
+ }
267
267
  }
268
- }
269
- lastTab = child;
270
- newMap.set(tabs.indexOf(child), false);
271
- });
272
- // 最后一个 tab 不做 grow 处理
273
- setTabMap(newMap);
274
- }
268
+ lastTab = child;
269
+ newMap.set(tabs.indexOf(child), false);
270
+ });
271
+ // 最后一个 tab 不做 grow 处理
272
+ setTabMap(newMap);
273
+ }
274
+ });
275
275
  }, [contentRef.current, wrapMode]);
276
276
 
277
277
  useEffect(() => {
@@ -282,10 +282,8 @@ export const Tabs = ({ group }: ITabsProps) => {
282
282
  useEffect(() => {
283
283
  const disposable = new DisposableCollection();
284
284
  disposable.push(
285
- eventBus.on(ResizeEvent, (e) => {
286
- if (e.payload.slotLocation === slotLocation) {
287
- layoutLastInRow();
288
- }
285
+ eventBus.onDirective(ResizeEvent.createDirective(slotLocation), () => {
286
+ layoutLastInRow();
289
287
  }),
290
288
  );
291
289
  disposable.push(
@@ -298,7 +296,7 @@ export const Tabs = ({ group }: ITabsProps) => {
298
296
  // 当前选中的group变化时宽度变化
299
297
  disposable.push(
300
298
  editorService.onDidCurrentEditorGroupChanged(() => {
301
- window.requestAnimationFrame(updateTabMarginRight);
299
+ updateTabMarginRight();
302
300
  }),
303
301
  );
304
302
  // editorMenu变化时宽度可能变化
@@ -308,7 +306,7 @@ export const Tabs = ({ group }: ITabsProps) => {
308
306
  () => {},
309
307
  200,
310
308
  )(() => {
311
- window.requestAnimationFrame(updateTabMarginRight);
309
+ updateTabMarginRight();
312
310
  }),
313
311
  );
314
312
 
@@ -192,7 +192,11 @@ export interface IGridResizeEventPayload {
192
192
  gridId: string;
193
193
  }
194
194
 
195
- export class GridResizeEvent extends BasicEvent<IGridResizeEventPayload> {}
195
+ export class GridResizeEvent extends BasicEvent<IGridResizeEventPayload> {
196
+ static createDirective(uid: string) {
197
+ return `grid-resize-${uid}`;
198
+ }
199
+ }
196
200
 
197
201
  export class EditorGroupOpenEvent extends BasicEvent<{ group: IEditorGroup; resource: IResource }> {}
198
202
  export class EditorGroupCloseEvent extends BasicEvent<{ group: IEditorGroup; resource: IResource }> {}
@@ -13,6 +13,7 @@ import {
13
13
  RecentFilesManager,
14
14
  ResizeEvent,
15
15
  ServiceNames,
16
+ fastdom,
16
17
  getSlotLocation,
17
18
  toMarkdown,
18
19
  } from '@opensumi/ide-core-browser';
@@ -794,11 +795,19 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
794
795
 
795
796
  constructor(public readonly name: string, public readonly groupId: number) {
796
797
  super();
797
- this.eventBus.on(ResizeEvent, (e: ResizeEvent) => {
798
- if (e.payload.slotLocation === getSlotLocation('@opensumi/ide-editor', this.config.layoutConfig)) {
799
- this.doLayoutEditors();
800
- }
801
- });
798
+ let toDispose: IDisposable | undefined;
799
+ this.eventBus.onDirective(
800
+ ResizeEvent.createDirective(getSlotLocation('@opensumi/ide-editor', this.config.layoutConfig)),
801
+ () => {
802
+ if (toDispose) {
803
+ toDispose.dispose();
804
+ }
805
+
806
+ toDispose = fastdom.mutate(() => {
807
+ this._layoutEditorWorker();
808
+ });
809
+ },
810
+ );
802
811
  this.eventBus.on(GridResizeEvent, (e: GridResizeEvent) => {
803
812
  if (e.payload.gridId === this.grid.uid) {
804
813
  this.doLayoutEditors();
@@ -849,19 +858,20 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
849
858
  }
850
859
 
851
860
  layoutEditors() {
852
- if (this._domNode) {
853
- const currentWidth = this._domNode.offsetWidth;
854
- const currentHeight = this._domNode.offsetHeight;
855
- if (currentWidth !== this._prevDomWidth || currentHeight !== this._prevDomHeight) {
856
- this.doLayoutEditors();
861
+ fastdom.measure(() => {
862
+ if (this._domNode) {
863
+ const currentWidth = this._domNode.offsetWidth;
864
+ const currentHeight = this._domNode.offsetHeight;
865
+ if (currentWidth !== this._prevDomWidth || currentHeight !== this._prevDomHeight) {
866
+ this.doLayoutEditors();
867
+ }
868
+ this._prevDomWidth = currentWidth;
869
+ this._prevDomHeight = currentHeight;
857
870
  }
858
- this._prevDomWidth = currentWidth;
859
- this._prevDomHeight = currentHeight;
860
- }
871
+ });
861
872
  }
862
873
 
863
- @debounce(100)
864
- doLayoutEditors() {
874
+ private _layoutEditorWorker() {
865
875
  if (this.codeEditor) {
866
876
  if (this.currentOpenType && this.currentOpenType.type === EditorOpenType.code) {
867
877
  this.codeEditor.layout();
@@ -888,6 +898,11 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
888
898
  }
889
899
  }
890
900
 
901
+ @debounce(16 * 5)
902
+ doLayoutEditors() {
903
+ this._layoutEditorWorker();
904
+ }
905
+
891
906
  setContextKeys() {
892
907
  if (!this._resourceContext) {
893
908
  const getLanguageFromModel = (uri: URI) => {
@@ -1124,9 +1139,15 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
1124
1139
  [ServiceNames.CONTEXT_KEY_SERVICE]: this.contextKeyService.contextKeyService,
1125
1140
  },
1126
1141
  );
1142
+
1127
1143
  setTimeout(() => {
1128
1144
  this.codeEditor.layout();
1129
1145
  });
1146
+ this.addDispose(
1147
+ this.codeEditor.onRefOpen(() => {
1148
+ this.codeEditor.layout();
1149
+ }),
1150
+ );
1130
1151
  this.toDispose.push(
1131
1152
  this.codeEditor.onCursorPositionChanged((e) => {
1132
1153
  this._onCurrentEditorCursorChange.fire(e);
@@ -15,17 +15,18 @@ import {
15
15
  MaybeNull,
16
16
  URI,
17
17
  } from '@opensumi/ide-core-common';
18
-
19
- // eslint-disable-next-line import/no-restricted-paths
20
- import { IDocModelUpdateOptions } from '../browser/doc-model/types';
18
+ import { IDimension } from '@opensumi/ide-monaco';
21
19
 
22
20
  import { IResource } from './resource';
21
+ import { IDocModelUpdateOptions } from './types';
23
22
 
24
- // eslint-disable-next-line import/no-restricted-paths
25
- import type { EOL, ICodeEditor as IMonacoCodeEditor } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
26
- // eslint-disable-next-line import/no-restricted-paths
27
- import type { IEditorOptions } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions';
28
- import type { ITextModel, ITextModelUpdateOptions } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model';
23
+ import type {
24
+ EOL,
25
+ IEditorOptions,
26
+ ICodeEditor as IMonacoCodeEditor,
27
+ ITextModel,
28
+ ITextModelUpdateOptions,
29
+ } from '@opensumi/ide-monaco';
29
30
 
30
31
  export { ShowLightbulbIconMode } from '@opensumi/ide-monaco';
31
32
 
@@ -175,7 +176,8 @@ export interface IEditorDocumentModel extends IDisposable {
175
176
  updateEncoding(encoding: string): Promise<void>;
176
177
 
177
178
  // setEncoding(encoding: string, preferredEncoding, mode: EncodingMode): Promise<void>;
178
- updateOptions(options: IDocModelUpdateOptions);
179
+
180
+ updateOptions(options: IDocModelUpdateOptions): void;
179
181
  }
180
182
 
181
183
  export type IEditorDocumentModelRef = IRef<IEditorDocumentModel>;
@@ -205,7 +207,7 @@ export enum EditorType {
205
207
  }
206
208
 
207
209
  /**
208
- * 一个IEditor代表了一个最小的编辑器单元,可以是 CodeEditor 中的一个,也可以是 DiffEditor 中的两个
210
+ * 一个 IEditor 代表了一个最小的编辑器单元,可以是 CodeEditor 中的一个,也可以是 DiffEditor 中的两个
209
211
  */
210
212
  export interface IEditor {
211
213
  /**
@@ -278,7 +280,7 @@ export interface IUndoStopOptions {
278
280
  }
279
281
 
280
282
  export interface ICodeEditor extends IEditor, IDisposable {
281
- layout(): void;
283
+ layout(dimension?: IDimension, postponeRendering?: boolean): void;
282
284
 
283
285
  /**
284
286
  * 打开一个 document
@@ -0,0 +1,5 @@
1
+ import * as monaco from '@opensumi/ide-monaco';
2
+
3
+ export interface IDocModelUpdateOptions extends monaco.editor.ITextModelUpdateOptions {
4
+ detectIndentation?: boolean;
5
+ }