@codingame/monaco-vscode-views-service-override 2.1.3 → 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 (108) hide show
  1. package/index.d.ts +11 -9
  2. package/index.js +8 -6
  3. package/package.json +11 -11
  4. package/tools/editor.js +3 -1
  5. package/tools/views.d.ts +102 -0
  6. package/tools/views.js +253 -0
  7. package/views.d.ts +4 -99
  8. package/views.js +52 -280
  9. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  10. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
  11. package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
  12. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
  13. package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
  14. package/vscode/src/vs/base/common/codicons.d.ts +0 -579
  15. package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
  16. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
  17. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
  18. package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
  19. package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
  20. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
  21. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
  22. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
  23. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
  24. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
  25. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
  26. package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
  27. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
  28. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
  29. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
  30. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
  31. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
  32. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
  33. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
  34. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
  35. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
  36. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
  37. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
  38. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
  39. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
  40. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
  41. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
  42. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
  43. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
  44. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
  45. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
  46. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
  47. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
  48. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
  49. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
  50. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
  51. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
  52. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
  53. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
  54. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
  55. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
  56. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
  57. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
  58. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
  59. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
  60. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
  61. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
  62. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
  63. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
  64. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
  65. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
  66. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
  67. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
  68. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
  69. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
  70. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
  71. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
  72. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
  73. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
  74. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
  75. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
  76. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
  77. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
  78. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
  79. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
  80. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
  81. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
  82. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
  83. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
  84. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
  85. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
  86. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
  87. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
  88. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
  89. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
  90. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
  91. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
  92. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
  93. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
  94. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
  95. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
  96. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
  97. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
  98. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
  99. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
  100. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
  101. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
  102. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
  103. package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
  104. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
  105. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
  106. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
  107. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
  108. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
@@ -1,214 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import './media/customEditor.css.js';
3
- import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
4
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
5
- import { Disposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
6
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
7
- import { extname, isEqual } from 'vscode/vscode/vs/base/common/resources';
8
- import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
9
- import { URI } from 'vscode/vscode/vs/base/common/uri';
10
- import { UndoCommand, RedoCommand } from 'vscode/vscode/vs/editor/browser/editorExtensions';
11
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
12
- import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
13
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
14
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
15
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
16
- import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
17
- import { EditorExtensions, DEFAULT_EDITOR_ASSOCIATION } from 'vscode/vscode/vs/workbench/common/editor';
18
- import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
19
- import { CONTEXT_ACTIVE_CUSTOM_EDITOR_ID, CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE, CustomEditorInfoCollection } from 'vscode/vscode/vs/workbench/contrib/customEditor/common/customEditor';
20
- import { CustomEditorModelManager } from '../common/customEditorModelManager.js';
21
- import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
22
- import { RegisteredEditorPriority, IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
23
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
24
- import { ContributedCustomEditors } from '../common/contributedCustomEditors.js';
25
- import { CustomEditorInput } from 'vscode/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput';
26
-
27
- let CustomEditorService = class CustomEditorService extends Disposable {
28
- constructor(contextKeyService, fileService, storageService, editorService, editorGroupService, instantiationService, uriIdentityService, editorResolverService) {
29
- super();
30
- this.editorService = editorService;
31
- this.editorGroupService = editorGroupService;
32
- this.instantiationService = instantiationService;
33
- this.uriIdentityService = uriIdentityService;
34
- this.editorResolverService = editorResolverService;
35
- this._untitledCounter = 0;
36
- this._editorResolverDisposables = this._register(( new DisposableStore()));
37
- this._editorCapabilities = ( new Map());
38
- this._models = ( new CustomEditorModelManager());
39
- this._onDidChangeEditorTypes = this._register(( new Emitter()));
40
- this.onDidChangeEditorTypes = this._onDidChangeEditorTypes.event;
41
- this._fileEditorFactory = ( Registry.as(EditorExtensions.EditorFactory)).getFileEditorFactory();
42
- this._activeCustomEditorId = CONTEXT_ACTIVE_CUSTOM_EDITOR_ID.bindTo(contextKeyService);
43
- this._focusedCustomEditorIsEditable = CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE.bindTo(contextKeyService);
44
- this._contributedEditors = this._register(( new ContributedCustomEditors(storageService)));
45
- this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this));
46
- this._register(this._contributedEditors.onChange(() => {
47
- this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this));
48
- this.updateContexts();
49
- this._onDidChangeEditorTypes.fire();
50
- }));
51
- this._register(this.editorService.onDidActiveEditorChange(() => this.updateContexts()));
52
- this._register(fileService.onDidRunOperation(e => {
53
- if (e.isOperation(2 )) {
54
- this.handleMovedFileInOpenedFileEditors(e.resource, this.uriIdentityService.asCanonicalUri(e.target.resource));
55
- }
56
- }));
57
- const PRIORITY = 105;
58
- this._register(UndoCommand.addImplementation(PRIORITY, 'custom-editor', () => {
59
- return this.withActiveCustomEditor(editor => editor.undo());
60
- }));
61
- this._register(RedoCommand.addImplementation(PRIORITY, 'custom-editor', () => {
62
- return this.withActiveCustomEditor(editor => editor.redo());
63
- }));
64
- this.updateContexts();
65
- }
66
- getEditorTypes() {
67
- return [...this._contributedEditors];
68
- }
69
- withActiveCustomEditor(f) {
70
- const activeEditor = this.editorService.activeEditor;
71
- if (activeEditor instanceof CustomEditorInput) {
72
- const result = f(activeEditor);
73
- if (result) {
74
- return result;
75
- }
76
- return true;
77
- }
78
- return false;
79
- }
80
- registerContributionPoints() {
81
- this._editorResolverDisposables.clear();
82
- for (const contributedEditor of this._contributedEditors) {
83
- for (const globPattern of contributedEditor.selector) {
84
- if (!globPattern.filenamePattern) {
85
- continue;
86
- }
87
- this._editorResolverDisposables.add(this.editorResolverService.registerEditor(globPattern.filenamePattern, {
88
- id: contributedEditor.id,
89
- label: contributedEditor.displayName,
90
- detail: contributedEditor.providerDisplayName,
91
- priority: contributedEditor.priority,
92
- }, {
93
- singlePerResource: () => !this.getCustomEditorCapabilities(contributedEditor.id)?.supportsMultipleEditorsPerDocument ?? true
94
- }, {
95
- createEditorInput: ({ resource }, group) => {
96
- return { editor: CustomEditorInput.create(this.instantiationService, resource, contributedEditor.id, group.id) };
97
- },
98
- createUntitledEditorInput: ({ resource }, group) => {
99
- return { editor: CustomEditorInput.create(this.instantiationService, resource ?? ( URI.from(
100
- { scheme: Schemas.untitled, authority: `Untitled-${this._untitledCounter++}` }
101
- )), contributedEditor.id, group.id) };
102
- },
103
- createDiffEditorInput: (diffEditorInput, group) => {
104
- return { editor: this.createDiffEditorInput(diffEditorInput, contributedEditor.id, group) };
105
- },
106
- }));
107
- }
108
- }
109
- }
110
- createDiffEditorInput(editor, editorID, group) {
111
- const modifiedOverride = CustomEditorInput.create(this.instantiationService, assertIsDefined(editor.modified.resource), editorID, group.id, { customClasses: 'modified' });
112
- const originalOverride = CustomEditorInput.create(this.instantiationService, assertIsDefined(editor.original.resource), editorID, group.id, { customClasses: 'original' });
113
- return this.instantiationService.createInstance(DiffEditorInput, editor.label, editor.description, originalOverride, modifiedOverride, true);
114
- }
115
- get models() { return this._models; }
116
- getCustomEditor(viewType) {
117
- return this._contributedEditors.get(viewType);
118
- }
119
- getContributedCustomEditors(resource) {
120
- return ( new CustomEditorInfoCollection(this._contributedEditors.getContributedEditors(resource)));
121
- }
122
- getUserConfiguredCustomEditors(resource) {
123
- const resourceAssocations = this.editorResolverService.getAssociationsForResource(resource);
124
- return ( new CustomEditorInfoCollection(coalesce(( resourceAssocations
125
- .map(association => this._contributedEditors.get(association.viewType))))));
126
- }
127
- getAllCustomEditors(resource) {
128
- return ( new CustomEditorInfoCollection([
129
- ...this.getUserConfiguredCustomEditors(resource).allEditors,
130
- ...this.getContributedCustomEditors(resource).allEditors,
131
- ]));
132
- }
133
- registerCustomEditorCapabilities(viewType, options) {
134
- if (( this._editorCapabilities.has(viewType))) {
135
- throw new Error(`Capabilities for ${viewType} already set`);
136
- }
137
- this._editorCapabilities.set(viewType, options);
138
- return toDisposable(() => {
139
- this._editorCapabilities.delete(viewType);
140
- });
141
- }
142
- getCustomEditorCapabilities(viewType) {
143
- return this._editorCapabilities.get(viewType);
144
- }
145
- updateContexts() {
146
- const activeEditorPane = this.editorService.activeEditorPane;
147
- const resource = activeEditorPane?.input?.resource;
148
- if (!resource) {
149
- this._activeCustomEditorId.reset();
150
- this._focusedCustomEditorIsEditable.reset();
151
- return;
152
- }
153
- this._activeCustomEditorId.set(activeEditorPane?.input instanceof CustomEditorInput ? activeEditorPane.input.viewType : '');
154
- this._focusedCustomEditorIsEditable.set(activeEditorPane?.input instanceof CustomEditorInput);
155
- }
156
- async handleMovedFileInOpenedFileEditors(oldResource, newResource) {
157
- if (extname(oldResource).toLowerCase() === extname(newResource).toLowerCase()) {
158
- return;
159
- }
160
- const possibleEditors = this.getAllCustomEditors(newResource);
161
- if (!( possibleEditors.allEditors.some(editor => editor.priority !== RegisteredEditorPriority.option))) {
162
- return;
163
- }
164
- const editorsToReplace = ( new Map());
165
- for (const group of this.editorGroupService.groups) {
166
- for (const editor of group.editors) {
167
- if (this._fileEditorFactory.isFileEditor(editor)
168
- && !(editor instanceof CustomEditorInput)
169
- && isEqual(editor.resource, newResource)) {
170
- let entry = editorsToReplace.get(group.id);
171
- if (!entry) {
172
- entry = [];
173
- editorsToReplace.set(group.id, entry);
174
- }
175
- entry.push(editor);
176
- }
177
- }
178
- }
179
- if (!editorsToReplace.size) {
180
- return;
181
- }
182
- for (const [group, entries] of editorsToReplace) {
183
- this.editorService.replaceEditors(( entries.map(editor => {
184
- let replacement;
185
- if (possibleEditors.defaultEditor) {
186
- const viewType = possibleEditors.defaultEditor.id;
187
- replacement = CustomEditorInput.create(this.instantiationService, newResource, viewType, group);
188
- }
189
- else {
190
- replacement = { resource: newResource, options: { override: DEFAULT_EDITOR_ASSOCIATION.id } };
191
- }
192
- return {
193
- editor,
194
- replacement,
195
- options: {
196
- preserveFocus: true,
197
- }
198
- };
199
- })), group);
200
- }
201
- }
202
- };
203
- CustomEditorService = ( __decorate([
204
- ( __param(0, IContextKeyService)),
205
- ( __param(1, IFileService)),
206
- ( __param(2, IStorageService)),
207
- ( __param(3, IEditorService)),
208
- ( __param(4, IEditorGroupsService)),
209
- ( __param(5, IInstantiationService)),
210
- ( __param(6, IUriIdentityService)),
211
- ( __param(7, IEditorResolverService))
212
- ], CustomEditorService));
213
-
214
- export { CustomEditorService };
@@ -1,6 +0,0 @@
1
- import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
-
3
- var css = ".webview.modified{box-shadow:-6px 0 5px -5px var(--vscode-scrollbar-shadow)}";
4
- n(css,{});
5
-
6
- export { css, css as default };
@@ -1,78 +0,0 @@
1
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
2
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
4
- import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
5
- import { CustomEditorInfo } from 'vscode/vscode/vs/workbench/contrib/customEditor/common/customEditor';
6
- import { customEditorsExtensionPoint } from './extensionPoint.js';
7
- import { RegisteredEditorPriority } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
8
-
9
- class ContributedCustomEditors extends Disposable {
10
- static { this.CUSTOM_EDITORS_STORAGE_ID = 'customEditors'; }
11
- static { this.CUSTOM_EDITORS_ENTRY_ID = 'editors'; }
12
- constructor(storageService) {
13
- super();
14
- this._editors = ( new Map());
15
- this._onChange = this._register(( new Emitter()));
16
- this.onChange = this._onChange.event;
17
- this._memento = ( new Memento(ContributedCustomEditors.CUSTOM_EDITORS_STORAGE_ID, storageService));
18
- const mementoObject = this._memento.getMemento(0 , 1 );
19
- for (const info of (mementoObject[ContributedCustomEditors.CUSTOM_EDITORS_ENTRY_ID] || [])) {
20
- this.add(( new CustomEditorInfo(info)));
21
- }
22
- customEditorsExtensionPoint.setHandler(extensions => {
23
- this.update(extensions);
24
- });
25
- }
26
- update(extensions) {
27
- this._editors.clear();
28
- for (const extension of extensions) {
29
- for (const webviewEditorContribution of extension.value) {
30
- this.add(( new CustomEditorInfo({
31
- id: webviewEditorContribution.viewType,
32
- displayName: webviewEditorContribution.displayName,
33
- providerDisplayName: extension.description.isBuiltin ? ( localizeWithPath(
34
- 'vs/workbench/contrib/customEditor/common/contributedCustomEditors',
35
- 'builtinProviderDisplayName',
36
- "Built-in"
37
- )) : extension.description.displayName || extension.description.identifier.value,
38
- selector: webviewEditorContribution.selector || [],
39
- priority: getPriorityFromContribution(webviewEditorContribution, extension.description),
40
- })));
41
- }
42
- }
43
- const mementoObject = this._memento.getMemento(0 , 1 );
44
- mementoObject[ContributedCustomEditors.CUSTOM_EDITORS_ENTRY_ID] = Array.from(( this._editors.values()));
45
- this._memento.saveMemento();
46
- this._onChange.fire();
47
- }
48
- [Symbol.iterator]() {
49
- return ( this._editors.values());
50
- }
51
- get(viewType) {
52
- return this._editors.get(viewType);
53
- }
54
- getContributedEditors(resource) {
55
- return Array.from(( this._editors.values()))
56
- .filter(customEditor => customEditor.matches(resource));
57
- }
58
- add(info) {
59
- if (( this._editors.has(info.id))) {
60
- console.error(`Custom editor with id '${info.id}' already registered`);
61
- return;
62
- }
63
- this._editors.set(info.id, info);
64
- }
65
- }
66
- function getPriorityFromContribution(contribution, extension) {
67
- switch (contribution.priority) {
68
- case RegisteredEditorPriority.default:
69
- case RegisteredEditorPriority.option:
70
- return contribution.priority;
71
- case RegisteredEditorPriority.builtin:
72
- return extension.isBuiltin ? RegisteredEditorPriority.builtin : RegisteredEditorPriority.default;
73
- default:
74
- return RegisteredEditorPriority.default;
75
- }
76
- }
77
-
78
- export { ContributedCustomEditors };
@@ -1,63 +0,0 @@
1
- import { createSingleCallFunction } from 'vscode/vscode/vs/base/common/functional';
2
-
3
- class CustomEditorModelManager {
4
- constructor() {
5
- this._references = ( new Map());
6
- }
7
- async getAllModels(resource) {
8
- const keyStart = `${( resource.toString())}@@@`;
9
- const models = [];
10
- for (const [key, entry] of this._references) {
11
- if (key.startsWith(keyStart) && entry.model) {
12
- models.push(await entry.model);
13
- }
14
- }
15
- return models;
16
- }
17
- async get(resource, viewType) {
18
- const key = this.key(resource, viewType);
19
- const entry = this._references.get(key);
20
- return entry?.model;
21
- }
22
- tryRetain(resource, viewType) {
23
- const key = this.key(resource, viewType);
24
- const entry = this._references.get(key);
25
- if (!entry) {
26
- return undefined;
27
- }
28
- entry.counter++;
29
- return entry.model.then(model => {
30
- return {
31
- object: model,
32
- dispose: createSingleCallFunction(() => {
33
- if (--entry.counter <= 0) {
34
- entry.model.then(x => x.dispose());
35
- this._references.delete(key);
36
- }
37
- }),
38
- };
39
- });
40
- }
41
- add(resource, viewType, model) {
42
- const key = this.key(resource, viewType);
43
- const existing = this._references.get(key);
44
- if (existing) {
45
- throw new Error('Model already exists');
46
- }
47
- this._references.set(key, { viewType, model, counter: 0 });
48
- return this.tryRetain(resource, viewType);
49
- }
50
- disposeAllModelsForView(viewType) {
51
- for (const [key, value] of this._references) {
52
- if (value.viewType === viewType) {
53
- value.model.then(x => x.dispose());
54
- this._references.delete(key);
55
- }
56
- }
57
- }
58
- key(resource, viewType) {
59
- return `${( resource.toString())}@@@${viewType}`;
60
- }
61
- }
62
-
63
- export { CustomEditorModelManager };
@@ -1,119 +0,0 @@
1
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
- import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
3
- import { languagesExtPoint } from 'vscode/vscode/vs/workbench/services/language/common/languageService';
4
-
5
- const Fields = ( Object.freeze({
6
- viewType: 'viewType',
7
- displayName: 'displayName',
8
- selector: 'selector',
9
- priority: 'priority',
10
- }));
11
- const CustomEditorsContribution = {
12
- description: ( localizeWithPath(
13
- 'vs/workbench/contrib/customEditor/common/extensionPoint',
14
- 'contributes.customEditors',
15
- 'Contributed custom editors.'
16
- )),
17
- type: 'array',
18
- defaultSnippets: [{
19
- body: [{
20
- [Fields.viewType]: '$1',
21
- [Fields.displayName]: '$2',
22
- [Fields.selector]: [{
23
- filenamePattern: '$3'
24
- }],
25
- }]
26
- }],
27
- items: {
28
- type: 'object',
29
- required: [
30
- Fields.viewType,
31
- Fields.displayName,
32
- Fields.selector,
33
- ],
34
- properties: {
35
- [Fields.viewType]: {
36
- type: 'string',
37
- markdownDescription: ( localizeWithPath(
38
- 'vs/workbench/contrib/customEditor/common/extensionPoint',
39
- 'contributes.viewType',
40
- 'Identifier for the custom editor. This must be unique across all custom editors, so we recommend including your extension id as part of `viewType`. The `viewType` is used when registering custom editors with `vscode.registerCustomEditorProvider` and in the `onCustomEditor:${id}` [activation event](https://code.visualstudio.com/api/references/activation-events).'
41
- )),
42
- },
43
- [Fields.displayName]: {
44
- type: 'string',
45
- description: ( localizeWithPath(
46
- 'vs/workbench/contrib/customEditor/common/extensionPoint',
47
- 'contributes.displayName',
48
- 'Human readable name of the custom editor. This is displayed to users when selecting which editor to use.'
49
- )),
50
- },
51
- [Fields.selector]: {
52
- type: 'array',
53
- description: ( localizeWithPath(
54
- 'vs/workbench/contrib/customEditor/common/extensionPoint',
55
- 'contributes.selector',
56
- 'Set of globs that the custom editor is enabled for.'
57
- )),
58
- items: {
59
- type: 'object',
60
- defaultSnippets: [{
61
- body: {
62
- filenamePattern: '$1',
63
- }
64
- }],
65
- properties: {
66
- filenamePattern: {
67
- type: 'string',
68
- description: ( localizeWithPath(
69
- 'vs/workbench/contrib/customEditor/common/extensionPoint',
70
- 'contributes.selector.filenamePattern',
71
- 'Glob that the custom editor is enabled for.'
72
- )),
73
- },
74
- }
75
- }
76
- },
77
- [Fields.priority]: {
78
- type: 'string',
79
- markdownDeprecationMessage: ( localizeWithPath(
80
- 'vs/workbench/contrib/customEditor/common/extensionPoint',
81
- 'contributes.priority',
82
- 'Controls if the custom editor is enabled automatically when the user opens a file. This may be overridden by users using the `workbench.editorAssociations` setting.'
83
- )),
84
- enum: [
85
- "default" ,
86
- "option" ,
87
- ],
88
- markdownEnumDescriptions: [
89
- ( localizeWithPath(
90
- 'vs/workbench/contrib/customEditor/common/extensionPoint',
91
- 'contributes.priority.default',
92
- 'The editor is automatically used when the user opens a resource, provided that no other default custom editors are registered for that resource.'
93
- )),
94
- ( localizeWithPath(
95
- 'vs/workbench/contrib/customEditor/common/extensionPoint',
96
- 'contributes.priority.option',
97
- 'The editor is not automatically used when the user opens a resource, but a user can switch to the editor using the `Reopen With` command.'
98
- )),
99
- ],
100
- default: 'default'
101
- }
102
- }
103
- }
104
- };
105
- const customEditorsExtensionPoint = ( ExtensionsRegistry.registerExtensionPoint({
106
- extensionPoint: 'customEditors',
107
- deps: [languagesExtPoint],
108
- jsonSchema: CustomEditorsContribution,
109
- activationEventsGenerator: (contribs, result) => {
110
- for (const contrib of contribs) {
111
- const viewType = contrib[Fields.viewType];
112
- if (viewType) {
113
- result.push(`onCustomEditor:${viewType}`);
114
- }
115
- }
116
- },
117
- }));
118
-
119
- export { customEditorsExtensionPoint };
@@ -1,6 +0,0 @@
1
- import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
2
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
3
- import { externalUriOpenersConfigurationNode } from 'vscode/vscode/vs/workbench/contrib/externalUriOpener/common/configuration';
4
-
5
- ( Registry.as(Extensions.Configuration))
6
- .registerConfiguration(externalUriOpenersConfigurationNode);
@@ -1,79 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { BaseBinaryResourceEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/binaryEditor';
4
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
5
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
6
- import { FileEditorInput } from 'vscode/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput';
7
- import { BINARY_FILE_EDITOR_ID, BINARY_TEXT_FILE_MODE } from 'vscode/vscode/vs/workbench/contrib/files/common/files';
8
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
9
- import { EditorResolution } from 'vscode/vscode/vs/platform/editor/common/editor';
10
- import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
11
- import { isEditorInputWithOptions } from 'vscode/vscode/vs/workbench/common/editor';
12
- import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
13
- import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
14
-
15
- var BinaryFileEditor_1;
16
- let BinaryFileEditor = class BinaryFileEditor extends BaseBinaryResourceEditor {
17
- static { BinaryFileEditor_1 = this; }
18
- static { this.ID = BINARY_FILE_EDITOR_ID; }
19
- constructor(telemetryService, themeService, editorResolverService, storageService, editorGroupService) {
20
- super(BinaryFileEditor_1.ID, {
21
- openInternal: (input, options) => this.openInternal(input, options)
22
- }, telemetryService, themeService, storageService);
23
- this.editorResolverService = editorResolverService;
24
- this.editorGroupService = editorGroupService;
25
- }
26
- async openInternal(input, options) {
27
- if (input instanceof FileEditorInput && this.group?.activeEditor) {
28
- const activeEditor = this.group.activeEditor;
29
- const untypedActiveEditor = activeEditor?.toUntyped();
30
- if (!untypedActiveEditor) {
31
- return;
32
- }
33
- let resolvedEditor = await this.editorResolverService.resolveEditor({
34
- ...untypedActiveEditor,
35
- options: {
36
- ...options,
37
- override: EditorResolution.PICK
38
- }
39
- }, this.group);
40
- if (resolvedEditor === 2 ) {
41
- resolvedEditor = undefined;
42
- }
43
- else if (resolvedEditor === 1 ) {
44
- return;
45
- }
46
- if (isEditorInputWithOptions(resolvedEditor)) {
47
- for (const editor of resolvedEditor.editor instanceof DiffEditorInput ? [resolvedEditor.editor.original, resolvedEditor.editor.modified] : [resolvedEditor.editor]) {
48
- if (editor instanceof FileEditorInput) {
49
- editor.setForceOpenAsText();
50
- editor.setPreferredLanguageId(BINARY_TEXT_FILE_MODE);
51
- }
52
- }
53
- }
54
- await (this.group ?? this.editorGroupService.activeGroup).replaceEditors([{
55
- editor: activeEditor,
56
- replacement: resolvedEditor?.editor ?? input,
57
- options: {
58
- ...(resolvedEditor?.options ?? options)
59
- }
60
- }]);
61
- }
62
- }
63
- getTitle() {
64
- return this.input ? this.input.getName() : ( localizeWithPath(
65
- 'vs/workbench/contrib/files/browser/editors/binaryFileEditor',
66
- 'binaryFileEditor',
67
- "Binary File Viewer"
68
- ));
69
- }
70
- };
71
- BinaryFileEditor = BinaryFileEditor_1 = ( __decorate([
72
- ( __param(0, ITelemetryService)),
73
- ( __param(1, IThemeService)),
74
- ( __param(2, IEditorResolverService)),
75
- ( __param(3, IStorageService)),
76
- ( __param(4, IEditorGroupsService))
77
- ], BinaryFileEditor));
78
-
79
- export { BinaryFileEditor };
@@ -1,74 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
- import { URI } from 'vscode/vscode/vs/base/common/uri';
4
- import { ITextEditorService } from 'vscode/vscode/vs/workbench/services/textfile/common/textEditorService';
5
- import { isEqual } from 'vscode/vscode/vs/base/common/resources';
6
- import { NO_TYPE_ID } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopy';
7
- import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService';
8
- import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
9
-
10
- class FileEditorInputSerializer {
11
- canSerialize(editorInput) {
12
- return true;
13
- }
14
- serialize(editorInput) {
15
- const fileEditorInput = editorInput;
16
- const resource = fileEditorInput.resource;
17
- const preferredResource = fileEditorInput.preferredResource;
18
- const serializedFileEditorInput = {
19
- resourceJSON: resource.toJSON(),
20
- preferredResourceJSON: isEqual(resource, preferredResource) ? undefined : preferredResource,
21
- name: fileEditorInput.getPreferredName(),
22
- description: fileEditorInput.getPreferredDescription(),
23
- encoding: fileEditorInput.getEncoding(),
24
- modeId: fileEditorInput.getPreferredLanguageId()
25
- };
26
- return JSON.stringify(serializedFileEditorInput);
27
- }
28
- deserialize(instantiationService, serializedEditorInput) {
29
- return instantiationService.invokeFunction(accessor => {
30
- const serializedFileEditorInput = JSON.parse(serializedEditorInput);
31
- const resource = URI.revive(serializedFileEditorInput.resourceJSON);
32
- const preferredResource = URI.revive(serializedFileEditorInput.preferredResourceJSON);
33
- const name = serializedFileEditorInput.name;
34
- const description = serializedFileEditorInput.description;
35
- const encoding = serializedFileEditorInput.encoding;
36
- const languageId = serializedFileEditorInput.modeId;
37
- const fileEditorInput = accessor.get(ITextEditorService).createTextEditor({ resource, label: name, description, encoding, languageId, forceFile: true });
38
- if (preferredResource) {
39
- fileEditorInput.setPreferredResource(preferredResource);
40
- }
41
- return fileEditorInput;
42
- });
43
- }
44
- }
45
- let FileEditorWorkingCopyEditorHandler = class FileEditorWorkingCopyEditorHandler extends Disposable {
46
- constructor(workingCopyEditorService, textEditorService, fileService) {
47
- super();
48
- this.textEditorService = textEditorService;
49
- this.fileService = fileService;
50
- this._register(workingCopyEditorService.registerHandler(this));
51
- }
52
- handles(workingCopy) {
53
- return workingCopy.typeId === NO_TYPE_ID && this.fileService.canHandleResource(workingCopy.resource);
54
- }
55
- handlesSync(workingCopy) {
56
- return workingCopy.typeId === NO_TYPE_ID && this.fileService.hasProvider(workingCopy.resource);
57
- }
58
- isOpen(workingCopy, editor) {
59
- if (!this.handlesSync(workingCopy)) {
60
- return false;
61
- }
62
- return isEqual(workingCopy.resource, editor.resource);
63
- }
64
- createEditor(workingCopy) {
65
- return this.textEditorService.createTextEditor({ resource: workingCopy.resource, forceFile: true });
66
- }
67
- };
68
- FileEditorWorkingCopyEditorHandler = ( __decorate([
69
- ( __param(0, IWorkingCopyEditorService)),
70
- ( __param(1, ITextEditorService)),
71
- ( __param(2, IFileService))
72
- ], FileEditorWorkingCopyEditorHandler));
73
-
74
- export { FileEditorInputSerializer, FileEditorWorkingCopyEditorHandler };