@codingame/monaco-vscode-api 2.1.4 → 2.2.0-next.1

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 (190) hide show
  1. package/README.md +2 -0
  2. package/contributions.js +1 -0
  3. package/extensions.d.ts +6 -3
  4. package/extensions.js +18 -7
  5. package/lifecycle.js +11 -3
  6. package/missing-services.js +55 -10
  7. package/monaco.js +7 -3
  8. package/package.json +8 -8
  9. package/service-override/tools/views.d.ts +98 -0
  10. package/service-override/tools/views.js +249 -0
  11. package/services.d.ts +4 -2
  12. package/services.js +11 -9
  13. package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
  14. package/vscode/src/vs/base/browser/dom.js +18 -1
  15. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
  16. package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
  17. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
  18. package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
  19. package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
  20. package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
  21. package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
  22. package/vscode/src/vs/base/common/async.js +46 -2
  23. package/vscode/src/vs/base/common/codicons.d.ts +579 -0
  24. package/vscode/src/vs/base/common/event.js +11 -2
  25. package/vscode/src/vs/base/common/keybindingParser.js +87 -0
  26. package/vscode/src/vs/base/common/network.js +1 -2
  27. package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
  28. package/vscode/src/vs/base/common/platform.js +2 -1
  29. package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
  30. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
  31. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
  32. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
  33. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
  34. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
  35. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
  36. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
  37. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
  38. package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
  39. package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
  40. package/vscode/src/vs/platform/log/browser/log.js +24 -0
  41. package/vscode/src/vs/platform/product/common/product.js +1 -2
  42. package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
  43. package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
  44. package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
  45. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
  46. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
  47. package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
  48. package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
  49. package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
  50. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
  51. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
  52. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
  53. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
  54. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
  55. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
  56. package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
  57. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
  58. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
  59. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
  60. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
  61. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
  62. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
  63. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
  64. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
  65. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
  66. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
  67. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
  68. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
  69. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
  70. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
  71. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
  72. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
  73. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
  74. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
  75. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
  76. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
  77. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
  78. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
  79. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
  80. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
  81. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
  82. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
  83. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
  84. package/vscode/src/vs/workbench/browser/window.js +239 -5
  85. package/vscode/src/vs/workbench/common/configuration.js +11 -1
  86. package/vscode/src/vs/workbench/common/theme.js +3 -3
  87. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
  88. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
  89. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
  90. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
  91. package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
  92. package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
  93. package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
  94. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
  95. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
  96. package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
  97. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
  98. package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
  99. package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
  100. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
  101. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
  102. package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
  103. package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
  104. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
  105. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
  106. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
  107. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
  108. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
  109. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
  110. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
  111. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
  112. package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
  113. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
  114. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
  115. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
  116. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
  117. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
  118. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
  119. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
  120. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
  121. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
  122. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
  123. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
  124. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
  125. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
  126. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
  127. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
  128. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
  129. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
  130. package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
  131. package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
  132. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
  133. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
  134. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
  135. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
  136. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
  137. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
  138. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
  139. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
  140. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
  141. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
  142. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
  143. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
  144. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
  145. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
  146. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
  147. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
  148. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
  149. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
  150. package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
  151. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
  152. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
  154. package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
  155. package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
  156. package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
  157. package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
  158. package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
  159. package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
  160. package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
  161. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
  162. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
  163. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
  164. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
  165. package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
  166. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
  167. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
  168. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
  169. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
  170. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
  171. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
  172. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
  173. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
  174. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
  175. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
  176. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
  177. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
  178. package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
  179. package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
  180. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
  181. package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
  182. package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
  183. package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
  184. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
  185. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
  186. package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
  187. package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
  188. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
  189. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
  190. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
@@ -0,0 +1,596 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { VIEWS_LOG_ID, VIEWS_LOG_NAME, defaultViewIcon, Extensions } from '../../../common/views.js';
3
+ import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
4
+ import { IStorageService } from '../../../../platform/storage/common/storage.js';
5
+ import { Registry } from '../../../../platform/registry/common/platform.js';
6
+ import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';
7
+ import { Emitter, Event } from '../../../../base/common/event.js';
8
+ import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
9
+ import { URI } from '../../../../base/common/uri.js';
10
+ import { coalesce, move } from '../../../../base/common/arrays.js';
11
+ import { isUndefinedOrNull, isUndefined } from '../../../../base/common/types.js';
12
+ import { isEqual } from '../../../../base/common/resources.js';
13
+ import { ThemeIcon } from '../../../../base/common/themables.js';
14
+ import { ILoggerService } from '../../../../platform/log/common/log.js';
15
+ import { registerAction2, Action2 } from '../../../../platform/actions/common/actions.js';
16
+ import { Categories } from '../../../../platform/action/common/actionCommonCategories.js';
17
+ import { IOutputService } from '../../output/common/output.js';
18
+ import { CounterSet } from '../../../../base/common/map.js';
19
+ registerAction2(class extends Action2 {
20
+ constructor() {
21
+ super({
22
+ id: '_workbench.output.showViewsLog',
23
+ title: { value: 'Show Views Log', original: 'Show Views Log' },
24
+ category: Categories.Developer,
25
+ f1: true
26
+ });
27
+ }
28
+ async run(servicesAccessor) {
29
+ const loggerService = servicesAccessor.get(ILoggerService);
30
+ const outputService = servicesAccessor.get(IOutputService);
31
+ loggerService.setVisibility(VIEWS_LOG_ID, true);
32
+ outputService.showChannel(VIEWS_LOG_ID);
33
+ }
34
+ });
35
+ function getViewsStateStorageId(viewContainerStorageId) { return `${viewContainerStorageId}.hidden`; }
36
+ let ViewDescriptorsState = class ViewDescriptorsState extends Disposable {
37
+ constructor(viewContainerStorageId, viewContainerName, storageService, loggerService) {
38
+ super();
39
+ this.viewContainerName = viewContainerName;
40
+ this.storageService = storageService;
41
+ this._onDidChangeStoredState = this._register(( new Emitter()));
42
+ this.onDidChangeStoredState = this._onDidChangeStoredState.event;
43
+ this.logger = loggerService.createLogger(VIEWS_LOG_ID, { name: VIEWS_LOG_NAME, hidden: true });
44
+ this.globalViewsStateStorageId = getViewsStateStorageId(viewContainerStorageId);
45
+ this.workspaceViewsStateStorageId = viewContainerStorageId;
46
+ this._register(this.storageService.onDidChangeValue(0 , this.globalViewsStateStorageId, this._register(( new DisposableStore())))(() => this.onDidStorageChange()));
47
+ this.state = this.initialize();
48
+ }
49
+ set(id, state) {
50
+ this.state.set(id, state);
51
+ }
52
+ get(id) {
53
+ return this.state.get(id);
54
+ }
55
+ updateState(viewDescriptors) {
56
+ this.updateWorkspaceState(viewDescriptors);
57
+ this.updateGlobalState(viewDescriptors);
58
+ }
59
+ updateWorkspaceState(viewDescriptors) {
60
+ const storedViewsStates = this.getStoredWorkspaceState();
61
+ for (const viewDescriptor of viewDescriptors) {
62
+ const viewState = this.get(viewDescriptor.id);
63
+ if (viewState) {
64
+ storedViewsStates[viewDescriptor.id] = {
65
+ collapsed: !!viewState.collapsed,
66
+ isHidden: !viewState.visibleWorkspace,
67
+ size: viewState.size,
68
+ order: viewDescriptor.workspace && viewState ? viewState.order : undefined
69
+ };
70
+ }
71
+ }
72
+ if (( Object.keys(storedViewsStates)).length > 0) {
73
+ this.storageService.store(this.workspaceViewsStateStorageId, JSON.stringify(storedViewsStates), 1 , 1 );
74
+ }
75
+ else {
76
+ this.storageService.remove(this.workspaceViewsStateStorageId, 1 );
77
+ }
78
+ }
79
+ updateGlobalState(viewDescriptors) {
80
+ const storedGlobalState = this.getStoredGlobalState();
81
+ for (const viewDescriptor of viewDescriptors) {
82
+ const state = this.get(viewDescriptor.id);
83
+ storedGlobalState.set(viewDescriptor.id, {
84
+ id: viewDescriptor.id,
85
+ isHidden: state && viewDescriptor.canToggleVisibility ? !state.visibleGlobal : false,
86
+ order: !viewDescriptor.workspace && state ? state.order : undefined
87
+ });
88
+ }
89
+ this.setStoredGlobalState(storedGlobalState);
90
+ }
91
+ onDidStorageChange() {
92
+ if (this.globalViewsStatesValue !== this.getStoredGlobalViewsStatesValue() ) {
93
+ this._globalViewsStatesValue = undefined;
94
+ const storedViewsVisibilityStates = this.getStoredGlobalState();
95
+ const storedWorkspaceViewsStates = this.getStoredWorkspaceState();
96
+ const changedStates = [];
97
+ for (const [id, storedState] of storedViewsVisibilityStates) {
98
+ const state = this.get(id);
99
+ if (state) {
100
+ if (state.visibleGlobal !== !storedState.isHidden) {
101
+ if (!storedState.isHidden) {
102
+ this.logger.info(`View visibility state changed: ${id} is now visible`, this.viewContainerName);
103
+ }
104
+ changedStates.push({ id, visible: !storedState.isHidden });
105
+ }
106
+ }
107
+ else {
108
+ const workspaceViewState = storedWorkspaceViewsStates[id];
109
+ this.set(id, {
110
+ active: false,
111
+ visibleGlobal: !storedState.isHidden,
112
+ visibleWorkspace: isUndefined(workspaceViewState?.isHidden) ? undefined : !workspaceViewState?.isHidden,
113
+ collapsed: workspaceViewState?.collapsed,
114
+ order: workspaceViewState?.order,
115
+ size: workspaceViewState?.size,
116
+ });
117
+ }
118
+ }
119
+ if (changedStates.length) {
120
+ this._onDidChangeStoredState.fire(changedStates);
121
+ for (const changedState of changedStates) {
122
+ const state = this.get(changedState.id);
123
+ if (state) {
124
+ state.visibleGlobal = changedState.visible;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ initialize() {
131
+ const viewStates = ( new Map());
132
+ const workspaceViewsStates = this.getStoredWorkspaceState();
133
+ for (const id of ( Object.keys(workspaceViewsStates))) {
134
+ const workspaceViewState = workspaceViewsStates[id];
135
+ viewStates.set(id, {
136
+ active: false,
137
+ visibleGlobal: undefined,
138
+ visibleWorkspace: isUndefined(workspaceViewState.isHidden) ? undefined : !workspaceViewState.isHidden,
139
+ collapsed: workspaceViewState.collapsed,
140
+ order: workspaceViewState.order,
141
+ size: workspaceViewState.size,
142
+ });
143
+ }
144
+ const value = this.storageService.get(this.globalViewsStateStorageId, 1 , '[]');
145
+ const { state: workspaceVisibilityStates } = this.parseStoredGlobalState(value);
146
+ if (workspaceVisibilityStates.size > 0) {
147
+ for (const { id, isHidden } of ( workspaceVisibilityStates.values())) {
148
+ const viewState = viewStates.get(id);
149
+ if (viewState) {
150
+ if (isUndefined(viewState.visibleWorkspace)) {
151
+ viewState.visibleWorkspace = !isHidden;
152
+ }
153
+ }
154
+ else {
155
+ viewStates.set(id, {
156
+ active: false,
157
+ collapsed: undefined,
158
+ visibleGlobal: undefined,
159
+ visibleWorkspace: !isHidden,
160
+ });
161
+ }
162
+ }
163
+ this.storageService.remove(this.globalViewsStateStorageId, 1 );
164
+ }
165
+ const { state, hasDuplicates } = this.parseStoredGlobalState(this.globalViewsStatesValue);
166
+ if (hasDuplicates) {
167
+ this.setStoredGlobalState(state);
168
+ }
169
+ for (const { id, isHidden, order } of ( state.values())) {
170
+ const viewState = viewStates.get(id);
171
+ if (viewState) {
172
+ viewState.visibleGlobal = !isHidden;
173
+ if (!isUndefined(order)) {
174
+ viewState.order = order;
175
+ }
176
+ }
177
+ else {
178
+ viewStates.set(id, {
179
+ active: false,
180
+ visibleGlobal: !isHidden,
181
+ order,
182
+ collapsed: undefined,
183
+ visibleWorkspace: undefined,
184
+ });
185
+ }
186
+ }
187
+ return viewStates;
188
+ }
189
+ getStoredWorkspaceState() {
190
+ return JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId, 1 , '{}'));
191
+ }
192
+ getStoredGlobalState() {
193
+ return this.parseStoredGlobalState(this.globalViewsStatesValue).state;
194
+ }
195
+ setStoredGlobalState(storedGlobalState) {
196
+ this.globalViewsStatesValue = JSON.stringify([...( storedGlobalState.values())]);
197
+ }
198
+ parseStoredGlobalState(value) {
199
+ const storedValue = JSON.parse(value);
200
+ let hasDuplicates = false;
201
+ const state = storedValue.reduce((result, storedState) => {
202
+ if (typeof storedState === 'string' ) {
203
+ hasDuplicates = hasDuplicates || ( result.has(storedState));
204
+ result.set(storedState, { id: storedState, isHidden: true });
205
+ }
206
+ else {
207
+ hasDuplicates = hasDuplicates || ( result.has(storedState.id));
208
+ result.set(storedState.id, storedState);
209
+ }
210
+ return result;
211
+ }, ( new Map()));
212
+ return { state, hasDuplicates };
213
+ }
214
+ get globalViewsStatesValue() {
215
+ if (!this._globalViewsStatesValue) {
216
+ this._globalViewsStatesValue = this.getStoredGlobalViewsStatesValue();
217
+ }
218
+ return this._globalViewsStatesValue;
219
+ }
220
+ set globalViewsStatesValue(globalViewsStatesValue) {
221
+ if (this.globalViewsStatesValue !== globalViewsStatesValue) {
222
+ this._globalViewsStatesValue = globalViewsStatesValue;
223
+ this.setStoredGlobalViewsStatesValue(globalViewsStatesValue);
224
+ }
225
+ }
226
+ getStoredGlobalViewsStatesValue() {
227
+ return this.storageService.get(this.globalViewsStateStorageId, 0 , '[]');
228
+ }
229
+ setStoredGlobalViewsStatesValue(value) {
230
+ this.storageService.store(this.globalViewsStateStorageId, value, 0 , 0 );
231
+ }
232
+ };
233
+ ViewDescriptorsState = ( __decorate([
234
+ ( __param(2, IStorageService)),
235
+ ( __param(3, ILoggerService))
236
+ ], ViewDescriptorsState));
237
+ let ViewContainerModel = class ViewContainerModel extends Disposable {
238
+ get title() { return this._title; }
239
+ get icon() { return this._icon; }
240
+ get keybindingId() { return this._keybindingId; }
241
+ get allViewDescriptors() { return ( this.viewDescriptorItems.map(item => item.viewDescriptor)); }
242
+ get activeViewDescriptors() { return ( this.viewDescriptorItems.filter(item => item.state.active).map(item => item.viewDescriptor)); }
243
+ get visibleViewDescriptors() { return ( this.viewDescriptorItems.filter(item => this.isViewDescriptorVisible(item)).map(item => item.viewDescriptor)); }
244
+ constructor(viewContainer, instantiationService, contextKeyService, loggerService) {
245
+ super();
246
+ this.viewContainer = viewContainer;
247
+ this.contextKeyService = contextKeyService;
248
+ this.contextKeys = ( new CounterSet());
249
+ this.viewDescriptorItems = [];
250
+ this._onDidChangeContainerInfo = this._register(( new Emitter()));
251
+ this.onDidChangeContainerInfo = this._onDidChangeContainerInfo.event;
252
+ this._onDidChangeAllViewDescriptors = this._register(( new Emitter()));
253
+ this.onDidChangeAllViewDescriptors = this._onDidChangeAllViewDescriptors.event;
254
+ this._onDidChangeActiveViewDescriptors = this._register(( new Emitter()));
255
+ this.onDidChangeActiveViewDescriptors = this._onDidChangeActiveViewDescriptors.event;
256
+ this._onDidAddVisibleViewDescriptors = this._register(( new Emitter()));
257
+ this.onDidAddVisibleViewDescriptors = this._onDidAddVisibleViewDescriptors.event;
258
+ this._onDidRemoveVisibleViewDescriptors = this._register(( new Emitter()));
259
+ this.onDidRemoveVisibleViewDescriptors = this._onDidRemoveVisibleViewDescriptors.event;
260
+ this._onDidMoveVisibleViewDescriptors = this._register(( new Emitter()));
261
+ this.onDidMoveVisibleViewDescriptors = this._onDidMoveVisibleViewDescriptors.event;
262
+ this.logger = loggerService.createLogger(VIEWS_LOG_ID, { name: VIEWS_LOG_NAME, hidden: true });
263
+ this._register(Event.filter(contextKeyService.onDidChangeContext, e => e.affectsSome(this.contextKeys))(() => this.onDidChangeContext()));
264
+ this.viewDescriptorsState = this._register(instantiationService.createInstance(ViewDescriptorsState, viewContainer.storageId || `${viewContainer.id}.state`, typeof viewContainer.title === 'string' ? viewContainer.title : viewContainer.title.original));
265
+ this._register(this.viewDescriptorsState.onDidChangeStoredState(items => this.updateVisibility(items)));
266
+ this.updateContainerInfo();
267
+ }
268
+ updateContainerInfo() {
269
+ const useDefaultContainerInfo = this.viewContainer.alwaysUseContainerInfo || this.visibleViewDescriptors.length === 0 || ( this.visibleViewDescriptors.some(v => ( Registry.as(Extensions.ViewsRegistry)).getViewContainer(v.id) === this.viewContainer));
270
+ const title = useDefaultContainerInfo ? (typeof this.viewContainer.title === 'string' ? this.viewContainer.title : this.viewContainer.title.value) : this.visibleViewDescriptors[0]?.containerTitle || this.visibleViewDescriptors[0]?.name?.value || '';
271
+ let titleChanged = false;
272
+ if (this._title !== title) {
273
+ this._title = title;
274
+ titleChanged = true;
275
+ }
276
+ const icon = useDefaultContainerInfo ? this.viewContainer.icon : this.visibleViewDescriptors[0]?.containerIcon || defaultViewIcon;
277
+ let iconChanged = false;
278
+ if (!this.isEqualIcon(icon)) {
279
+ this._icon = icon;
280
+ iconChanged = true;
281
+ }
282
+ const keybindingId = this.viewContainer.openCommandActionDescriptor?.id ?? this.activeViewDescriptors.find(v => v.openCommandActionDescriptor)?.openCommandActionDescriptor?.id;
283
+ let keybindingIdChanged = false;
284
+ if (this._keybindingId !== keybindingId) {
285
+ this._keybindingId = keybindingId;
286
+ keybindingIdChanged = true;
287
+ }
288
+ if (titleChanged || iconChanged || keybindingIdChanged) {
289
+ this._onDidChangeContainerInfo.fire({ title: titleChanged, icon: iconChanged, keybindingId: keybindingIdChanged });
290
+ }
291
+ }
292
+ isEqualIcon(icon) {
293
+ if (URI.isUri(icon)) {
294
+ return URI.isUri(this._icon) && isEqual(icon, this._icon);
295
+ }
296
+ else if (ThemeIcon.isThemeIcon(icon)) {
297
+ return ThemeIcon.isThemeIcon(this._icon) && ThemeIcon.isEqual(icon, this._icon);
298
+ }
299
+ return icon === this._icon;
300
+ }
301
+ isVisible(id) {
302
+ const viewDescriptorItem = this.viewDescriptorItems.find(v => v.viewDescriptor.id === id);
303
+ if (!viewDescriptorItem) {
304
+ throw new Error(`Unknown view ${id}`);
305
+ }
306
+ return this.isViewDescriptorVisible(viewDescriptorItem);
307
+ }
308
+ setVisible(id, visible) {
309
+ this.updateVisibility([{ id, visible }]);
310
+ }
311
+ updateVisibility(viewDescriptors) {
312
+ const viewDescriptorItemsToHide = coalesce(( viewDescriptors.filter(({ visible }) => !visible)
313
+ .map(({ id }) => this.findAndIgnoreIfNotFound(id))));
314
+ const removed = [];
315
+ for (const { viewDescriptorItem, visibleIndex } of viewDescriptorItemsToHide) {
316
+ if (this.updateViewDescriptorItemVisibility(viewDescriptorItem, false)) {
317
+ removed.push({ viewDescriptor: viewDescriptorItem.viewDescriptor, index: visibleIndex });
318
+ }
319
+ }
320
+ if (removed.length) {
321
+ this.broadCastRemovedVisibleViewDescriptors(removed);
322
+ }
323
+ const added = [];
324
+ for (const { id, visible } of viewDescriptors) {
325
+ if (!visible) {
326
+ continue;
327
+ }
328
+ const foundViewDescriptor = this.findAndIgnoreIfNotFound(id);
329
+ if (!foundViewDescriptor) {
330
+ continue;
331
+ }
332
+ const { viewDescriptorItem, visibleIndex } = foundViewDescriptor;
333
+ if (this.updateViewDescriptorItemVisibility(viewDescriptorItem, true)) {
334
+ added.push({ index: visibleIndex, viewDescriptor: viewDescriptorItem.viewDescriptor, size: viewDescriptorItem.state.size, collapsed: !!viewDescriptorItem.state.collapsed });
335
+ }
336
+ }
337
+ if (added.length) {
338
+ this.broadCastAddedVisibleViewDescriptors(added);
339
+ }
340
+ }
341
+ updateViewDescriptorItemVisibility(viewDescriptorItem, visible) {
342
+ if (!viewDescriptorItem.viewDescriptor.canToggleVisibility) {
343
+ return false;
344
+ }
345
+ if (this.isViewDescriptorVisibleWhenActive(viewDescriptorItem) === visible) {
346
+ return false;
347
+ }
348
+ if (viewDescriptorItem.viewDescriptor.workspace) {
349
+ viewDescriptorItem.state.visibleWorkspace = visible;
350
+ }
351
+ else {
352
+ viewDescriptorItem.state.visibleGlobal = visible;
353
+ if (visible) {
354
+ this.logger.info(`Showing view ${viewDescriptorItem.viewDescriptor.id} in the container ${this.viewContainer.id}`);
355
+ }
356
+ }
357
+ return this.isViewDescriptorVisible(viewDescriptorItem) === visible;
358
+ }
359
+ isCollapsed(id) {
360
+ return !!this.find(id).viewDescriptorItem.state.collapsed;
361
+ }
362
+ setCollapsed(id, collapsed) {
363
+ const { viewDescriptorItem } = this.find(id);
364
+ if (viewDescriptorItem.state.collapsed !== collapsed) {
365
+ viewDescriptorItem.state.collapsed = collapsed;
366
+ }
367
+ this.viewDescriptorsState.updateState(this.allViewDescriptors);
368
+ }
369
+ getSize(id) {
370
+ return this.find(id).viewDescriptorItem.state.size;
371
+ }
372
+ setSizes(newSizes) {
373
+ for (const { id, size } of newSizes) {
374
+ const { viewDescriptorItem } = this.find(id);
375
+ if (viewDescriptorItem.state.size !== size) {
376
+ viewDescriptorItem.state.size = size;
377
+ }
378
+ }
379
+ this.viewDescriptorsState.updateState(this.allViewDescriptors);
380
+ }
381
+ move(from, to) {
382
+ const fromIndex = this.viewDescriptorItems.findIndex(v => v.viewDescriptor.id === from);
383
+ const toIndex = this.viewDescriptorItems.findIndex(v => v.viewDescriptor.id === to);
384
+ const fromViewDescriptor = this.viewDescriptorItems[fromIndex];
385
+ const toViewDescriptor = this.viewDescriptorItems[toIndex];
386
+ move(this.viewDescriptorItems, fromIndex, toIndex);
387
+ for (let index = 0; index < this.viewDescriptorItems.length; index++) {
388
+ this.viewDescriptorItems[index].state.order = index;
389
+ }
390
+ this.broadCastMovedViewDescriptors({ index: fromIndex, viewDescriptor: fromViewDescriptor.viewDescriptor }, { index: toIndex, viewDescriptor: toViewDescriptor.viewDescriptor });
391
+ }
392
+ add(addedViewDescriptorStates) {
393
+ const addedItems = [];
394
+ for (const addedViewDescriptorState of addedViewDescriptorStates) {
395
+ const viewDescriptor = addedViewDescriptorState.viewDescriptor;
396
+ if (viewDescriptor.when) {
397
+ for (const key of ( viewDescriptor.when.keys())) {
398
+ this.contextKeys.add(key);
399
+ }
400
+ }
401
+ let state = this.viewDescriptorsState.get(viewDescriptor.id);
402
+ if (state) {
403
+ if (viewDescriptor.workspace) {
404
+ state.visibleWorkspace = isUndefinedOrNull(addedViewDescriptorState.visible) ? (isUndefinedOrNull(state.visibleWorkspace) ? !viewDescriptor.hideByDefault : state.visibleWorkspace) : addedViewDescriptorState.visible;
405
+ }
406
+ else {
407
+ const isVisible = state.visibleGlobal;
408
+ state.visibleGlobal = isUndefinedOrNull(addedViewDescriptorState.visible) ? (isUndefinedOrNull(state.visibleGlobal) ? !viewDescriptor.hideByDefault : state.visibleGlobal) : addedViewDescriptorState.visible;
409
+ if (state.visibleGlobal && !isVisible) {
410
+ this.logger.info(`Added view ${viewDescriptor.id} in the container ${this.viewContainer.id} and showing it.`, `${isVisible}`, `${viewDescriptor.hideByDefault}`, `${addedViewDescriptorState.visible}`);
411
+ }
412
+ }
413
+ state.collapsed = isUndefinedOrNull(addedViewDescriptorState.collapsed) ? (isUndefinedOrNull(state.collapsed) ? !!viewDescriptor.collapsed : state.collapsed) : addedViewDescriptorState.collapsed;
414
+ }
415
+ else {
416
+ state = {
417
+ active: false,
418
+ visibleGlobal: isUndefinedOrNull(addedViewDescriptorState.visible) ? !viewDescriptor.hideByDefault : addedViewDescriptorState.visible,
419
+ visibleWorkspace: isUndefinedOrNull(addedViewDescriptorState.visible) ? !viewDescriptor.hideByDefault : addedViewDescriptorState.visible,
420
+ collapsed: isUndefinedOrNull(addedViewDescriptorState.collapsed) ? !!viewDescriptor.collapsed : addedViewDescriptorState.collapsed,
421
+ };
422
+ }
423
+ this.viewDescriptorsState.set(viewDescriptor.id, state);
424
+ state.active = this.contextKeyService.contextMatchesRules(viewDescriptor.when);
425
+ addedItems.push({ viewDescriptor, state });
426
+ }
427
+ this.viewDescriptorItems.push(...addedItems);
428
+ this.viewDescriptorItems.sort(this.compareViewDescriptors.bind(this));
429
+ this._onDidChangeAllViewDescriptors.fire({ added: ( addedItems.map(({ viewDescriptor }) => viewDescriptor)), removed: [] });
430
+ const addedActiveItems = [];
431
+ for (const viewDescriptorItem of addedItems) {
432
+ if (viewDescriptorItem.state.active) {
433
+ addedActiveItems.push({ viewDescriptorItem, visible: this.isViewDescriptorVisible(viewDescriptorItem) });
434
+ }
435
+ }
436
+ if (addedActiveItems.length) {
437
+ this._onDidChangeActiveViewDescriptors.fire(({ added: ( addedActiveItems.map(({ viewDescriptorItem }) => viewDescriptorItem.viewDescriptor)), removed: [] }));
438
+ }
439
+ const addedVisibleDescriptors = [];
440
+ for (const { viewDescriptorItem, visible } of addedActiveItems) {
441
+ if (visible && this.isViewDescriptorVisible(viewDescriptorItem)) {
442
+ const { visibleIndex } = this.find(viewDescriptorItem.viewDescriptor.id);
443
+ addedVisibleDescriptors.push({ index: visibleIndex, viewDescriptor: viewDescriptorItem.viewDescriptor, size: viewDescriptorItem.state.size, collapsed: !!viewDescriptorItem.state.collapsed });
444
+ }
445
+ }
446
+ this.broadCastAddedVisibleViewDescriptors(addedVisibleDescriptors);
447
+ }
448
+ remove(viewDescriptors) {
449
+ const removed = [];
450
+ const removedItems = [];
451
+ const removedActiveDescriptors = [];
452
+ const removedVisibleDescriptors = [];
453
+ for (const viewDescriptor of viewDescriptors) {
454
+ if (viewDescriptor.when) {
455
+ for (const key of ( viewDescriptor.when.keys())) {
456
+ this.contextKeys.delete(key);
457
+ }
458
+ }
459
+ const index = this.viewDescriptorItems.findIndex(i => i.viewDescriptor.id === viewDescriptor.id);
460
+ if (index !== -1) {
461
+ removed.push(viewDescriptor);
462
+ const viewDescriptorItem = this.viewDescriptorItems[index];
463
+ if (viewDescriptorItem.state.active) {
464
+ removedActiveDescriptors.push(viewDescriptorItem.viewDescriptor);
465
+ }
466
+ if (this.isViewDescriptorVisible(viewDescriptorItem)) {
467
+ const { visibleIndex } = this.find(viewDescriptorItem.viewDescriptor.id);
468
+ removedVisibleDescriptors.push({ index: visibleIndex, viewDescriptor: viewDescriptorItem.viewDescriptor });
469
+ }
470
+ removedItems.push(viewDescriptorItem);
471
+ }
472
+ }
473
+ removedItems.forEach(item => this.viewDescriptorItems.splice(this.viewDescriptorItems.indexOf(item), 1));
474
+ this.broadCastRemovedVisibleViewDescriptors(removedVisibleDescriptors);
475
+ if (removedActiveDescriptors.length) {
476
+ this._onDidChangeActiveViewDescriptors.fire(({ added: [], removed: removedActiveDescriptors }));
477
+ }
478
+ if (removed.length) {
479
+ this._onDidChangeAllViewDescriptors.fire({ added: [], removed });
480
+ }
481
+ }
482
+ onDidChangeContext() {
483
+ const addedActiveItems = [];
484
+ const removedActiveItems = [];
485
+ for (const item of this.viewDescriptorItems) {
486
+ const wasActive = item.state.active;
487
+ const isActive = this.contextKeyService.contextMatchesRules(item.viewDescriptor.when);
488
+ if (wasActive !== isActive) {
489
+ if (isActive) {
490
+ addedActiveItems.push({ item, visibleWhenActive: this.isViewDescriptorVisibleWhenActive(item) });
491
+ }
492
+ else {
493
+ removedActiveItems.push(item);
494
+ }
495
+ }
496
+ }
497
+ const removedVisibleDescriptors = [];
498
+ for (const item of removedActiveItems) {
499
+ if (this.isViewDescriptorVisible(item)) {
500
+ const { visibleIndex } = this.find(item.viewDescriptor.id);
501
+ removedVisibleDescriptors.push({ index: visibleIndex, viewDescriptor: item.viewDescriptor });
502
+ }
503
+ }
504
+ removedActiveItems.forEach(item => item.state.active = false);
505
+ addedActiveItems.forEach(({ item }) => item.state.active = true);
506
+ this.broadCastRemovedVisibleViewDescriptors(removedVisibleDescriptors);
507
+ if (addedActiveItems.length || removedActiveItems.length) {
508
+ this._onDidChangeActiveViewDescriptors.fire(({ added: ( addedActiveItems.map(({ item }) => item.viewDescriptor)), removed: ( removedActiveItems.map(item => item.viewDescriptor)) }));
509
+ }
510
+ const addedVisibleDescriptors = [];
511
+ for (const { item, visibleWhenActive } of addedActiveItems) {
512
+ if (visibleWhenActive && this.isViewDescriptorVisible(item)) {
513
+ const { visibleIndex } = this.find(item.viewDescriptor.id);
514
+ addedVisibleDescriptors.push({ index: visibleIndex, viewDescriptor: item.viewDescriptor, size: item.state.size, collapsed: !!item.state.collapsed });
515
+ }
516
+ }
517
+ this.broadCastAddedVisibleViewDescriptors(addedVisibleDescriptors);
518
+ }
519
+ broadCastAddedVisibleViewDescriptors(added) {
520
+ if (added.length) {
521
+ this._onDidAddVisibleViewDescriptors.fire(added.sort((a, b) => a.index - b.index));
522
+ this.updateState(`Added views:${( added.map(v => v.viewDescriptor.id)).join(',')} in ${this.viewContainer.id}`);
523
+ }
524
+ }
525
+ broadCastRemovedVisibleViewDescriptors(removed) {
526
+ if (removed.length) {
527
+ this._onDidRemoveVisibleViewDescriptors.fire(removed.sort((a, b) => b.index - a.index));
528
+ this.updateState(`Removed views:${( removed.map(v => v.viewDescriptor.id)).join(',')} from ${this.viewContainer.id}`);
529
+ }
530
+ }
531
+ broadCastMovedViewDescriptors(from, to) {
532
+ this._onDidMoveVisibleViewDescriptors.fire({ from, to });
533
+ this.updateState(`Moved view ${from.viewDescriptor.id} to ${to.viewDescriptor.id} in ${this.viewContainer.id}`);
534
+ }
535
+ updateState(reason) {
536
+ this.logger.info(reason);
537
+ this.viewDescriptorsState.updateState(this.allViewDescriptors);
538
+ this.updateContainerInfo();
539
+ }
540
+ isViewDescriptorVisible(viewDescriptorItem) {
541
+ if (!viewDescriptorItem.state.active) {
542
+ return false;
543
+ }
544
+ return this.isViewDescriptorVisibleWhenActive(viewDescriptorItem);
545
+ }
546
+ isViewDescriptorVisibleWhenActive(viewDescriptorItem) {
547
+ if (viewDescriptorItem.viewDescriptor.workspace) {
548
+ return !!viewDescriptorItem.state.visibleWorkspace;
549
+ }
550
+ return !!viewDescriptorItem.state.visibleGlobal;
551
+ }
552
+ find(id) {
553
+ const result = this.findAndIgnoreIfNotFound(id);
554
+ if (result) {
555
+ return result;
556
+ }
557
+ throw new Error(`view descriptor ${id} not found`);
558
+ }
559
+ findAndIgnoreIfNotFound(id) {
560
+ for (let i = 0, visibleIndex = 0; i < this.viewDescriptorItems.length; i++) {
561
+ const viewDescriptorItem = this.viewDescriptorItems[i];
562
+ if (viewDescriptorItem.viewDescriptor.id === id) {
563
+ return { index: i, visibleIndex, viewDescriptorItem: viewDescriptorItem };
564
+ }
565
+ if (this.isViewDescriptorVisible(viewDescriptorItem)) {
566
+ visibleIndex++;
567
+ }
568
+ }
569
+ return undefined;
570
+ }
571
+ compareViewDescriptors(a, b) {
572
+ if (a.viewDescriptor.id === b.viewDescriptor.id) {
573
+ return 0;
574
+ }
575
+ return (this.getViewOrder(a) - this.getViewOrder(b)) || this.getGroupOrderResult(a.viewDescriptor, b.viewDescriptor);
576
+ }
577
+ getViewOrder(viewDescriptorItem) {
578
+ const viewOrder = typeof viewDescriptorItem.state.order === 'number' ? viewDescriptorItem.state.order : viewDescriptorItem.viewDescriptor.order;
579
+ return typeof viewOrder === 'number' ? viewOrder : Number.MAX_VALUE;
580
+ }
581
+ getGroupOrderResult(a, b) {
582
+ if (!a.group || !b.group) {
583
+ return 0;
584
+ }
585
+ if (a.group === b.group) {
586
+ return 0;
587
+ }
588
+ return a.group < b.group ? -1 : 1;
589
+ }
590
+ };
591
+ ViewContainerModel = ( __decorate([
592
+ ( __param(1, IInstantiationService)),
593
+ ( __param(2, IContextKeyService)),
594
+ ( __param(3, ILoggerService))
595
+ ], ViewContainerModel));
596
+ export { ViewContainerModel, getViewsStateStorageId };