@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.2

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 (107) hide show
  1. package/index.d.ts +11 -9
  2. package/index.js +8 -6
  3. package/package.json +11 -11
  4. package/tools/views.d.ts +102 -0
  5. package/tools/views.js +253 -0
  6. package/views.d.ts +4 -99
  7. package/views.js +52 -280
  8. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  9. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
  10. package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
  11. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
  12. package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
  13. package/vscode/src/vs/base/common/codicons.d.ts +0 -579
  14. package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
  15. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
  16. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
  17. package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
  18. package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
  19. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
  20. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
  21. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
  22. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
  23. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
  24. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
  25. package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
  26. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
  27. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
  28. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
  29. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
  30. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
  31. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
  32. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
  33. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
  34. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
  35. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
  36. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
  37. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
  38. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
  39. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
  40. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
  41. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
  42. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
  43. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
  44. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
  45. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
  46. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
  47. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
  48. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
  49. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
  50. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
  51. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
  52. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
  53. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
  54. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
  55. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
  56. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
  57. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
  58. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
  59. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
  60. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
  61. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
  62. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
  63. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
  64. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
  65. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
  66. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
  67. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
  68. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
  69. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
  70. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
  71. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
  72. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
  73. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
  74. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
  75. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
  76. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
  77. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
  78. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
  79. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
  80. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
  81. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
  82. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
  83. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
  84. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
  85. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
  86. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
  87. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
  88. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
  89. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
  90. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
  91. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
  92. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
  93. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
  94. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
  95. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
  96. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
  97. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
  98. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
  99. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
  100. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
  101. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
  102. package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
  103. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
  104. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
  105. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
  106. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
  107. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
@@ -1,282 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
3
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
4
- import { isCancellationError } from 'vscode/vscode/vs/base/common/errors';
5
- import { Event } from 'vscode/vscode/vs/base/common/event';
6
- import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
7
- import { registerEditorContribution, EditorAction2 } from 'vscode/vscode/vs/editor/browser/editorExtensions';
8
- import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
9
- import { Range } from 'vscode/vscode/vs/editor/common/core/range';
10
- import { PeekContext } from 'vscode/vscode/vs/editor/contrib/peekView/browser/peekView';
11
- import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
12
- import { registerAction2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
13
- import { RawContextKey, ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
14
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
15
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
16
- import { TypeHierarchyTreePeekWidget } from './typeHierarchyPeek.js';
17
- import { TypeHierarchyProviderRegistry, TypeHierarchyModel } from 'vscode/vscode/vs/workbench/contrib/typeHierarchy/common/typeHierarchy';
18
-
19
- var TypeHierarchyController_1;
20
- const _ctxHasTypeHierarchyProvider = ( new RawContextKey('editorHasTypeHierarchyProvider', false, ( localizeWithPath(
21
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
22
- 'editorHasTypeHierarchyProvider',
23
- 'Whether a type hierarchy provider is available'
24
- ))));
25
- const _ctxTypeHierarchyVisible = ( new RawContextKey('typeHierarchyVisible', false, ( localizeWithPath(
26
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
27
- 'typeHierarchyVisible',
28
- 'Whether type hierarchy peek is currently showing'
29
- ))));
30
- const _ctxTypeHierarchyDirection = ( new RawContextKey(
31
- 'typeHierarchyDirection',
32
- undefined,
33
- { type: 'string', description: ( localizeWithPath(
34
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
35
- 'typeHierarchyDirection',
36
- 'whether type hierarchy shows super types or subtypes'
37
- )) }
38
- ));
39
- function sanitizedDirection(candidate) {
40
- return candidate === "subtypes" || candidate === "supertypes"
41
- ? candidate
42
- : "subtypes" ;
43
- }
44
- let TypeHierarchyController = class TypeHierarchyController {
45
- static { TypeHierarchyController_1 = this; }
46
- static { this.Id = 'typeHierarchy'; }
47
- static get(editor) {
48
- return editor.getContribution(TypeHierarchyController_1.Id);
49
- }
50
- static { this._storageDirectionKey = 'typeHierarchy/defaultDirection'; }
51
- constructor(_editor, _contextKeyService, _storageService, _editorService, _instantiationService) {
52
- this._editor = _editor;
53
- this._contextKeyService = _contextKeyService;
54
- this._storageService = _storageService;
55
- this._editorService = _editorService;
56
- this._instantiationService = _instantiationService;
57
- this._disposables = ( new DisposableStore());
58
- this._sessionDisposables = ( new DisposableStore());
59
- this._ctxHasProvider = _ctxHasTypeHierarchyProvider.bindTo(this._contextKeyService);
60
- this._ctxIsVisible = _ctxTypeHierarchyVisible.bindTo(this._contextKeyService);
61
- this._ctxDirection = _ctxTypeHierarchyDirection.bindTo(this._contextKeyService);
62
- this._disposables.add(Event.any(_editor.onDidChangeModel, _editor.onDidChangeModelLanguage, TypeHierarchyProviderRegistry.onDidChange)(() => {
63
- this._ctxHasProvider.set(_editor.hasModel() && ( TypeHierarchyProviderRegistry.has(_editor.getModel())));
64
- }));
65
- this._disposables.add(this._sessionDisposables);
66
- }
67
- dispose() {
68
- this._disposables.dispose();
69
- }
70
- async startTypeHierarchyFromEditor() {
71
- this._sessionDisposables.clear();
72
- if (!this._editor.hasModel()) {
73
- return;
74
- }
75
- const document = this._editor.getModel();
76
- const position = this._editor.getPosition();
77
- if (!( TypeHierarchyProviderRegistry.has(document))) {
78
- return;
79
- }
80
- const cts = ( new CancellationTokenSource());
81
- const model = TypeHierarchyModel.create(document, position, cts.token);
82
- const direction = sanitizedDirection(this._storageService.get(TypeHierarchyController_1._storageDirectionKey, 0 , "subtypes" ));
83
- this._showTypeHierarchyWidget(position, direction, model, cts);
84
- }
85
- _showTypeHierarchyWidget(position, direction, model, cts) {
86
- this._ctxIsVisible.set(true);
87
- this._ctxDirection.set(direction);
88
- Event.any(this._editor.onDidChangeModel, this._editor.onDidChangeModelLanguage)(this.endTypeHierarchy, this, this._sessionDisposables);
89
- this._widget = this._instantiationService.createInstance(TypeHierarchyTreePeekWidget, this._editor, position, direction);
90
- this._widget.showLoading();
91
- this._sessionDisposables.add(this._widget.onDidClose(() => {
92
- this.endTypeHierarchy();
93
- this._storageService.store(TypeHierarchyController_1._storageDirectionKey, this._widget.direction, 0 , 0 );
94
- }));
95
- this._sessionDisposables.add({ dispose() { cts.dispose(true); } });
96
- this._sessionDisposables.add(this._widget);
97
- model.then(model => {
98
- if (cts.token.isCancellationRequested) {
99
- return;
100
- }
101
- if (model) {
102
- this._sessionDisposables.add(model);
103
- this._widget.showModel(model);
104
- }
105
- else {
106
- this._widget.showMessage(( localizeWithPath(
107
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
108
- 'no.item',
109
- "No results"
110
- )));
111
- }
112
- }).catch(err => {
113
- if (isCancellationError(err)) {
114
- this.endTypeHierarchy();
115
- return;
116
- }
117
- this._widget.showMessage(( localizeWithPath(
118
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
119
- 'error',
120
- "Failed to show type hierarchy"
121
- )));
122
- });
123
- }
124
- async startTypeHierarchyFromTypeHierarchy() {
125
- if (!this._widget) {
126
- return;
127
- }
128
- const model = this._widget.getModel();
129
- const typeItem = this._widget.getFocused();
130
- if (!typeItem || !model) {
131
- return;
132
- }
133
- const newEditor = await this._editorService.openCodeEditor({ resource: typeItem.item.uri }, this._editor);
134
- if (!newEditor) {
135
- return;
136
- }
137
- const newModel = model.fork(typeItem.item);
138
- this._sessionDisposables.clear();
139
- TypeHierarchyController_1.get(newEditor)?._showTypeHierarchyWidget(Range.lift(newModel.root.selectionRange).getStartPosition(), this._widget.direction, Promise.resolve(newModel), ( new CancellationTokenSource()));
140
- }
141
- showSupertypes() {
142
- this._widget?.updateDirection("supertypes" );
143
- this._ctxDirection.set("supertypes" );
144
- }
145
- showSubtypes() {
146
- this._widget?.updateDirection("subtypes" );
147
- this._ctxDirection.set("subtypes" );
148
- }
149
- endTypeHierarchy() {
150
- this._sessionDisposables.clear();
151
- this._ctxIsVisible.set(false);
152
- this._editor.focus();
153
- }
154
- };
155
- TypeHierarchyController = TypeHierarchyController_1 = ( __decorate([
156
- ( __param(1, IContextKeyService)),
157
- ( __param(2, IStorageService)),
158
- ( __param(3, ICodeEditorService)),
159
- ( __param(4, IInstantiationService))
160
- ], TypeHierarchyController));
161
- registerEditorContribution(TypeHierarchyController.Id, TypeHierarchyController, 0 );
162
- registerAction2(class PeekTypeHierarchyAction extends EditorAction2 {
163
- constructor() {
164
- super({
165
- id: 'editor.showTypeHierarchy',
166
- title: ( localize2WithPath(
167
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
168
- 'title',
169
- 'Peek Type Hierarchy'
170
- )),
171
- menu: {
172
- id: MenuId.EditorContextPeek,
173
- group: 'navigation',
174
- order: 1000,
175
- when: ( ContextKeyExpr.and(_ctxHasTypeHierarchyProvider, PeekContext.notInPeekEditor)),
176
- },
177
- precondition: ( ContextKeyExpr.and(_ctxHasTypeHierarchyProvider, PeekContext.notInPeekEditor)),
178
- f1: true
179
- });
180
- }
181
- async runEditorCommand(_accessor, editor) {
182
- return TypeHierarchyController.get(editor)?.startTypeHierarchyFromEditor();
183
- }
184
- });
185
- registerAction2(class extends EditorAction2 {
186
- constructor() {
187
- super({
188
- id: 'editor.showSupertypes',
189
- title: ( localize2WithPath(
190
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
191
- 'title.supertypes',
192
- 'Show Supertypes'
193
- )),
194
- icon: Codicon.typeHierarchySuper,
195
- precondition: ( ContextKeyExpr.and(_ctxTypeHierarchyVisible, ( _ctxTypeHierarchyDirection.isEqualTo("subtypes" )))),
196
- keybinding: {
197
- weight: 200 ,
198
- primary: 1024 + 512 + 38 ,
199
- },
200
- menu: {
201
- id: TypeHierarchyTreePeekWidget.TitleMenu,
202
- when: ( _ctxTypeHierarchyDirection.isEqualTo("subtypes" )),
203
- order: 1,
204
- }
205
- });
206
- }
207
- runEditorCommand(_accessor, editor) {
208
- return TypeHierarchyController.get(editor)?.showSupertypes();
209
- }
210
- });
211
- registerAction2(class extends EditorAction2 {
212
- constructor() {
213
- super({
214
- id: 'editor.showSubtypes',
215
- title: ( localize2WithPath(
216
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
217
- 'title.subtypes',
218
- 'Show Subtypes'
219
- )),
220
- icon: Codicon.typeHierarchySub,
221
- precondition: ( ContextKeyExpr.and(_ctxTypeHierarchyVisible, ( _ctxTypeHierarchyDirection.isEqualTo("supertypes" )))),
222
- keybinding: {
223
- weight: 200 ,
224
- primary: 1024 + 512 + 38 ,
225
- },
226
- menu: {
227
- id: TypeHierarchyTreePeekWidget.TitleMenu,
228
- when: ( _ctxTypeHierarchyDirection.isEqualTo("supertypes" )),
229
- order: 1,
230
- }
231
- });
232
- }
233
- runEditorCommand(_accessor, editor) {
234
- return TypeHierarchyController.get(editor)?.showSubtypes();
235
- }
236
- });
237
- registerAction2(class extends EditorAction2 {
238
- constructor() {
239
- super({
240
- id: 'editor.refocusTypeHierarchy',
241
- title: ( localize2WithPath(
242
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
243
- 'title.refocusTypeHierarchy',
244
- 'Refocus Type Hierarchy'
245
- )),
246
- precondition: _ctxTypeHierarchyVisible,
247
- keybinding: {
248
- weight: 200 ,
249
- primary: 1024 + 3
250
- }
251
- });
252
- }
253
- async runEditorCommand(_accessor, editor) {
254
- return TypeHierarchyController.get(editor)?.startTypeHierarchyFromTypeHierarchy();
255
- }
256
- });
257
- registerAction2(class extends EditorAction2 {
258
- constructor() {
259
- super({
260
- id: 'editor.closeTypeHierarchy',
261
- title: ( localizeWithPath(
262
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution',
263
- 'close',
264
- 'Close'
265
- )),
266
- icon: Codicon.close,
267
- precondition: _ctxTypeHierarchyVisible,
268
- keybinding: {
269
- weight: 200 + 10,
270
- primary: 9 ,
271
- when: ContextKeyExpr.not('config.editor.stablePeek')
272
- },
273
- menu: {
274
- id: TypeHierarchyTreePeekWidget.TitleMenu,
275
- order: 1000
276
- }
277
- });
278
- }
279
- runEditorCommand(_accessor, editor) {
280
- return TypeHierarchyController.get(editor)?.endTypeHierarchy();
281
- }
282
- });
@@ -1,360 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import './media/typeHierarchy.css.js';
3
- import { Dimension, isKeyboardEvent } from 'vscode/vscode/vs/base/browser/dom';
4
- import { SplitView, Sizing } from 'vscode/vscode/vs/base/browser/ui/splitview/splitview';
5
- import { TreeMouseEventTarget } from 'vscode/vscode/vs/base/browser/ui/tree/tree';
6
- import { Color } from 'vscode/vscode/vs/base/common/color';
7
- import { Event } from 'vscode/vscode/vs/base/common/event';
8
- import { DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
9
- import { EmbeddedCodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/embeddedCodeEditorWidget';
10
- import { Range } from 'vscode/vscode/vs/editor/common/core/range';
11
- import { OverviewRulerLane } from 'vscode/vscode/vs/editor/common/model';
12
- import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
13
- import { PeekViewWidget, peekViewBorder, peekViewTitleBackground, peekViewTitleForeground, peekViewTitleInfoForeground, peekViewEditorMatchHighlight, peekViewResultsBackground, IPeekViewService } from 'vscode/vscode/vs/editor/contrib/peekView/browser/peekView';
14
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
15
- import { createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
16
- import { MenuId, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
17
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
18
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
19
- import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
20
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
21
- import { themeColorFromId, IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
22
- import { VirtualDelegate, TypeRenderer, DataSource, Sorter, AccessibilityProvider, IdentityProvider } from './typeHierarchyTree.js';
23
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
24
-
25
- var TypeHierarchyTreePeekWidget_1;
26
- class LayoutInfo {
27
- static store(info, storageService) {
28
- storageService.store('typeHierarchyPeekLayout', JSON.stringify(info), 0 , 1 );
29
- }
30
- static retrieve(storageService) {
31
- const value = storageService.get('typeHierarchyPeekLayout', 0 , '{}');
32
- const defaultInfo = { ratio: 0.7, height: 17 };
33
- try {
34
- return { ...defaultInfo, ...JSON.parse(value) };
35
- }
36
- catch {
37
- return defaultInfo;
38
- }
39
- }
40
- constructor(ratio, height) {
41
- this.ratio = ratio;
42
- this.height = height;
43
- }
44
- }
45
- class TypeHierarchyTree extends WorkbenchAsyncDataTree {
46
- }
47
- let TypeHierarchyTreePeekWidget = class TypeHierarchyTreePeekWidget extends PeekViewWidget {
48
- static { TypeHierarchyTreePeekWidget_1 = this; }
49
- static { this.TitleMenu = ( new MenuId('typehierarchy/title')); }
50
- constructor(editor, _where, _direction, themeService, _peekViewService, _editorService, _textModelService, _storageService, _menuService, _contextKeyService, _instantiationService) {
51
- super(editor, { showFrame: true, showArrow: true, isResizeable: true, isAccessible: true }, _instantiationService);
52
- this._where = _where;
53
- this._direction = _direction;
54
- this._peekViewService = _peekViewService;
55
- this._editorService = _editorService;
56
- this._textModelService = _textModelService;
57
- this._storageService = _storageService;
58
- this._menuService = _menuService;
59
- this._contextKeyService = _contextKeyService;
60
- this._instantiationService = _instantiationService;
61
- this._treeViewStates = ( new Map());
62
- this._previewDisposable = ( new DisposableStore());
63
- this.create();
64
- this._peekViewService.addExclusiveWidget(editor, this);
65
- this._applyTheme(themeService.getColorTheme());
66
- this._disposables.add(themeService.onDidColorThemeChange(this._applyTheme, this));
67
- this._disposables.add(this._previewDisposable);
68
- }
69
- dispose() {
70
- LayoutInfo.store(this._layoutInfo, this._storageService);
71
- this._splitView.dispose();
72
- this._tree.dispose();
73
- this._editor.dispose();
74
- super.dispose();
75
- }
76
- get direction() {
77
- return this._direction;
78
- }
79
- _applyTheme(theme) {
80
- const borderColor = theme.getColor(peekViewBorder) || Color.transparent;
81
- this.style({
82
- arrowColor: borderColor,
83
- frameColor: borderColor,
84
- headerBackgroundColor: theme.getColor(peekViewTitleBackground) || Color.transparent,
85
- primaryHeadingColor: theme.getColor(peekViewTitleForeground),
86
- secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground)
87
- });
88
- }
89
- _fillHead(container) {
90
- super._fillHead(container, true);
91
- const menu = this._menuService.createMenu(TypeHierarchyTreePeekWidget_1.TitleMenu, this._contextKeyService);
92
- const updateToolbar = () => {
93
- const actions = [];
94
- createAndFillInActionBarActions(menu, undefined, actions);
95
- this._actionbarWidget.clear();
96
- this._actionbarWidget.push(actions, { label: false, icon: true });
97
- };
98
- this._disposables.add(menu);
99
- this._disposables.add(menu.onDidChange(updateToolbar));
100
- updateToolbar();
101
- }
102
- _fillBody(parent) {
103
- this._layoutInfo = LayoutInfo.retrieve(this._storageService);
104
- this._dim = ( new Dimension(0, 0));
105
- this._parent = parent;
106
- parent.classList.add('type-hierarchy');
107
- const message = document.createElement('div');
108
- message.classList.add('message');
109
- parent.appendChild(message);
110
- this._message = message;
111
- this._message.tabIndex = 0;
112
- const container = document.createElement('div');
113
- container.classList.add('results');
114
- parent.appendChild(container);
115
- this._splitView = ( new SplitView(container, { orientation: 1 }));
116
- const editorContainer = document.createElement('div');
117
- editorContainer.classList.add('editor');
118
- container.appendChild(editorContainer);
119
- const editorOptions = {
120
- scrollBeyondLastLine: false,
121
- scrollbar: {
122
- verticalScrollbarSize: 14,
123
- horizontal: 'auto',
124
- useShadows: true,
125
- verticalHasArrows: false,
126
- horizontalHasArrows: false,
127
- alwaysConsumeMouseWheel: false
128
- },
129
- overviewRulerLanes: 2,
130
- fixedOverflowWidgets: true,
131
- minimap: {
132
- enabled: false
133
- }
134
- };
135
- this._editor = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, editorContainer, editorOptions, {}, this.editor);
136
- const treeContainer = document.createElement('div');
137
- treeContainer.classList.add('tree');
138
- container.appendChild(treeContainer);
139
- const options = {
140
- sorter: new Sorter(),
141
- accessibilityProvider: new AccessibilityProvider(() => this._direction),
142
- identityProvider: new IdentityProvider(() => this._direction),
143
- expandOnlyOnTwistieClick: true,
144
- overrideStyles: {
145
- listBackground: peekViewResultsBackground
146
- }
147
- };
148
- this._tree = this._instantiationService.createInstance(TypeHierarchyTree, 'TypeHierarchyPeek', treeContainer, new VirtualDelegate(), [this._instantiationService.createInstance(TypeRenderer)], this._instantiationService.createInstance(DataSource, () => this._direction), options);
149
- this._splitView.addView({
150
- onDidChange: Event.None,
151
- element: editorContainer,
152
- minimumSize: 200,
153
- maximumSize: Number.MAX_VALUE,
154
- layout: (width) => {
155
- if (this._dim.height) {
156
- this._editor.layout({ height: this._dim.height, width });
157
- }
158
- }
159
- }, Sizing.Distribute);
160
- this._splitView.addView({
161
- onDidChange: Event.None,
162
- element: treeContainer,
163
- minimumSize: 100,
164
- maximumSize: Number.MAX_VALUE,
165
- layout: (width) => {
166
- if (this._dim.height) {
167
- this._tree.layout(this._dim.height, width);
168
- }
169
- }
170
- }, Sizing.Distribute);
171
- this._disposables.add(this._splitView.onDidSashChange(() => {
172
- if (this._dim.width) {
173
- this._layoutInfo.ratio = this._splitView.getViewSize(0) / this._dim.width;
174
- }
175
- }));
176
- this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview, this));
177
- this._disposables.add(this._editor.onMouseDown(e => {
178
- const { event, target } = e;
179
- if (event.detail !== 2) {
180
- return;
181
- }
182
- const [focus] = this._tree.getFocus();
183
- if (!focus) {
184
- return;
185
- }
186
- this.dispose();
187
- this._editorService.openEditor({
188
- resource: focus.item.uri,
189
- options: { selection: target.range }
190
- });
191
- }));
192
- this._disposables.add(this._tree.onMouseDblClick(e => {
193
- if (e.target === TreeMouseEventTarget.Twistie) {
194
- return;
195
- }
196
- if (e.element) {
197
- this.dispose();
198
- this._editorService.openEditor({
199
- resource: e.element.item.uri,
200
- options: { selection: e.element.item.selectionRange, pinned: true }
201
- });
202
- }
203
- }));
204
- this._disposables.add(this._tree.onDidChangeSelection(e => {
205
- const [element] = e.elements;
206
- if (element && isKeyboardEvent(e.browserEvent)) {
207
- this.dispose();
208
- this._editorService.openEditor({
209
- resource: element.item.uri,
210
- options: { selection: element.item.selectionRange, pinned: true }
211
- });
212
- }
213
- }));
214
- }
215
- async _updatePreview() {
216
- const [element] = this._tree.getFocus();
217
- if (!element) {
218
- return;
219
- }
220
- this._previewDisposable.clear();
221
- const options = {
222
- description: 'type-hierarchy-decoration',
223
- stickiness: 1 ,
224
- className: 'type-decoration',
225
- overviewRuler: {
226
- color: themeColorFromId(peekViewEditorMatchHighlight),
227
- position: OverviewRulerLane.Center
228
- },
229
- };
230
- let previewUri;
231
- if (this._direction === "supertypes" ) {
232
- previewUri = element.parent ? element.parent.item.uri : element.model.root.uri;
233
- }
234
- else {
235
- previewUri = element.item.uri;
236
- }
237
- const value = await this._textModelService.createModelReference(previewUri);
238
- this._editor.setModel(value.object.textEditorModel);
239
- const decorations = [];
240
- let fullRange;
241
- const loc = { uri: element.item.uri, range: element.item.selectionRange };
242
- if (( loc.uri.toString()) === ( previewUri.toString())) {
243
- decorations.push({ range: loc.range, options });
244
- fullRange = !fullRange ? loc.range : Range.plusRange(loc.range, fullRange);
245
- }
246
- if (fullRange) {
247
- this._editor.revealRangeInCenter(fullRange, 1 );
248
- const decorationsCollection = this._editor.createDecorationsCollection(decorations);
249
- this._previewDisposable.add(toDisposable(() => decorationsCollection.clear()));
250
- }
251
- this._previewDisposable.add(value);
252
- const title = this._direction === "supertypes"
253
- ? ( localizeWithPath(
254
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
255
- 'supertypes',
256
- "Supertypes of '{0}'",
257
- element.model.root.name
258
- ))
259
- : ( localizeWithPath(
260
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
261
- 'subtypes',
262
- "Subtypes of '{0}'",
263
- element.model.root.name
264
- ));
265
- this.setTitle(title);
266
- }
267
- showLoading() {
268
- this._parent.dataset['state'] = "loading" ;
269
- this.setTitle(( localizeWithPath(
270
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
271
- 'title.loading',
272
- "Loading..."
273
- )));
274
- this._show();
275
- }
276
- showMessage(message) {
277
- this._parent.dataset['state'] = "message" ;
278
- this.setTitle('');
279
- this.setMetaTitle('');
280
- this._message.innerText = message;
281
- this._show();
282
- this._message.focus();
283
- }
284
- async showModel(model) {
285
- this._show();
286
- const viewState = this._treeViewStates.get(this._direction);
287
- await this._tree.setInput(model, viewState);
288
- const root = this._tree.getNode(model).children[0];
289
- await this._tree.expand(root.element);
290
- if (root.children.length === 0) {
291
- this.showMessage(this._direction === "supertypes"
292
- ? ( localizeWithPath(
293
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
294
- 'empt.supertypes',
295
- "No supertypes of '{0}'",
296
- model.root.name
297
- ))
298
- : ( localizeWithPath(
299
- 'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
300
- 'empt.subtypes',
301
- "No subtypes of '{0}'",
302
- model.root.name
303
- )));
304
- }
305
- else {
306
- this._parent.dataset['state'] = "data" ;
307
- if (!viewState || this._tree.getFocus().length === 0) {
308
- this._tree.setFocus([root.children[0].element]);
309
- }
310
- this._tree.domFocus();
311
- this._updatePreview();
312
- }
313
- }
314
- getModel() {
315
- return this._tree.getInput();
316
- }
317
- getFocused() {
318
- return this._tree.getFocus()[0];
319
- }
320
- async updateDirection(newDirection) {
321
- const model = this._tree.getInput();
322
- if (model && newDirection !== this._direction) {
323
- this._treeViewStates.set(this._direction, this._tree.getViewState());
324
- this._direction = newDirection;
325
- await this.showModel(model);
326
- }
327
- }
328
- _show() {
329
- if (!this._isShowing) {
330
- this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber, 0 );
331
- super.show(Range.fromPositions(this._where), this._layoutInfo.height);
332
- }
333
- }
334
- _onWidth(width) {
335
- if (this._dim) {
336
- this._doLayoutBody(this._dim.height, width);
337
- }
338
- }
339
- _doLayoutBody(height, width) {
340
- if (this._dim.height !== height || this._dim.width !== width) {
341
- super._doLayoutBody(height, width);
342
- this._dim = ( new Dimension(width, height));
343
- this._layoutInfo.height = this._viewZone ? this._viewZone.heightInLines : this._layoutInfo.height;
344
- this._splitView.layout(width);
345
- this._splitView.resizeView(0, width * this._layoutInfo.ratio);
346
- }
347
- }
348
- };
349
- TypeHierarchyTreePeekWidget = TypeHierarchyTreePeekWidget_1 = ( __decorate([
350
- ( __param(3, IThemeService)),
351
- ( __param(4, IPeekViewService)),
352
- ( __param(5, IEditorService)),
353
- ( __param(6, ITextModelService)),
354
- ( __param(7, IStorageService)),
355
- ( __param(8, IMenuService)),
356
- ( __param(9, IContextKeyService)),
357
- ( __param(10, IInstantiationService))
358
- ], TypeHierarchyTreePeekWidget));
359
-
360
- export { TypeHierarchyTreePeekWidget };