@opensumi/ide-opened-editor 2.12.1-next-079c1930

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 (43) hide show
  1. package/lib/browser/index.d.ts +6 -0
  2. package/lib/browser/index.d.ts.map +1 -0
  3. package/lib/browser/index.js +35 -0
  4. package/lib/browser/index.js.map +1 -0
  5. package/lib/browser/index.module.less +24 -0
  6. package/lib/browser/opened-editor-node.d.ts +21 -0
  7. package/lib/browser/opened-editor-node.d.ts.map +1 -0
  8. package/lib/browser/opened-editor-node.define.d.ts +30 -0
  9. package/lib/browser/opened-editor-node.define.d.ts.map +1 -0
  10. package/lib/browser/opened-editor-node.define.js +71 -0
  11. package/lib/browser/opened-editor-node.define.js.map +1 -0
  12. package/lib/browser/opened-editor-node.js +128 -0
  13. package/lib/browser/opened-editor-node.js.map +1 -0
  14. package/lib/browser/opened-editor-node.module.less +218 -0
  15. package/lib/browser/opened-editor.contribution.d.ts +16 -0
  16. package/lib/browser/opened-editor.contribution.d.ts.map +1 -0
  17. package/lib/browser/opened-editor.contribution.js +168 -0
  18. package/lib/browser/opened-editor.contribution.js.map +1 -0
  19. package/lib/browser/opened-editor.d.ts +6 -0
  20. package/lib/browser/opened-editor.d.ts.map +1 -0
  21. package/lib/browser/opened-editor.js +86 -0
  22. package/lib/browser/opened-editor.js.map +1 -0
  23. package/lib/browser/services/opened-editor-decoration.service.d.ts +13 -0
  24. package/lib/browser/services/opened-editor-decoration.service.d.ts.map +1 -0
  25. package/lib/browser/services/opened-editor-decoration.service.js +59 -0
  26. package/lib/browser/services/opened-editor-decoration.service.js.map +1 -0
  27. package/lib/browser/services/opened-editor-event.service.d.ts +23 -0
  28. package/lib/browser/services/opened-editor-event.service.d.ts.map +1 -0
  29. package/lib/browser/services/opened-editor-event.service.js +71 -0
  30. package/lib/browser/services/opened-editor-event.service.js.map +1 -0
  31. package/lib/browser/services/opened-editor-model.d.ts +15 -0
  32. package/lib/browser/services/opened-editor-model.d.ts.map +1 -0
  33. package/lib/browser/services/opened-editor-model.js +51 -0
  34. package/lib/browser/services/opened-editor-model.js.map +1 -0
  35. package/lib/browser/services/opened-editor-model.service.d.ts +81 -0
  36. package/lib/browser/services/opened-editor-model.service.d.ts.map +1 -0
  37. package/lib/browser/services/opened-editor-model.service.js +464 -0
  38. package/lib/browser/services/opened-editor-model.service.js.map +1 -0
  39. package/lib/browser/services/opened-editor-tree.service.d.ts +28 -0
  40. package/lib/browser/services/opened-editor-tree.service.d.ts.map +1 -0
  41. package/lib/browser/services/opened-editor-tree.service.js +176 -0
  42. package/lib/browser/services/opened-editor-tree.service.js.map +1 -0
  43. package/package.json +34 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opened-editor-model.service.d.ts","sourceRoot":"","sources":["../../../src/browser/services/opened-editor-model.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAc,kBAAkB,EAAE,YAAY,EAAwB,MAAM,0BAA0B,CAAC;AAClI,OAAO,EAAE,GAAG,EAAiC,kBAAkB,EAAmB,cAAc,EAAoB,QAAQ,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExK,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAInF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAA0B,YAAY,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAInG,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,cAAc,EAAE,MAAM,OAAO,CAAC;CAC/B;AAED,qBACa,wBAAwB;IACnC,OAAO,CAAC,MAAM,CAAC,8BAA8B,CAAO;IACpD,OAAO,CAAC,M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AsB,yBAEzB;IAED,IAAI,4BAA4B,uBAK/B;IAED,IAAI,gBAAgB,sBAEnB;IAED,IAAI,WAAW,uBAEd;IAED,IAAI,SAAS,sBAEZ;IAED,IAAI,SAAS,kBAEZ;IAGD,IAAI,WAAW,6CAEd;IAGD,IAAI,eAAe,6CAElB;IAGD,IAAI,aAAa,qCAEhB;IAED,IAAI,cAAc,IAAI,KAAK,CAAC,IAAI,CAAC,CAEhC;IACK,aAAa;IA6GnB,eAAe,CAAC,IAAI,KAAA;IASpB,oBAAoB,WAAY,eAAe,GAAG,UAAU,mBAAkB,OAAO,UAwBpF;IAGD,oBAAoB,WAAY,eAAe,GAAG,UAAU,mBAAkB,OAAO,UAsBpF;IAGD,2BAA2B,WAAY,eAAe,GAAG,UAAU,UAWlE;IAGD,sBAAsB,aASrB;IAED,oBAAoB;IASpB,iBAAiB,OAAQ,gBAAgB,2DAwBxC;IAED,iBAAiB,CAAC,MAAM,EAAE,iBAAiB;IAI3C,cAAc,aAGb;IAED,eAAe,SAAU,eAAe,GAAG,UAAU,QAAQ,YAAY,UAOxE;IAED;;OAEG;IACG,OAAO,CAAC,IAAI,GAAE,eAAwD;IAY5E,OAAO,CAAC,gBAAgB;IAgBjB,eAAe,iCA4BrB;IAEM,QAAQ,aAAoB,SAAS,GAAG,GAAG,qDAgBjD;IAEM,QAAQ,SAAU,UAAU,UAQlC;IAEM,SAAS,SAAU,UAAU,UAEnC;IAEM,eAAe,SAAU,eAAe,UAK9C;IAEM,cAAc,SAAU,eAAe,UAK7C;IAED,OAAO,CAAC,sBAAsB;CAW/B"}
@@ -0,0 +1,464 @@
1
+ "use strict";
2
+ var OpenedEditorModelService_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.OpenedEditorModelService = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const di_1 = require("@opensumi/di");
7
+ const ide_components_1 = require("@opensumi/ide-components");
8
+ const ide_core_browser_1 = require("@opensumi/ide-core-browser");
9
+ const next_1 = require("@opensumi/ide-core-browser/lib/menu/next");
10
+ const services_1 = require("@opensumi/ide-core-browser/lib/services");
11
+ const opened_editor_tree_service_1 = require("./opened-editor-tree.service");
12
+ const opened_editor_model_1 = require("./opened-editor-model");
13
+ const opened_editor_node_define_1 = require("../opened-editor-node.define");
14
+ const opened_editor_decoration_service_1 = require("./opened-editor-decoration.service");
15
+ const pSeries = require("p-series");
16
+ const opened_editor_node_module_less_1 = (0, tslib_1.__importDefault)(require("../opened-editor-node.module.less"));
17
+ const path_1 = require("@opensumi/ide-core-common/lib/path");
18
+ const opened_editor_event_service_1 = require("./opened-editor-event.service");
19
+ const browser_1 = require("@opensumi/ide-editor/lib/browser");
20
+ const ide_main_layout_1 = require("@opensumi/ide-main-layout");
21
+ const explorer_contribution_1 = require("@opensumi/ide-explorer/lib/browser/explorer-contribution");
22
+ let OpenedEditorModelService = OpenedEditorModelService_1 = class OpenedEditorModelService {
23
+ constructor() {
24
+ this._changeEventDispatchQueue = [];
25
+ // 装饰器
26
+ this.selectedDecoration = new ide_components_1.Decoration(opened_editor_node_module_less_1.default.mod_selected); // 选中态
27
+ this.focusedDecoration = new ide_components_1.Decoration(opened_editor_node_module_less_1.default.mod_focused); // 焦点态
28
+ this.contextMenuDecoration = new ide_components_1.Decoration(opened_editor_node_module_less_1.default.mod_actived); // 焦点态
29
+ this.dirtyDecoration = new ide_components_1.Decoration(opened_editor_node_module_less_1.default.mod_dirty); // 修改态
30
+ // 选中态的节点
31
+ this._selectedFiles = [];
32
+ this.disposableCollection = new ide_core_browser_1.DisposableCollection();
33
+ this.onDidRefreshedEmitter = new ide_core_browser_1.Emitter();
34
+ this.locationDelayer = new ide_core_browser_1.ThrottledDelayer(OpenedEditorModelService_1.DEFAULT_LOCATION_FLUSH_DELAY);
35
+ this._currentDirtyNodes = [];
36
+ // 清空其他选中/焦点态节点,更新当前焦点节点
37
+ this.activeFileDecoration = (target, dispatchChange = true) => {
38
+ if (this.contextMenuFile) {
39
+ this.contextMenuDecoration.removeTarget(this.contextMenuFile);
40
+ this._contextMenuFile = undefined;
41
+ }
42
+ if (target) {
43
+ if (this.selectedFiles.length > 0) {
44
+ this.selectedFiles.forEach((file) => {
45
+ this.selectedDecoration.removeTarget(file);
46
+ });
47
+ }
48
+ if (this.focusedFile) {
49
+ this.focusedDecoration.removeTarget(this.focusedFile);
50
+ }
51
+ this.selectedDecoration.addTarget(target);
52
+ this.focusedDecoration.addTarget(target);
53
+ this._focusedFile = target;
54
+ this._selectedFiles = [target];
55
+ // 通知视图更新
56
+ if (dispatchChange) {
57
+ this.treeModel.dispatchChange();
58
+ }
59
+ }
60
+ };
61
+ // 清空其他选中/焦点态节点,更新当前选中节点
62
+ this.selectFileDecoration = (target, dispatchChange = true) => {
63
+ if (this.contextMenuFile) {
64
+ this.contextMenuDecoration.removeTarget(this.contextMenuFile);
65
+ this._contextMenuFile = undefined;
66
+ }
67
+ if (target) {
68
+ if (this.selectedFiles.length > 0) {
69
+ this.selectedFiles.forEach((file) => {
70
+ this.selectedDecoration.removeTarget(file);
71
+ });
72
+ }
73
+ if (this.focusedFile) {
74
+ this.focusedDecoration.removeTarget(this.focusedFile);
75
+ }
76
+ this.selectedDecoration.addTarget(target);
77
+ this._selectedFiles = [target];
78
+ // 通知视图更新
79
+ if (dispatchChange) {
80
+ this.treeModel.dispatchChange();
81
+ }
82
+ }
83
+ };
84
+ // 右键菜单焦点态切换
85
+ this.activeFileActivedDecoration = (target) => {
86
+ if (this.contextMenuFile) {
87
+ this.contextMenuDecoration.removeTarget(this.contextMenuFile);
88
+ }
89
+ if (this.focusedFile) {
90
+ this.focusedDecoration.removeTarget(this.focusedFile);
91
+ this._focusedFile = undefined;
92
+ }
93
+ this.contextMenuDecoration.addTarget(target);
94
+ this._contextMenuFile = target;
95
+ this.treeModel.dispatchChange();
96
+ };
97
+ // 取消选中节点焦点
98
+ this.enactiveFileDecoration = () => {
99
+ if (this.focusedFile) {
100
+ this.focusedDecoration.removeTarget(this.focusedFile);
101
+ this._focusedFile = undefined;
102
+ }
103
+ if (this.contextMenuFile) {
104
+ this.contextMenuDecoration.removeTarget(this.contextMenuFile);
105
+ }
106
+ this.treeModel.dispatchChange();
107
+ };
108
+ this.handleContextMenu = (ev, file) => {
109
+ if (!file) {
110
+ this.enactiveFileDecoration();
111
+ return;
112
+ }
113
+ ev.stopPropagation();
114
+ ev.preventDefault();
115
+ const { x, y } = ev.nativeEvent;
116
+ this.activeFileActivedDecoration(file);
117
+ const menus = this.contextMenuService.createMenu({
118
+ id: next_1.MenuId.OpenEditorsContext,
119
+ contextKeyService: this.contextMenuContextKeyService,
120
+ });
121
+ const menuNodes = menus.getMergedMenuNodes();
122
+ menus.dispose();
123
+ this.ctxMenuRenderer.show({
124
+ anchor: { x, y },
125
+ menuNodes,
126
+ args: [file],
127
+ });
128
+ };
129
+ this.handleTreeBlur = () => {
130
+ // 清空焦点状态
131
+ this.enactiveFileDecoration();
132
+ };
133
+ this.handleItemClick = (item, type) => {
134
+ // 单选操作默认先更新选中状态
135
+ this.activeFileDecoration(item);
136
+ if (type === ide_components_1.TreeNodeType.TreeNode) {
137
+ this.openFile(item);
138
+ }
139
+ };
140
+ this.flushEventQueue = () => {
141
+ let promise;
142
+ if (!this._changeEventDispatchQueue || this._changeEventDispatchQueue.length === 0) {
143
+ return;
144
+ }
145
+ this._changeEventDispatchQueue.sort((pathA, pathB) => {
146
+ const pathADepth = path_1.Path.pathDepth(pathA);
147
+ const pathBDepth = path_1.Path.pathDepth(pathB);
148
+ return pathADepth - pathBDepth;
149
+ });
150
+ const roots = [this._changeEventDispatchQueue[0]];
151
+ for (const path of this._changeEventDispatchQueue) {
152
+ if (roots.some((root) => path.indexOf(root) === 0)) {
153
+ continue;
154
+ }
155
+ else {
156
+ roots.push(path);
157
+ }
158
+ }
159
+ promise = pSeries(roots.map((path) => async () => {
160
+ var _a;
161
+ const watcher = (_a = this.treeModel.root) === null || _a === void 0 ? void 0 : _a.watchEvents.get(path);
162
+ if (watcher && typeof watcher.callback === 'function') {
163
+ await watcher.callback({ type: ide_components_1.WatchEvent.Changed, path });
164
+ }
165
+ return null;
166
+ }));
167
+ // 重置更新队列
168
+ this._changeEventDispatchQueue = [];
169
+ return promise;
170
+ };
171
+ this.location = async (resource, group) => {
172
+ this.locationDelayer.trigger(async () => {
173
+ await this.flushEventQueuePromise;
174
+ let node = this.openedEditorService.getEditorNodeByUri(resource, group);
175
+ if (!node) {
176
+ return;
177
+ }
178
+ node = await this.editorTreeHandle.ensureVisible(node);
179
+ if (node) {
180
+ if (this.focusedFile === node) {
181
+ this.activeFileDecoration(node);
182
+ }
183
+ else {
184
+ this.selectFileDecoration(node);
185
+ }
186
+ }
187
+ });
188
+ };
189
+ this.openFile = (node) => {
190
+ // 手动打开文件时,屏蔽刷新及激活实际,防闪烁
191
+ this.ignoreRefreshAndActiveTimes = 1;
192
+ let groupIndex = 0;
193
+ if (node.parent && opened_editor_node_define_1.EditorFileGroup.is(node.parent)) {
194
+ groupIndex = node.parent.group.index;
195
+ }
196
+ this.commandService.executeCommand(ide_core_browser_1.EDITOR_COMMANDS.OPEN_RESOURCE.id, node.uri, { groupIndex, preserveFocus: true });
197
+ };
198
+ this.closeFile = (node) => {
199
+ this.commandService.executeCommand(ide_core_browser_1.EDITOR_COMMANDS.CLOSE.id, node.uri);
200
+ };
201
+ this.closeAllByGroup = (node) => {
202
+ const group = node.group;
203
+ if (group) {
204
+ group.closeAll();
205
+ }
206
+ };
207
+ this.saveAllByGroup = (node) => {
208
+ const group = node.group;
209
+ if (group) {
210
+ group.saveAll();
211
+ }
212
+ };
213
+ this._whenReady = this.initTreeModel();
214
+ }
215
+ get flushEventQueuePromise() {
216
+ return this.flushEventQueueDeferred && this.flushEventQueueDeferred.promise;
217
+ }
218
+ get contextMenuContextKeyService() {
219
+ if (!this._contextMenuContextKeyService) {
220
+ this._contextMenuContextKeyService = this.contextKeyService.createScoped();
221
+ }
222
+ return this._contextMenuContextKeyService;
223
+ }
224
+ get editorTreeHandle() {
225
+ return this._openedEditorTreeHandle;
226
+ }
227
+ get decorations() {
228
+ return this._decorations;
229
+ }
230
+ get treeModel() {
231
+ return this._treeModel;
232
+ }
233
+ get whenReady() {
234
+ return this._whenReady;
235
+ }
236
+ // 既是选中态,也是焦点态节点
237
+ get focusedFile() {
238
+ return this._focusedFile;
239
+ }
240
+ // 右键菜单选中的节点
241
+ get contextMenuFile() {
242
+ return this._contextMenuFile;
243
+ }
244
+ // 是选中态,非焦点态节点
245
+ get selectedFiles() {
246
+ return this._selectedFiles;
247
+ }
248
+ get onDidRefreshed() {
249
+ return this.onDidRefreshedEmitter.event;
250
+ }
251
+ async initTreeModel() {
252
+ // 根据是否为多工作区创建不同根节点
253
+ const root = (await this.openedEditorService.resolveChildren())[0];
254
+ if (!root) {
255
+ return;
256
+ }
257
+ this._treeModel = this.injector.get(opened_editor_model_1.OpenedEditorModel, [root]);
258
+ this.initDecorations(root);
259
+ this.disposableCollection.push(this.openedEditorService.onDirtyNodesChange((nodes) => {
260
+ for (const node of nodes) {
261
+ if (!this.dirtyDecoration.hasTarget(node)) {
262
+ this.dirtyDecoration.addTarget(node);
263
+ }
264
+ }
265
+ this._currentDirtyNodes = this._currentDirtyNodes.concat(nodes);
266
+ this.setExplorerTabBarBadge();
267
+ this.treeModel.dispatchChange();
268
+ }));
269
+ this.disposableCollection.push(this.labelService.onDidChange(() => {
270
+ this._currentDirtyNodes = [];
271
+ // 当labelService注册的对应节点图标变化时,通知视图更新
272
+ this.refresh();
273
+ }));
274
+ this.disposableCollection.push(this.editorService.onActiveResourceChange(() => {
275
+ if (this.ignoreRefreshAndActiveTimes > 0 && this.ignoreRefreshAndActiveTimes--) {
276
+ return;
277
+ }
278
+ this._currentDirtyNodes = [];
279
+ this.refresh();
280
+ }));
281
+ this.disposableCollection.push(this.editorService.onDidEditorGroupsChanged(() => {
282
+ this._currentDirtyNodes = [];
283
+ this.refresh();
284
+ }));
285
+ this.disposableCollection.push(this.editorService.onDidCurrentEditorGroupChanged(() => {
286
+ this._currentDirtyNodes = [];
287
+ this.refresh();
288
+ }));
289
+ this.disposableCollection.push(this.openedEditorEventService.onDidDecorationChange((payload) => {
290
+ let shouldUpdate = false;
291
+ if (!payload) {
292
+ return;
293
+ }
294
+ for (let index = 0; index < this.treeModel.root.branchSize; index++) {
295
+ const node = this.treeModel.root.getTreeNodeAtIndex(index);
296
+ if (!!node && !opened_editor_node_define_1.EditorFileGroup.is(node)) {
297
+ if (node.uri.isEqual(payload.uri)) {
298
+ if (payload.decoration.dirty) {
299
+ this.dirtyDecoration.addTarget(node);
300
+ }
301
+ else {
302
+ this.dirtyDecoration.removeTarget(node);
303
+ }
304
+ shouldUpdate = true;
305
+ }
306
+ }
307
+ }
308
+ if (shouldUpdate) {
309
+ this.setExplorerTabBarBadge();
310
+ this.treeModel.dispatchChange();
311
+ }
312
+ }));
313
+ this.disposableCollection.push(this.treeModel.onWillUpdate(() => {
314
+ var _a, _b, _c;
315
+ // 更新树前更新下选中节点
316
+ if (!!this.contextMenuFile) {
317
+ const node = (_a = this.treeModel) === null || _a === void 0 ? void 0 : _a.root.getTreeNodeByPath(this.contextMenuFile.path);
318
+ if (node) {
319
+ this.activeFileDecoration(node, false);
320
+ }
321
+ }
322
+ else if (!!this.focusedFile) {
323
+ const node = (_b = this.treeModel) === null || _b === void 0 ? void 0 : _b.root.getTreeNodeByPath(this.focusedFile.path);
324
+ if (node) {
325
+ this.activeFileDecoration(node, false);
326
+ }
327
+ }
328
+ else if (this.selectedFiles.length !== 0) {
329
+ // 仅处理一下单选情况
330
+ const node = (_c = this.treeModel) === null || _c === void 0 ? void 0 : _c.root.getTreeNodeByPath(this.selectedFiles[0].path);
331
+ if (node) {
332
+ this.selectFileDecoration(node, false);
333
+ }
334
+ }
335
+ }));
336
+ this.disposableCollection.push(this.openedEditorEventService.onDidChange(() => {
337
+ this.refresh();
338
+ }));
339
+ this.disposableCollection.push(this.onDidRefreshed(() => {
340
+ this.dirtyDecoration.appliedTargets.clear();
341
+ // 更新dirty节点,节点可能已更新
342
+ for (const target of this._currentDirtyNodes) {
343
+ this.dirtyDecoration.addTarget(target);
344
+ }
345
+ const currentResource = this.editorService.currentResource;
346
+ const currentGroup = this.editorService.currentEditorGroup;
347
+ if (currentResource) {
348
+ this.location(currentResource, currentGroup);
349
+ }
350
+ this.setExplorerTabBarBadge();
351
+ }));
352
+ }
353
+ initDecorations(root) {
354
+ this._decorations = new ide_components_1.DecorationsManager(root);
355
+ this._decorations.addDecoration(this.selectedDecoration);
356
+ this._decorations.addDecoration(this.focusedDecoration);
357
+ this._decorations.addDecoration(this.contextMenuDecoration);
358
+ this._decorations.addDecoration(this.dirtyDecoration);
359
+ }
360
+ removeFileDecoration() {
361
+ if (!this.decorations) {
362
+ return;
363
+ }
364
+ this.decorations.removeDecoration(this.selectedDecoration);
365
+ this.decorations.removeDecoration(this.focusedDecoration);
366
+ this.decorations.removeDecoration(this.contextMenuDecoration);
367
+ }
368
+ handleTreeHandler(handle) {
369
+ this._openedEditorTreeHandle = handle;
370
+ }
371
+ /**
372
+ * 刷新指定下的所有子节点
373
+ */
374
+ async refresh(node = this.treeModel.root) {
375
+ if (!opened_editor_node_define_1.EditorFileGroup.is(node) && node.parent) {
376
+ node = node.parent;
377
+ }
378
+ // 这里也可以直接调用node.refresh,但由于文件树刷新事件可能会较多
379
+ // 队列化刷新动作减少更新成本
380
+ this.queueChangeEvent(node.path, () => {
381
+ this.onDidRefreshedEmitter.fire();
382
+ });
383
+ }
384
+ // 队列化Changed事件
385
+ queueChangeEvent(path, callback) {
386
+ if (!this.flushEventQueueDeferred) {
387
+ this.flushEventQueueDeferred = new ide_core_browser_1.Deferred();
388
+ clearTimeout(this._eventFlushTimeout);
389
+ this._eventFlushTimeout = setTimeout(async () => {
390
+ var _a;
391
+ await this.flushEventQueue();
392
+ (_a = this.flushEventQueueDeferred) === null || _a === void 0 ? void 0 : _a.resolve();
393
+ this.flushEventQueueDeferred = null;
394
+ callback();
395
+ }, OpenedEditorModelService_1.DEFAULT_FLUSH_FILE_EVENT_DELAY);
396
+ }
397
+ if (this._changeEventDispatchQueue.indexOf(path) === -1) {
398
+ this._changeEventDispatchQueue.push(path);
399
+ }
400
+ }
401
+ setExplorerTabBarBadge() {
402
+ const targetSets = new Set();
403
+ for (const target of this.dirtyDecoration.appliedTargets.keys()) {
404
+ targetSets.add(target.uri.toString());
405
+ }
406
+ const dirtyCount = targetSets.size;
407
+ const handler = this.layoutService.getTabbarHandler(explorer_contribution_1.ExplorerContainerId);
408
+ if (handler) {
409
+ handler.setBadge(dirtyCount > 0 ? dirtyCount.toString() : '');
410
+ }
411
+ }
412
+ };
413
+ OpenedEditorModelService.DEFAULT_FLUSH_FILE_EVENT_DELAY = 100;
414
+ OpenedEditorModelService.DEFAULT_LOCATION_FLUSH_DELAY = 200;
415
+ (0, tslib_1.__decorate)([
416
+ (0, di_1.Autowired)(di_1.INJECTOR_TOKEN),
417
+ (0, tslib_1.__metadata)("design:type", di_1.Injector)
418
+ ], OpenedEditorModelService.prototype, "injector", void 0);
419
+ (0, tslib_1.__decorate)([
420
+ (0, di_1.Autowired)(next_1.ICtxMenuRenderer),
421
+ (0, tslib_1.__metadata)("design:type", next_1.ICtxMenuRenderer)
422
+ ], OpenedEditorModelService.prototype, "ctxMenuRenderer", void 0);
423
+ (0, tslib_1.__decorate)([
424
+ (0, di_1.Autowired)(next_1.AbstractContextMenuService),
425
+ (0, tslib_1.__metadata)("design:type", next_1.AbstractContextMenuService)
426
+ ], OpenedEditorModelService.prototype, "contextMenuService", void 0);
427
+ (0, tslib_1.__decorate)([
428
+ (0, di_1.Autowired)(ide_core_browser_1.IContextKeyService),
429
+ (0, tslib_1.__metadata)("design:type", Object)
430
+ ], OpenedEditorModelService.prototype, "contextKeyService", void 0);
431
+ (0, tslib_1.__decorate)([
432
+ (0, di_1.Autowired)(opened_editor_tree_service_1.OpenedEditorService),
433
+ (0, tslib_1.__metadata)("design:type", opened_editor_tree_service_1.OpenedEditorService)
434
+ ], OpenedEditorModelService.prototype, "openedEditorService", void 0);
435
+ (0, tslib_1.__decorate)([
436
+ (0, di_1.Autowired)(services_1.LabelService),
437
+ (0, tslib_1.__metadata)("design:type", services_1.LabelService)
438
+ ], OpenedEditorModelService.prototype, "labelService", void 0);
439
+ (0, tslib_1.__decorate)([
440
+ (0, di_1.Autowired)(opened_editor_decoration_service_1.OpenedEditorDecorationService),
441
+ (0, tslib_1.__metadata)("design:type", opened_editor_decoration_service_1.OpenedEditorDecorationService)
442
+ ], OpenedEditorModelService.prototype, "decorationService", void 0);
443
+ (0, tslib_1.__decorate)([
444
+ (0, di_1.Autowired)(opened_editor_event_service_1.OpenedEditorEventService),
445
+ (0, tslib_1.__metadata)("design:type", opened_editor_event_service_1.OpenedEditorEventService)
446
+ ], OpenedEditorModelService.prototype, "openedEditorEventService", void 0);
447
+ (0, tslib_1.__decorate)([
448
+ (0, di_1.Autowired)(browser_1.WorkbenchEditorService),
449
+ (0, tslib_1.__metadata)("design:type", browser_1.WorkbenchEditorService)
450
+ ], OpenedEditorModelService.prototype, "editorService", void 0);
451
+ (0, tslib_1.__decorate)([
452
+ (0, di_1.Autowired)(ide_core_browser_1.CommandService),
453
+ (0, tslib_1.__metadata)("design:type", Object)
454
+ ], OpenedEditorModelService.prototype, "commandService", void 0);
455
+ (0, tslib_1.__decorate)([
456
+ (0, di_1.Autowired)(ide_main_layout_1.IMainLayoutService),
457
+ (0, tslib_1.__metadata)("design:type", Object)
458
+ ], OpenedEditorModelService.prototype, "layoutService", void 0);
459
+ OpenedEditorModelService = OpenedEditorModelService_1 = (0, tslib_1.__decorate)([
460
+ (0, di_1.Injectable)(),
461
+ (0, tslib_1.__metadata)("design:paramtypes", [])
462
+ ], OpenedEditorModelService);
463
+ exports.OpenedEditorModelService = OpenedEditorModelService;
464
+ //# sourceMappingURL=opened-editor-model.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opened-editor-model.service.js","sourceRoot":"","sources":["../../../src/browser/services/opened-editor-model.service.ts"],"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AS,EAAC,gDAAmB,CAAC;2CACO,gDAAmB;qEAAC;AAG1D;IADC,IAAA,cAAS,EAAC,uBAAY,CAAC;2CACM,uBAAY;8DAAC;AAG3C;IADC,IAAA,cAAS,EAAC,gEAA6B,CAAC;2CACN,gEAA6B;mEAAC;AAGjE;IADC,IAAA,cAAS,EAAC,sDAAwB,CAAC;2CACM,sDAAwB;0EAAC;AAGnE;IADC,IAAA,cAAS,EAAC,gCAAsB,CAAC;2CACF,gCAAsB;+DAAC;AAGvD;IADC,IAAA,cAAS,EAAC,iCAAc,CAAC;;gEACqB;AAG/C;IADC,IAAA,cAAS,EAAC,oCAAkB,CAAC;;+DACqB;AAnCxC,wBAAwB;IADpC,IAAA,eAAU,GAAE;;GACA,wBAAwB,CAqepC;AAreY,4DAAwB"}
@@ -0,0 +1,28 @@
1
+ import { Tree, ITreeNodeOrCompositeTreeNode } from '@opensumi/ide-components';
2
+ import { EditorFileGroup, EditorFile, EditorFileRoot } from '../opened-editor-node.define';
3
+ import { IEditorGroup, IResource } from '@opensumi/ide-editor';
4
+ import { URI, Event } from '@opensumi/ide-core-browser';
5
+ import { LabelService } from '@opensumi/ide-core-browser/lib/services';
6
+ export declare class OpenedEditorService extends Tree {
7
+ private readonly workbenchEditorService;
8
+ private readonly workspaceService;
9
+ readonly labelService: LabelService;
10
+ private readonly resourceService;
11
+ private cacheEditorNode;
12
+ private isGroupTree;
13
+ private onDirtyNodesChangeEmitter;
14
+ get onDirtyNodesChange(): Event<EditorFile[]>;
15
+ resolveChildren(parent?: EditorFileRoot | EditorFileGroup): Promise<(EditorFileGroup | EditorFileRoot | EditorFile)[]>;
16
+ sortComparator: (a: ITreeNodeOrCompositeTreeNode, b: ITreeNodeOrCompositeTreeNode) => any;
17
+ private cacheNodes;
18
+ getEditorNodeByUri(resource?: IResource | URI, group?: IEditorGroup): EditorFileRoot | EditorFileGroup | EditorFile | undefined;
19
+ /**
20
+ * 获取相对路径的Tooltip
21
+ * 无法获取相对路径,则完整显示uri路径
22
+ * @param {URI} path
23
+ * @returns
24
+ * @memberof FileTreeAPI
25
+ */
26
+ getReadableTooltip(path: URI): Promise<string>;
27
+ }
28
+ //# sourceMappingURL=opened-editor-tree.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opened-editor-tree.service.d.ts","sourceRoot":"","sources":["../../../src/browser/services/opened-editor-tree.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,4BAA4B,EAAgB,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,cAAc,EAAoB,MAAM,8BAA8B,CAAC;AAC7G,OAAO,EAA0B,YAAY,EAAE,SAAS,EAAmB,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,GAAG,EAA2B,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGjF,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,qBACa,mBAAoB,SAAQ,IAAI;IAG3C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;IAGhE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAoB;IAErD,SACgB,YAAY,EAAE,YAAY,CAAC;IAG3C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;IAElD,OAAO,CAAC,eAAe,CAAyE;IAEhG,OAAO,CAAC,WAAW,CAAkB;IAErC,OAAO,CAAC,yBAAyB,CAAwC;IAEzE,IAAI,kBAAkB,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC,CAE5C;IAEK,eAAe,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,eAAe,GAAG,OAAO,CAAC,CAAC,eAAe,GAAG,cAAc,GAAG,UAAU,CAAC,EAAE,CAAC;IAqC5H,cAAc,MAAO,4BAA4B,KAAK,4BAA4B,SAmBjF;IAED,OAAO,CAAC,UAAU;IAyBX,kBAAkB,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,KAAK,CAAC,EAAE,YAAY;IAwB1E;;;;;;OAMG;IACU,kBAAkB,CAAC,IAAI,EAAE,GAAG;CAa1C"}