@opensumi/ide-editor 3.2.5-next-1724744804.0 → 3.2.5

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 (112) hide show
  1. package/lib/browser/doc-model/editor-document-model-service.d.ts +1 -2
  2. package/lib/browser/doc-model/editor-document-model-service.d.ts.map +1 -1
  3. package/lib/browser/doc-model/editor-document-model-service.js +0 -22
  4. package/lib/browser/doc-model/editor-document-model-service.js.map +1 -1
  5. package/lib/browser/doc-model/editor-document-model.d.ts +0 -1
  6. package/lib/browser/doc-model/editor-document-model.d.ts.map +1 -1
  7. package/lib/browser/doc-model/editor-document-model.js +0 -14
  8. package/lib/browser/doc-model/editor-document-model.js.map +1 -1
  9. package/lib/browser/doc-model/saveParticipants.d.ts.map +1 -1
  10. package/lib/browser/doc-model/saveParticipants.js +0 -1
  11. package/lib/browser/doc-model/saveParticipants.js.map +1 -1
  12. package/lib/browser/doc-model/types.d.ts +1 -5
  13. package/lib/browser/doc-model/types.d.ts.map +1 -1
  14. package/lib/browser/doc-model/types.js +1 -4
  15. package/lib/browser/doc-model/types.js.map +1 -1
  16. package/lib/browser/editor.contribution.d.ts.map +1 -1
  17. package/lib/browser/editor.contribution.js +4 -7
  18. package/lib/browser/editor.contribution.js.map +1 -1
  19. package/lib/browser/editor.module.less +17 -9
  20. package/lib/browser/editor.view.d.ts.map +1 -1
  21. package/lib/browser/editor.view.js +12 -2
  22. package/lib/browser/editor.view.js.map +1 -1
  23. package/lib/browser/format/formatter-selector.d.ts.map +1 -1
  24. package/lib/browser/format/formatter-selector.js +8 -6
  25. package/lib/browser/format/formatter-selector.js.map +1 -1
  26. package/lib/browser/fs-resource/fs-resource.d.ts.map +1 -1
  27. package/lib/browser/fs-resource/fs-resource.js +7 -5
  28. package/lib/browser/fs-resource/fs-resource.js.map +1 -1
  29. package/lib/browser/grid/grid.service.d.ts +0 -1
  30. package/lib/browser/grid/grid.service.d.ts.map +1 -1
  31. package/lib/browser/grid/grid.service.js +4 -6
  32. package/lib/browser/grid/grid.service.js.map +1 -1
  33. package/lib/browser/hooks/useEditor.d.ts +2 -2
  34. package/lib/browser/hooks/useEditor.d.ts.map +1 -1
  35. package/lib/browser/hooks/useEditor.js +11 -10
  36. package/lib/browser/hooks/useEditor.js.map +1 -1
  37. package/lib/browser/index.d.ts.map +1 -1
  38. package/lib/browser/index.js +0 -5
  39. package/lib/browser/index.js.map +1 -1
  40. package/lib/browser/merge-conflict/merge-conflict.model.d.ts.map +1 -1
  41. package/lib/browser/merge-conflict/merge-conflict.model.js +4 -3
  42. package/lib/browser/merge-conflict/merge-conflict.model.js.map +1 -1
  43. package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.d.ts.map +1 -1
  44. package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.js +3 -3
  45. package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.js.map +1 -1
  46. package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.d.ts.map +1 -1
  47. package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.js +3 -3
  48. package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.js.map +1 -1
  49. package/lib/browser/navigation.module.less +2 -3
  50. package/lib/browser/navigation.view.js +1 -1
  51. package/lib/browser/navigation.view.js.map +1 -1
  52. package/lib/browser/tab.view.d.ts.map +1 -1
  53. package/lib/browser/tab.view.js +6 -21
  54. package/lib/browser/tab.view.js.map +1 -1
  55. package/lib/browser/untitled-resource.d.ts.map +1 -1
  56. package/lib/browser/untitled-resource.js +7 -5
  57. package/lib/browser/untitled-resource.js.map +1 -1
  58. package/lib/browser/workbench-editor.service.d.ts.map +1 -1
  59. package/lib/browser/workbench-editor.service.js +22 -15
  60. package/lib/browser/workbench-editor.service.js.map +1 -1
  61. package/lib/common/editor.d.ts +0 -47
  62. package/lib/common/editor.d.ts.map +1 -1
  63. package/lib/common/editor.js.map +1 -1
  64. package/lib/common/index.d.ts +2 -4
  65. package/lib/common/index.d.ts.map +1 -1
  66. package/lib/common/index.js +2 -4
  67. package/lib/common/index.js.map +1 -1
  68. package/package.json +14 -14
  69. package/src/browser/doc-model/editor-document-model-service.ts +1 -25
  70. package/src/browser/doc-model/editor-document-model.ts +0 -18
  71. package/src/browser/doc-model/saveParticipants.ts +0 -1
  72. package/src/browser/doc-model/types.ts +1 -4
  73. package/src/browser/editor.contribution.ts +3 -8
  74. package/src/browser/editor.module.less +17 -9
  75. package/src/browser/editor.view.tsx +21 -4
  76. package/src/browser/format/formatter-selector.ts +8 -6
  77. package/src/browser/fs-resource/fs-resource.ts +7 -5
  78. package/src/browser/grid/grid.service.ts +7 -13
  79. package/src/browser/hooks/useEditor.ts +12 -13
  80. package/src/browser/index.ts +0 -6
  81. package/src/browser/merge-conflict/merge-conflict.model.ts +5 -4
  82. package/src/browser/monaco-contrib/callHierarchy/callHierarchy.service.ts +2 -4
  83. package/src/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.ts +2 -5
  84. package/src/browser/navigation.module.less +2 -3
  85. package/src/browser/navigation.view.tsx +1 -1
  86. package/src/browser/tab.view.tsx +8 -40
  87. package/src/browser/untitled-resource.ts +7 -5
  88. package/src/browser/workbench-editor.service.ts +25 -20
  89. package/src/common/editor.ts +1 -59
  90. package/src/common/index.ts +2 -4
  91. package/lib/browser/editor-scrollbar/index.d.ts +0 -69
  92. package/lib/browser/editor-scrollbar/index.d.ts.map +0 -1
  93. package/lib/browser/editor-scrollbar/index.js +0 -289
  94. package/lib/browser/editor-scrollbar/index.js.map +0 -1
  95. package/lib/browser/editor-scrollbar/index.module.less +0 -106
  96. package/lib/browser/notebook.service.d.ts +0 -20
  97. package/lib/browser/notebook.service.d.ts.map +0 -1
  98. package/lib/browser/notebook.service.js +0 -24
  99. package/lib/browser/notebook.service.js.map +0 -1
  100. package/lib/common/components.d.ts +0 -3
  101. package/lib/common/components.d.ts.map +0 -1
  102. package/lib/common/components.js +0 -6
  103. package/lib/common/components.js.map +0 -1
  104. package/lib/common/notebook.d.ts +0 -169
  105. package/lib/common/notebook.d.ts.map +0 -1
  106. package/lib/common/notebook.js +0 -26
  107. package/lib/common/notebook.js.map +0 -1
  108. package/src/browser/editor-scrollbar/index.module.less +0 -106
  109. package/src/browser/editor-scrollbar/index.tsx +0 -399
  110. package/src/browser/notebook.service.ts +0 -19
  111. package/src/common/components.ts +0 -2
  112. package/src/common/notebook.ts +0 -196
@@ -4,12 +4,12 @@ import { useEffect, useMemo, useState } from 'react';
4
4
  import { formatLocalize, useInjectable } from '@opensumi/ide-core-browser';
5
5
  import { DisposableStore, URI } from '@opensumi/ide-utils';
6
6
 
7
- import { useEditorDocumentModel } from '../hooks/useEditor';
7
+ import { useEditorDocumentModelRef } from '../hooks/useEditor';
8
8
 
9
9
  import { MergeConflictService } from './merge-conflict.service';
10
10
 
11
11
  export function useMergeConflictModel(uri: URI) {
12
- const editorModel = useEditorDocumentModel(uri);
12
+ const editorModel = useEditorDocumentModelRef(uri);
13
13
 
14
14
  /**
15
15
  * 如果是原来就有冲突的文件,当冲突没了之后,仍然显示冲突
@@ -28,8 +28,9 @@ export function useMergeConflictModel(uri: URI) {
28
28
  const disposables = new DisposableStore();
29
29
 
30
30
  if (editorModel) {
31
+ const { instance } = editorModel;
31
32
  const run = () => {
32
- const n = mergeConflictService.scanDocument(editorModel.getMonacoModel());
33
+ const n = mergeConflictService.scanDocument(instance.getMonacoModel());
33
34
  setConflictsCount(n);
34
35
  if (n > 0) {
35
36
  setIsInitialVisiable(true);
@@ -39,7 +40,7 @@ export function useMergeConflictModel(uri: URI) {
39
40
  const debounceRun = debounce(run, 150);
40
41
 
41
42
  disposables.add(
42
- editorModel.getMonacoModel().onDidChangeContent(() => {
43
+ instance.getMonacoModel().onDidChangeContent(() => {
43
44
  debounceRun();
44
45
  }),
45
46
  );
@@ -112,10 +112,8 @@ export class CallHierarchyService implements ICallHierarchyService {
112
112
  }
113
113
 
114
114
  async prepareCallHierarchyProvider(resource: Uri, position: Position) {
115
- let textModelReference = this.modelService.getModelReference(URI.parse(resource.toString()));
116
- let textModel: ITextModel | undefined = textModelReference?.instance.getMonacoModel();
117
- textModelReference?.dispose();
118
-
115
+ let textModel = this.modelService.getModelReference(URI.parse(resource.toString()))?.instance.getMonacoModel();
116
+ let textModelReference: IDisposable | undefined;
119
117
  if (!textModel) {
120
118
  const result = await this.modelService.createModelReference(URI.parse(resource.toString()));
121
119
  textModel = result.instance.getMonacoModel();
@@ -104,11 +104,8 @@ export class TypeHierarchyService implements ITypeHierarchyService {
104
104
  }
105
105
 
106
106
  async prepareTypeHierarchyProvider(resource: Uri, position: Position) {
107
- let textModelReference = this.modelService.getModelReference(URI.parse(resource.toString()));
108
-
109
- let textModel: ITextModel | undefined = textModelReference?.instance.getMonacoModel();
110
- textModelReference?.dispose();
111
-
107
+ let textModel = this.modelService.getModelReference(URI.parse(resource.toString()))?.instance.getMonacoModel();
108
+ let textModelReference: IDisposable | undefined;
112
109
  if (!textModel) {
113
110
  const result = await this.modelService.createModelReference(URI.parse(resource.toString()));
114
111
  textModel = result.instance.getMonacoModel();
@@ -15,13 +15,12 @@
15
15
  }
16
16
 
17
17
  .navigation_icon {
18
- font-size: 12px !important;
18
+ font-size: 12px;
19
19
  color: var(--breadcrumb-foreground);
20
20
  }
21
-
22
21
  .navigation-part {
23
22
  color: var(--breadcrumb-foreground);
24
- font-size: 12px !important;
23
+ font-size: 12px;
25
24
  padding: 0 4px;
26
25
  position: relative;
27
26
  line-height: 22px;
@@ -56,7 +56,7 @@ export const NavigationBar = ({ editorGroup }: { editorGroup: EditorGroup }) =>
56
56
  }
57
57
  return parts.length === 0 ? null : (
58
58
  <div
59
- className={cls('kt-navigation-container', styles_navigation_container)}
59
+ className={styles_navigation_container}
60
60
  onContextMenu={(event) => {
61
61
  event.preventDefault();
62
62
  }}
@@ -13,8 +13,8 @@ import React, {
13
13
  useState,
14
14
  } from 'react';
15
15
 
16
+ import { Scrollbars } from '@opensumi/ide-components';
16
17
  import {
17
- ComponentRegistry,
18
18
  ConfigContext,
19
19
  Disposable,
20
20
  DisposableCollection,
@@ -29,7 +29,6 @@ import {
29
29
  getExternalIcon,
30
30
  getIcon,
31
31
  getSlotLocation,
32
- renderView,
33
32
  useDesignStyles,
34
33
  } from '@opensumi/ide-core-browser';
35
34
  import { InlineMenuBar } from '@opensumi/ide-core-browser/lib/components/actions';
@@ -37,18 +36,9 @@ import { LayoutViewSizeConfig } from '@opensumi/ide-core-browser/lib/layout/cons
37
36
  import { VIEW_CONTAINERS } from '@opensumi/ide-core-browser/lib/layout/view-id';
38
37
  import { IMenuRegistry, MenuId } from '@opensumi/ide-core-browser/lib/menu/next';
39
38
  import { useInjectable, useUpdateOnEventBusEvent } from '@opensumi/ide-core-browser/lib/react-hooks';
40
- import { formatLocalize } from '@opensumi/ide-core-common';
41
39
 
42
- import {
43
- IEditorGroup,
44
- IResource,
45
- ResourceDidUpdateEvent,
46
- ResourceService,
47
- TabbarRightExtraContentId,
48
- WorkbenchEditorService,
49
- } from '../common';
50
-
51
- import { Scroll } from './editor-scrollbar';
40
+ import { IEditorGroup, IResource, ResourceDidUpdateEvent, ResourceService, WorkbenchEditorService } from '../common';
41
+
52
42
  import styles from './editor.module.less';
53
43
  import { TabTitleMenuService } from './menu/title-context.menu';
54
44
  import {
@@ -82,7 +72,6 @@ export const Tabs = ({ group }: ITabsProps) => {
82
72
  const menuRegistry = useInjectable<IMenuRegistry>(IMenuRegistry);
83
73
  const editorTabService = useInjectable<IEditorTabService>(IEditorTabService);
84
74
  const layoutViewSize = useInjectable<LayoutViewSizeConfig>(LayoutViewSizeConfig);
85
- const componentRegistry = useInjectable<ComponentRegistry>(ComponentRegistry);
86
75
 
87
76
  const styles_tab_right = useDesignStyles(styles.tab_right, 'tab_right');
88
77
  const styles_close_tab = useDesignStyles(styles.close_tab, 'close_tab');
@@ -116,13 +105,6 @@ export const Tabs = ({ group }: ITabsProps) => {
116
105
 
117
106
  const slotLocation = useMemo(() => getSlotLocation(pkgName, configContext.layoutConfig), []);
118
107
 
119
- const RightExtraContentViewConfig = React.useMemo(() => {
120
- const firstView = componentRegistry.getComponentRegistryInfo(TabbarRightExtraContentId)?.views?.[0];
121
- if (firstView) {
122
- return firstView;
123
- }
124
- }, []);
125
-
126
108
  useUpdateOnGroupTabChange(group);
127
109
  useUpdateOnEventBusEvent(
128
110
  ResourceDidUpdateEvent,
@@ -378,9 +360,7 @@ export const Tabs = ({ group }: ITabsProps) => {
378
360
  return editorTabService.renderEditorTab(
379
361
  <>
380
362
  <div className={tabsLoadingMap[resource.uri.toString()] ? 'loading_indicator' : cls(resource.icon)}> </div>
381
- <div tabIndex={0} role='tab' aria-selected={isCurrent ? 'true' : 'false'}>
382
- {resource.name}
383
- </div>
363
+ <div>{resource.name}</div>
384
364
  {subname ? <div className={styles.subname}>{subname}</div> : null}
385
365
  {decoration.readOnly ? (
386
366
  <span className={cls(getExternalIcon('lock'), styles.editor_readonly_icon)}></span>
@@ -400,12 +380,7 @@ export const Tabs = ({ group }: ITabsProps) => {
400
380
  }}
401
381
  >
402
382
  {editorTabService.renderTabCloseComponent(
403
- <div
404
- className={cls(getIcon('close'), styles_kt_editor_close_icon)}
405
- tabIndex={0}
406
- role='button'
407
- aria-label={formatLocalize('editor.closeTab.title', resource.name)}
408
- />,
383
+ <div className={cls(getIcon('close'), styles_kt_editor_close_icon)} />,
409
384
  )}
410
385
  </div>
411
386
  </div>
@@ -426,7 +401,6 @@ export const Tabs = ({ group }: ITabsProps) => {
426
401
  [styles_kt_editor_tabs_current_last]: curTabIndex === group.resources.length - 1,
427
402
  })}
428
403
  ref={contentRef as any}
429
- role='tablist'
430
404
  >
431
405
  {group.resources.map((resource, i) => {
432
406
  let ref: HTMLDivElement | null;
@@ -518,19 +492,18 @@ export const Tabs = ({ group }: ITabsProps) => {
518
492
  onDoubleClick={handleEmptyDBClick}
519
493
  >
520
494
  {!wrapMode ? (
521
- <Scroll
495
+ <Scrollbars
496
+ tabBarMode
522
497
  forwardedRef={(el) => (el ? (tabContainer.current = el) : null)}
523
498
  className={styles.kt_editor_tabs_scroll}
524
499
  >
525
500
  {renderTabContent()}
526
- </Scroll>
501
+ </Scrollbars>
527
502
  ) : (
528
503
  <div className={styles.kt_editor_wrap_container}>{renderTabContent()}</div>
529
504
  )}
530
505
  </div>
531
506
  {!wrapMode && <EditorActions ref={editorActionRef} group={group} />}
532
-
533
- {renderView(RightExtraContentViewConfig)}
534
507
  </div>
535
508
  );
536
509
  };
@@ -567,11 +540,6 @@ export const EditorActions = forwardRef<HTMLDivElement, IEditorActionsProps>(
567
540
  const [hasFocus, setHasFocus] = useState<boolean>(editorService.currentEditorGroup === group);
568
541
  const [args, setArgs] = useState<[URI, IEditorGroup, MaybeNull<URI>] | undefined>(acquireArgs());
569
542
 
570
- /**
571
- * 集成场景下可以不展示任何菜单,可以用以下代码取消菜单注册
572
- * registry.unregisterMenuId(MenuId.EditorTitle);
573
- * registry.unregisterMenuId(MenuId.EditorTitleRun);
574
- */
575
543
  const noActions = menu.getMergedMenuNodes().length === 0;
576
544
 
577
545
  useEffect(() => {
@@ -171,8 +171,8 @@ export class UntitledSchemeResourceProvider extends WithEventBus implements IRes
171
171
  }
172
172
 
173
173
  async shouldCloseResourceWithoutConfirm(resource: IResource) {
174
- const documentModelRef = this.documentModelService.getModelDescription(resource.uri, 'close-resource-check');
175
- if (documentModelRef && documentModelRef.dirty) {
174
+ const documentModelRef = this.documentModelService.getModelReference(resource.uri, 'close-resource-check');
175
+ if (documentModelRef && documentModelRef.instance.dirty) {
176
176
  return true;
177
177
  }
178
178
  return false;
@@ -195,14 +195,16 @@ export class UntitledSchemeResourceProvider extends WithEventBus implements IRes
195
195
  documentModelRef.dispose();
196
196
  return false;
197
197
  } else {
198
- documentModelRef.dispose();
199
198
  return true;
200
199
  }
201
200
  }
202
201
 
203
202
  async shouldCloseResource(resource: IResource) {
204
- const documentModelRef = this.documentModelService.getModelDescription(resource.uri, 'close-resource-check');
205
- if (!documentModelRef || !documentModelRef.dirty) {
203
+ const documentModelRef = this.documentModelService.getModelReference(resource.uri, 'close-resource-check');
204
+ if (!documentModelRef || !documentModelRef.instance.dirty) {
205
+ if (documentModelRef) {
206
+ documentModelRef.dispose();
207
+ }
206
208
  return true;
207
209
  }
208
210
  // 询问用户是否保存
@@ -44,7 +44,6 @@ import {
44
44
  debounce,
45
45
  formatLocalize,
46
46
  getDebugLogger,
47
- isDefined,
48
47
  isUndefinedOrNull,
49
48
  localize,
50
49
  makeRandomHexString,
@@ -436,9 +435,10 @@ export class WorkbenchEditorServiceImpl extends WithEventBus implements Workbenc
436
435
  // contextKeys
437
436
  const getLanguageFromModel = (uri: URI) => {
438
437
  let result: string | null = null;
439
- const modelRef = this.documentModelManager.getModelDescription(uri, 'resourceContextKey');
438
+ const modelRef = this.documentModelManager.getModelReference(uri, 'resourceContextKey');
440
439
  if (modelRef) {
441
- result = modelRef.languageId;
440
+ result = modelRef.instance.languageId;
441
+ modelRef.dispose();
442
442
  }
443
443
  return result;
444
444
  };
@@ -491,13 +491,10 @@ export class WorkbenchEditorServiceImpl extends WithEventBus implements Workbenc
491
491
  state = this.openedResourceState.get<IEditorGridState>('grid', state);
492
492
  }
493
493
  this.topGrid = new EditorGrid();
494
- this.addDispose(this.topGrid);
495
- this.addDispose(
496
- this.topGrid.onDidGridAndDesendantStateChange(() => {
497
- this._sortedEditorGroups = undefined;
498
- this._onDidEditorGroupsChanged.fire();
499
- }),
500
- );
494
+ this.topGrid.onDidGridAndDesendantStateChange(() => {
495
+ this._sortedEditorGroups = undefined;
496
+ this._onDidEditorGroupsChanged.fire();
497
+ });
501
498
  const editorRestorePromises = [];
502
499
  const promise = this.topGrid
503
500
  .deserialize(state, () => this.createEditorGroup(), editorRestorePromises)
@@ -717,10 +714,12 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
717
714
  /**
718
715
  * 当前打开的所有resource
719
716
  */
717
+ // @observable.shallow
720
718
  resources: IResource[] = [];
721
719
 
722
720
  resourceStatus: Map<IResource, Promise<void>> = new Map();
723
721
 
722
+ // @observable.ref
724
723
  _currentResource: IResource | null;
725
724
 
726
725
  _currentOpenType: IEditorOpenType | null;
@@ -892,9 +891,12 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
892
891
  if (!this._resourceContext) {
893
892
  const getLanguageFromModel = (uri: URI) => {
894
893
  let result: string | null = null;
895
- const modelRef = this.documentModelManager.getModelDescription(uri, 'resourceContextKey');
894
+ const modelRef = this.documentModelManager.getModelReference(uri, 'resourceContextKey');
896
895
  if (modelRef) {
897
- result = modelRef.languageId;
896
+ if (modelRef) {
897
+ result = modelRef.instance.languageId;
898
+ }
899
+ modelRef.dispose();
898
900
  }
899
901
  return result;
900
902
  };
@@ -1409,9 +1411,6 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
1409
1411
  if (options && options.label) {
1410
1412
  resource.name = options.label;
1411
1413
  }
1412
- if (options && isDefined(options.supportsRevive)) {
1413
- resource.supportsRevive = options.supportsRevive;
1414
- }
1415
1414
  let replaceResource: IResource | null = null;
1416
1415
  if (options && options.index !== undefined && options.index < this.resources.length) {
1417
1416
  replaceResource = this.resources[options.index];
@@ -2303,7 +2302,9 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
2303
2302
  // 否则使用 document 进行保存 (如果有)
2304
2303
  const docRef = this.documentModelManager.getModelReference(resource.uri);
2305
2304
  if (docRef) {
2306
- await docRef.instance.save(undefined, reason);
2305
+ if (docRef.instance.dirty) {
2306
+ await docRef.instance.save(undefined, reason);
2307
+ }
2307
2308
  docRef.dispose();
2308
2309
  }
2309
2310
  }
@@ -2336,9 +2337,11 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
2336
2337
 
2337
2338
  hasDirty(): boolean {
2338
2339
  for (const r of this.resources) {
2339
- const docRef = this.documentModelManager.getModelDescription(r.uri);
2340
+ const docRef = this.documentModelManager.getModelReference(r.uri);
2340
2341
  if (docRef) {
2341
- if (docRef.dirty) {
2342
+ const isDirty = docRef.instance.dirty;
2343
+ docRef.dispose();
2344
+ if (isDirty) {
2342
2345
  return true;
2343
2346
  }
2344
2347
  }
@@ -2352,13 +2355,15 @@ export class EditorGroup extends WithEventBus implements IGridEditorGroup {
2352
2355
  calcDirtyCount(countedUris: Set<string> = new Set<string>()): number {
2353
2356
  let count = 0;
2354
2357
  for (const r of this.resources) {
2355
- const docRef = this.documentModelManager.getModelDescription(r.uri, 'calc-dirty-count');
2358
+ const docRef = this.documentModelManager.getModelReference(r.uri, 'calc-dirty-count');
2356
2359
  if (countedUris.has(r.uri.toString())) {
2357
2360
  continue;
2358
2361
  }
2359
2362
  countedUris.add(r.uri.toString());
2360
2363
  if (docRef) {
2361
- if (docRef.dirty) {
2364
+ const isDirty = docRef.instance.dirty;
2365
+ docRef.dispose();
2366
+ if (isDirty) {
2362
2367
  count += 1;
2363
2368
  }
2364
2369
  }
@@ -29,66 +29,10 @@ import type { ITextModel, ITextModelUpdateOptions } from '@opensumi/monaco-edito
29
29
 
30
30
  export { ShowLightbulbIconMode } from '@opensumi/ide-monaco';
31
31
 
32
- export interface IEditorDocumentDescription {
33
- /**
34
- * 文档URI
35
- */
36
- readonly uri: URI;
37
-
38
- /**
39
- * A unique identifier associated with this model.
40
- */
41
- readonly id: string;
42
-
43
- /**
44
- * 编码
45
- */
46
- readonly encoding: string;
47
-
48
- /**
49
- * 行末结束
50
- */
51
- readonly eol: EOL;
52
-
53
- /**
54
- * 语言Id
55
- */
56
- readonly languageId: string;
57
-
58
- /**
59
- * 是否被修改过
60
- */
61
- readonly dirty: boolean;
62
-
63
- /**
64
- * 能否修改
65
- */
66
- readonly readonly: boolean;
67
-
68
- /**
69
- * 能否保存
70
- */
71
- readonly savable: boolean;
72
-
73
- /**
74
- * 是否永远都显示 dirty
75
- */
76
- readonly alwaysDirty: boolean;
77
-
78
- /**
79
- * 即便是 dirty 也要被 dispose
80
- */
81
- readonly disposeEvenDirty: boolean;
82
-
83
- /**
84
- * 是否关闭自动保存功能
85
- */
86
- readonly closeAutoSave: boolean;
87
- }
88
-
89
32
  /**
90
33
  * editorDocumentModel is a wrapped concept for monaco's textModel
91
34
  */
35
+
92
36
  export interface IEditorDocumentModel extends IDisposable {
93
37
  /**
94
38
  * 文档URI
@@ -692,8 +636,6 @@ export interface IResourceOpenOptions {
692
636
  * 当关闭时指定 force 参数,用来跳过 shouldClose 等逻辑
693
637
  */
694
638
  forceClose?: boolean;
695
-
696
- supportsRevive?: boolean;
697
639
  }
698
640
 
699
641
  export interface IResourceOpenResult {
@@ -1,8 +1,6 @@
1
- export * from './components';
2
1
  export * from './doc-cache';
3
2
  export * from './editor';
4
- export * from './language';
5
- export * from './language-status';
6
- export * from './notebook';
7
3
  export * from './resource';
4
+ export * from './language';
8
5
  export * from './utils';
6
+ export * from './language-status';
@@ -1,69 +0,0 @@
1
- import React, { MouseEvent, UIEvent } from 'react';
2
- export interface ScrollAreaProps {
3
- className?: string;
4
- onScroll?: (position: ScrollPosition) => any;
5
- atTopClassName?: string;
6
- style?: any;
7
- containerStyle?: any;
8
- delegate?: (delegate: IScrollDelegate) => void;
9
- forwardedRef: (ref: HTMLDivElement) => void;
10
- children: any;
11
- }
12
- export interface IScrollDelegate {
13
- scrollTo(position: ScrollPosition): void;
14
- }
15
- export interface ScrollPosition {
16
- top: number;
17
- left: number;
18
- }
19
- export interface ScrollSizes {
20
- scrollHeight: number;
21
- offsetHeight: number;
22
- offsetWidth: number;
23
- scrollWidth: number;
24
- }
25
- export declare class Scroll extends React.Component<ScrollAreaProps, any> {
26
- ref: HTMLDivElement;
27
- container: HTMLDivElement;
28
- private thumbV;
29
- private trackV;
30
- private thumbH;
31
- private trackH;
32
- private decorationL;
33
- private decorationR;
34
- private size;
35
- private position;
36
- private dragging;
37
- private draggingStart;
38
- private draggingStartPos;
39
- private requestFrame;
40
- private shouldHideThumb;
41
- private isAtTop;
42
- onScroll(e: UIEvent<HTMLDivElement>): void;
43
- scrollTo(position: ScrollPosition): void;
44
- onMouseDownHorizontal(e: MouseEvent<HTMLDivElement>): void;
45
- onMouseMoveHorizontal: (e: any) => void;
46
- onMouseUpHorizontal: (e: any) => void;
47
- onMouseDownOnTrack(e: MouseEvent<HTMLDivElement>): void;
48
- calculateXToLeft(x: any): number;
49
- onMouseDownVertical(e: MouseEvent<HTMLDivElement>): void;
50
- onMouseMoveVertical: (e: any) => void;
51
- onMouseUpVertical: (e: any) => void;
52
- onMouseDownOnTrackVertical(e: MouseEvent<HTMLDivElement>): void;
53
- onMousewheel: (e: WheelEvent) => void;
54
- calculateYToTop(y: any): number;
55
- componentDidUpdate(): void;
56
- componentDidMount(): void;
57
- onMouseEnter: () => void;
58
- componentWillUnmount(): void;
59
- handleWindowResize: () => void;
60
- sizeEqual(size1: ScrollSizes, size2: ScrollSizes): boolean;
61
- update: (callback?: any) => void;
62
- _update(): void;
63
- updateScrollBar(): void;
64
- hideThumb(): void;
65
- showThumb(): void;
66
- setCss(): void;
67
- render(): React.JSX.Element;
68
- }
69
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/editor-scrollbar/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAInD,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,GAAG,CAAC;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,cAAc,CAAC,EAAE,GAAG,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;IAE/C,YAAY,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IAE5C,QAAQ,EAAE,GAAG,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC;IACxD,GAAG,EAAE,cAAc,CAAC;IAEpB,SAAS,EAAE,cAAc,CAAC;IAEjC,OAAO,CAAC,MAAM,CAAkB;IAEhC,OAAO,CAAC,MAAM,CAAkB;IAEhC,OAAO,CAAC,MAAM,CAAkB;IAEhC,OAAO,CAAC,MAAM,CAAkB;IAEhC,OAAO,CAAC,WAAW,CAAiB;IACpC,OAAO,CAAC,WAAW,CAAiB;IAEpC,OAAO,CAAC,IAAI,CAAc;IAE1B,OAAO,CAAC,QAAQ,CAGd;IAEF,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,gBAAgB,CAAK;IAE7B,OAAO,CAAC,YAAY,CAAM;IAE1B,OAAO,CAAC,eAAe,CAAQ;IAE/B,OAAO,CAAC,OAAO,CAAQ;IAEvB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC;IAuCnC,QAAQ,CAAC,QAAQ,EAAE,cAAc;IAKjC,qBAAqB,CAAC,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC;IAWnD,qBAAqB,mBAMnB;IAEF,mBAAmB,mBAOjB;IAEF,kBAAkB,CAAC,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC;IAYhD,gBAAgB,CAAC,CAAC,KAAA;IAMlB,mBAAmB,CAAC,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC;IAWjD,mBAAmB,mBAMjB;IAEF,iBAAiB,mBAOf;IAEF,0BAA0B,CAAC,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC;IAYxD,YAAY,MAAO,UAAU,UAY3B;IAEF,eAAe,CAAC,CAAC,KAAA;IAMjB,kBAAkB;IASlB,iBAAiB;IAcjB,YAAY,aAEV;IAEF,oBAAoB;IAWpB,kBAAkB,aAEhB;IAEF,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO;IAW1D,MAAM,2BAUJ;IAEF,OAAO;IAcP,eAAe;IAoBf,SAAS;IAOT,SAAS;IAKT,MAAM;IAeN,MAAM;CAqDP"}