@codingame/monaco-vscode-view-common-service-override 4.5.0-improve-code-splitting.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.
- package/assets/fake.html +10 -0
- package/assets/index-no-csp.html +1230 -0
- package/assets/index.html +1231 -0
- package/assets/service-worker.js +457 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.js +5 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +11 -0
- package/package.json +32 -0
- package/tools/editorAssets.js +4 -0
- package/tools/url.js +10 -0
- package/viewCommon.d.ts +5 -0
- package/viewCommon.js +105 -0
- package/vscode/src/vs/base/browser/deviceAccess.js +61 -0
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +180 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +494 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1113 -0
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +12 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +24 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +64 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +907 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +764 -0
- package/vscode/src/vs/workbench/browser/actions/navigationActions.js +301 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +671 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +229 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +606 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +346 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +246 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1403 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +188 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +523 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1030 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +391 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +472 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +68 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +160 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarActions.js +39 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +238 -0
- package/vscode/src/vs/workbench/browser/style.js +54 -0
- package/vscode/src/vs/workbench/browser/window.js +381 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +300 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +367 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +135 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +18 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +146 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +215 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +78 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.js +56 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +63 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +183 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +8 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +147 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +635 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +230 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +75 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +42 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +81 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +350 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +100 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +148 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +106 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +403 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +199 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +41 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +128 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +619 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +161 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +266 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +173 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +195 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +38 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +41 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +283 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +362 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +314 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +96 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +98 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +656 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +65 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +59 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +143 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +121 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +234 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewService.js +45 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +145 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +341 -0
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +186 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorPaneService.js +13 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +676 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1516 -0
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +6 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +527 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +102 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +133 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +603 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/callHierarchy.css.js';
|
|
3
|
+
import { PeekViewWidget, peekViewBorder, peekViewTitleBackground, peekViewTitleForeground, peekViewTitleInfoForeground, peekViewResultsBackground, peekViewEditorMatchHighlight, IPeekViewService } from 'vscode/vscode/vs/editor/contrib/peekView/browser/peekView';
|
|
4
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
6
|
+
import { Sorter, AccessibilityProvider, IdentityProvider, VirtualDelegate, CallRenderer, DataSource } from './callHierarchyTree.js';
|
|
7
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
8
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
9
|
+
import { SplitView, Sizing } from 'vscode/vscode/vs/base/browser/ui/splitview/splitview';
|
|
10
|
+
import { Dimension, isKeyboardEvent } from 'vscode/vscode/vs/base/browser/dom';
|
|
11
|
+
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
12
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
13
|
+
import { EmbeddedCodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/embeddedCodeEditorWidget';
|
|
14
|
+
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
15
|
+
import { DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
16
|
+
import { OverviewRulerLane } from 'vscode/vscode/vs/editor/common/model';
|
|
17
|
+
import { themeColorFromId } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
18
|
+
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
19
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
20
|
+
import { Color } from 'vscode/vscode/vs/base/common/color';
|
|
21
|
+
import { TreeMouseEventTarget } from 'vscode/vscode/vs/base/browser/ui/tree/tree';
|
|
22
|
+
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
23
|
+
import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
|
|
24
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
25
|
+
import { createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
26
|
+
|
|
27
|
+
var CallHierarchyTreePeekWidget_1;
|
|
28
|
+
class LayoutInfo {
|
|
29
|
+
static store(info, storageService) {
|
|
30
|
+
storageService.store('callHierarchyPeekLayout', JSON.stringify(info), 0 , 1 );
|
|
31
|
+
}
|
|
32
|
+
static retrieve(storageService) {
|
|
33
|
+
const value = storageService.get('callHierarchyPeekLayout', 0 , '{}');
|
|
34
|
+
const defaultInfo = { ratio: 0.7, height: 17 };
|
|
35
|
+
try {
|
|
36
|
+
return { ...defaultInfo, ...JSON.parse(value) };
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return defaultInfo;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
constructor(ratio, height) {
|
|
43
|
+
this.ratio = ratio;
|
|
44
|
+
this.height = height;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class CallHierarchyTree extends WorkbenchAsyncDataTree {
|
|
48
|
+
}
|
|
49
|
+
let CallHierarchyTreePeekWidget = class CallHierarchyTreePeekWidget extends PeekViewWidget {
|
|
50
|
+
static { CallHierarchyTreePeekWidget_1 = this; }
|
|
51
|
+
static { this.TitleMenu = ( new MenuId('callhierarchy/title')); }
|
|
52
|
+
constructor(editor, _where, _direction, themeService, _peekViewService, _editorService, _textModelService, _storageService, _menuService, _contextKeyService, _instantiationService) {
|
|
53
|
+
super(editor, { showFrame: true, showArrow: true, isResizeable: true, isAccessible: true }, _instantiationService);
|
|
54
|
+
this._where = _where;
|
|
55
|
+
this._direction = _direction;
|
|
56
|
+
this._peekViewService = _peekViewService;
|
|
57
|
+
this._editorService = _editorService;
|
|
58
|
+
this._textModelService = _textModelService;
|
|
59
|
+
this._storageService = _storageService;
|
|
60
|
+
this._menuService = _menuService;
|
|
61
|
+
this._contextKeyService = _contextKeyService;
|
|
62
|
+
this._instantiationService = _instantiationService;
|
|
63
|
+
this._treeViewStates = ( new Map());
|
|
64
|
+
this._previewDisposable = ( new DisposableStore());
|
|
65
|
+
this.create();
|
|
66
|
+
this._peekViewService.addExclusiveWidget(editor, this);
|
|
67
|
+
this._applyTheme(themeService.getColorTheme());
|
|
68
|
+
this._disposables.add(themeService.onDidColorThemeChange(this._applyTheme, this));
|
|
69
|
+
this._disposables.add(this._previewDisposable);
|
|
70
|
+
}
|
|
71
|
+
dispose() {
|
|
72
|
+
LayoutInfo.store(this._layoutInfo, this._storageService);
|
|
73
|
+
this._splitView.dispose();
|
|
74
|
+
this._tree.dispose();
|
|
75
|
+
this._editor.dispose();
|
|
76
|
+
super.dispose();
|
|
77
|
+
}
|
|
78
|
+
get direction() {
|
|
79
|
+
return this._direction;
|
|
80
|
+
}
|
|
81
|
+
_applyTheme(theme) {
|
|
82
|
+
const borderColor = theme.getColor(peekViewBorder) || Color.transparent;
|
|
83
|
+
this.style({
|
|
84
|
+
arrowColor: borderColor,
|
|
85
|
+
frameColor: borderColor,
|
|
86
|
+
headerBackgroundColor: theme.getColor(peekViewTitleBackground) || Color.transparent,
|
|
87
|
+
primaryHeadingColor: theme.getColor(peekViewTitleForeground),
|
|
88
|
+
secondaryHeadingColor: theme.getColor(peekViewTitleInfoForeground)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
_fillHead(container) {
|
|
92
|
+
super._fillHead(container, true);
|
|
93
|
+
const menu = this._menuService.createMenu(CallHierarchyTreePeekWidget_1.TitleMenu, this._contextKeyService);
|
|
94
|
+
const updateToolbar = () => {
|
|
95
|
+
const actions = [];
|
|
96
|
+
createAndFillInActionBarActions(menu, undefined, actions);
|
|
97
|
+
this._actionbarWidget.clear();
|
|
98
|
+
this._actionbarWidget.push(actions, { label: false, icon: true });
|
|
99
|
+
};
|
|
100
|
+
this._disposables.add(menu);
|
|
101
|
+
this._disposables.add(menu.onDidChange(updateToolbar));
|
|
102
|
+
updateToolbar();
|
|
103
|
+
}
|
|
104
|
+
_fillBody(parent) {
|
|
105
|
+
this._layoutInfo = LayoutInfo.retrieve(this._storageService);
|
|
106
|
+
this._dim = ( new Dimension(0, 0));
|
|
107
|
+
this._parent = parent;
|
|
108
|
+
parent.classList.add('call-hierarchy');
|
|
109
|
+
const message = document.createElement('div');
|
|
110
|
+
message.classList.add('message');
|
|
111
|
+
parent.appendChild(message);
|
|
112
|
+
this._message = message;
|
|
113
|
+
this._message.tabIndex = 0;
|
|
114
|
+
const container = document.createElement('div');
|
|
115
|
+
container.classList.add('results');
|
|
116
|
+
parent.appendChild(container);
|
|
117
|
+
this._splitView = ( new SplitView(container, { orientation: 1 }));
|
|
118
|
+
const editorContainer = document.createElement('div');
|
|
119
|
+
editorContainer.classList.add('editor');
|
|
120
|
+
container.appendChild(editorContainer);
|
|
121
|
+
const editorOptions = {
|
|
122
|
+
scrollBeyondLastLine: false,
|
|
123
|
+
scrollbar: {
|
|
124
|
+
verticalScrollbarSize: 14,
|
|
125
|
+
horizontal: 'auto',
|
|
126
|
+
useShadows: true,
|
|
127
|
+
verticalHasArrows: false,
|
|
128
|
+
horizontalHasArrows: false,
|
|
129
|
+
alwaysConsumeMouseWheel: false
|
|
130
|
+
},
|
|
131
|
+
overviewRulerLanes: 2,
|
|
132
|
+
fixedOverflowWidgets: true,
|
|
133
|
+
minimap: {
|
|
134
|
+
enabled: false
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
this._editor = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, editorContainer, editorOptions, {}, this.editor);
|
|
138
|
+
const treeContainer = document.createElement('div');
|
|
139
|
+
treeContainer.classList.add('tree');
|
|
140
|
+
container.appendChild(treeContainer);
|
|
141
|
+
const options = {
|
|
142
|
+
sorter: new Sorter(),
|
|
143
|
+
accessibilityProvider: new AccessibilityProvider(() => this._direction),
|
|
144
|
+
identityProvider: new IdentityProvider(() => this._direction),
|
|
145
|
+
expandOnlyOnTwistieClick: true,
|
|
146
|
+
overrideStyles: {
|
|
147
|
+
listBackground: peekViewResultsBackground
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
this._tree = this._instantiationService.createInstance(CallHierarchyTree, 'CallHierarchyPeek', treeContainer, new VirtualDelegate(), [this._instantiationService.createInstance(CallRenderer)], this._instantiationService.createInstance(DataSource, () => this._direction), options);
|
|
151
|
+
this._splitView.addView({
|
|
152
|
+
onDidChange: Event.None,
|
|
153
|
+
element: editorContainer,
|
|
154
|
+
minimumSize: 200,
|
|
155
|
+
maximumSize: Number.MAX_VALUE,
|
|
156
|
+
layout: (width) => {
|
|
157
|
+
if (this._dim.height) {
|
|
158
|
+
this._editor.layout({ height: this._dim.height, width });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}, Sizing.Distribute);
|
|
162
|
+
this._splitView.addView({
|
|
163
|
+
onDidChange: Event.None,
|
|
164
|
+
element: treeContainer,
|
|
165
|
+
minimumSize: 100,
|
|
166
|
+
maximumSize: Number.MAX_VALUE,
|
|
167
|
+
layout: (width) => {
|
|
168
|
+
if (this._dim.height) {
|
|
169
|
+
this._tree.layout(this._dim.height, width);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}, Sizing.Distribute);
|
|
173
|
+
this._disposables.add(this._splitView.onDidSashChange(() => {
|
|
174
|
+
if (this._dim.width) {
|
|
175
|
+
this._layoutInfo.ratio = this._splitView.getViewSize(0) / this._dim.width;
|
|
176
|
+
}
|
|
177
|
+
}));
|
|
178
|
+
this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview, this));
|
|
179
|
+
this._disposables.add(this._editor.onMouseDown(e => {
|
|
180
|
+
const { event, target } = e;
|
|
181
|
+
if (event.detail !== 2) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const [focus] = this._tree.getFocus();
|
|
185
|
+
if (!focus) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this.dispose();
|
|
189
|
+
this._editorService.openEditor({
|
|
190
|
+
resource: focus.item.uri,
|
|
191
|
+
options: { selection: target.range }
|
|
192
|
+
});
|
|
193
|
+
}));
|
|
194
|
+
this._disposables.add(this._tree.onMouseDblClick(e => {
|
|
195
|
+
if (e.target === TreeMouseEventTarget.Twistie) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (e.element) {
|
|
199
|
+
this.dispose();
|
|
200
|
+
this._editorService.openEditor({
|
|
201
|
+
resource: e.element.item.uri,
|
|
202
|
+
options: { selection: e.element.item.selectionRange, pinned: true }
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}));
|
|
206
|
+
this._disposables.add(this._tree.onDidChangeSelection(e => {
|
|
207
|
+
const [element] = e.elements;
|
|
208
|
+
if (element && isKeyboardEvent(e.browserEvent)) {
|
|
209
|
+
this.dispose();
|
|
210
|
+
this._editorService.openEditor({
|
|
211
|
+
resource: element.item.uri,
|
|
212
|
+
options: { selection: element.item.selectionRange, pinned: true }
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
async _updatePreview() {
|
|
218
|
+
const [element] = this._tree.getFocus();
|
|
219
|
+
if (!element) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
this._previewDisposable.clear();
|
|
223
|
+
const options = {
|
|
224
|
+
description: 'call-hierarchy-decoration',
|
|
225
|
+
stickiness: 1 ,
|
|
226
|
+
className: 'call-decoration',
|
|
227
|
+
overviewRuler: {
|
|
228
|
+
color: themeColorFromId(peekViewEditorMatchHighlight),
|
|
229
|
+
position: OverviewRulerLane.Center
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
let previewUri;
|
|
233
|
+
if (this._direction === "outgoingCalls" ) {
|
|
234
|
+
previewUri = element.parent ? element.parent.item.uri : element.model.root.uri;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
previewUri = element.item.uri;
|
|
238
|
+
}
|
|
239
|
+
const value = await this._textModelService.createModelReference(previewUri);
|
|
240
|
+
this._editor.setModel(value.object.textEditorModel);
|
|
241
|
+
const decorations = [];
|
|
242
|
+
let fullRange;
|
|
243
|
+
let locations = element.locations;
|
|
244
|
+
if (!locations) {
|
|
245
|
+
locations = [{ uri: element.item.uri, range: element.item.selectionRange }];
|
|
246
|
+
}
|
|
247
|
+
for (const loc of locations) {
|
|
248
|
+
if (( loc.uri.toString()) === ( previewUri.toString())) {
|
|
249
|
+
decorations.push({ range: loc.range, options });
|
|
250
|
+
fullRange = !fullRange ? loc.range : Range.plusRange(loc.range, fullRange);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (fullRange) {
|
|
254
|
+
this._editor.revealRangeInCenter(fullRange, 1 );
|
|
255
|
+
const decorationsCollection = this._editor.createDecorationsCollection(decorations);
|
|
256
|
+
this._previewDisposable.add(toDisposable(() => decorationsCollection.clear()));
|
|
257
|
+
}
|
|
258
|
+
this._previewDisposable.add(value);
|
|
259
|
+
const title = this._direction === "outgoingCalls"
|
|
260
|
+
? ( localizeWithPath(
|
|
261
|
+
'vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek',
|
|
262
|
+
'callFrom',
|
|
263
|
+
"Calls from '{0}'",
|
|
264
|
+
element.model.root.name
|
|
265
|
+
))
|
|
266
|
+
: ( localizeWithPath(
|
|
267
|
+
'vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek',
|
|
268
|
+
'callsTo',
|
|
269
|
+
"Callers of '{0}'",
|
|
270
|
+
element.model.root.name
|
|
271
|
+
));
|
|
272
|
+
this.setTitle(title);
|
|
273
|
+
}
|
|
274
|
+
showLoading() {
|
|
275
|
+
this._parent.dataset['state'] = "loading" ;
|
|
276
|
+
this.setTitle(( localizeWithPath(
|
|
277
|
+
'vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek',
|
|
278
|
+
'title.loading',
|
|
279
|
+
"Loading..."
|
|
280
|
+
)));
|
|
281
|
+
this._show();
|
|
282
|
+
}
|
|
283
|
+
showMessage(message) {
|
|
284
|
+
this._parent.dataset['state'] = "message" ;
|
|
285
|
+
this.setTitle('');
|
|
286
|
+
this.setMetaTitle('');
|
|
287
|
+
this._message.innerText = message;
|
|
288
|
+
this._show();
|
|
289
|
+
this._message.focus();
|
|
290
|
+
}
|
|
291
|
+
async showModel(model) {
|
|
292
|
+
this._show();
|
|
293
|
+
const viewState = this._treeViewStates.get(this._direction);
|
|
294
|
+
await this._tree.setInput(model, viewState);
|
|
295
|
+
const root = this._tree.getNode(model).children[0];
|
|
296
|
+
await this._tree.expand(root.element);
|
|
297
|
+
if (root.children.length === 0) {
|
|
298
|
+
this.showMessage(this._direction === "outgoingCalls"
|
|
299
|
+
? ( localizeWithPath(
|
|
300
|
+
'vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek',
|
|
301
|
+
'empt.callsFrom',
|
|
302
|
+
"No calls from '{0}'",
|
|
303
|
+
model.root.name
|
|
304
|
+
))
|
|
305
|
+
: ( localizeWithPath(
|
|
306
|
+
'vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek',
|
|
307
|
+
'empt.callsTo',
|
|
308
|
+
"No callers of '{0}'",
|
|
309
|
+
model.root.name
|
|
310
|
+
)));
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
this._parent.dataset['state'] = "data" ;
|
|
314
|
+
if (!viewState || this._tree.getFocus().length === 0) {
|
|
315
|
+
this._tree.setFocus([root.children[0].element]);
|
|
316
|
+
}
|
|
317
|
+
this._tree.domFocus();
|
|
318
|
+
this._updatePreview();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
getModel() {
|
|
322
|
+
return this._tree.getInput();
|
|
323
|
+
}
|
|
324
|
+
getFocused() {
|
|
325
|
+
return this._tree.getFocus()[0];
|
|
326
|
+
}
|
|
327
|
+
async updateDirection(newDirection) {
|
|
328
|
+
const model = this._tree.getInput();
|
|
329
|
+
if (model && newDirection !== this._direction) {
|
|
330
|
+
this._treeViewStates.set(this._direction, this._tree.getViewState());
|
|
331
|
+
this._direction = newDirection;
|
|
332
|
+
await this.showModel(model);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
_show() {
|
|
336
|
+
if (!this._isShowing) {
|
|
337
|
+
this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber, 0 );
|
|
338
|
+
super.show(Range.fromPositions(this._where), this._layoutInfo.height);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
_onWidth(width) {
|
|
342
|
+
if (this._dim) {
|
|
343
|
+
this._doLayoutBody(this._dim.height, width);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
_doLayoutBody(height, width) {
|
|
347
|
+
if (this._dim.height !== height || this._dim.width !== width) {
|
|
348
|
+
super._doLayoutBody(height, width);
|
|
349
|
+
this._dim = ( new Dimension(width, height));
|
|
350
|
+
this._layoutInfo.height = this._viewZone ? this._viewZone.heightInLines : this._layoutInfo.height;
|
|
351
|
+
this._splitView.layout(width);
|
|
352
|
+
this._splitView.resizeView(0, width * this._layoutInfo.ratio);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
CallHierarchyTreePeekWidget = CallHierarchyTreePeekWidget_1 = ( __decorate([
|
|
357
|
+
( __param(3, IThemeService)),
|
|
358
|
+
( __param(4, IPeekViewService)),
|
|
359
|
+
( __param(5, IEditorService)),
|
|
360
|
+
( __param(6, ITextModelService)),
|
|
361
|
+
( __param(7, IStorageService)),
|
|
362
|
+
( __param(8, IMenuService)),
|
|
363
|
+
( __param(9, IContextKeyService)),
|
|
364
|
+
( __param(10, IInstantiationService))
|
|
365
|
+
], CallHierarchyTreePeekWidget));
|
|
366
|
+
|
|
367
|
+
export { CallHierarchyTreePeekWidget };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { CallHierarchyModel } from 'vscode/vscode/vs/workbench/contrib/callHierarchy/common/callHierarchy';
|
|
2
|
+
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
3
|
+
import { createMatches } from 'vscode/vscode/vs/base/common/filters';
|
|
4
|
+
import { IconLabel } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabel';
|
|
5
|
+
import { SymbolKinds } from 'vscode/vscode/vs/editor/common/languages';
|
|
6
|
+
import { compare } from 'vscode/vscode/vs/base/common/strings';
|
|
7
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
8
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
9
|
+
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
10
|
+
|
|
11
|
+
class Call {
|
|
12
|
+
constructor(item, locations, model, parent) {
|
|
13
|
+
this.item = item;
|
|
14
|
+
this.locations = locations;
|
|
15
|
+
this.model = model;
|
|
16
|
+
this.parent = parent;
|
|
17
|
+
}
|
|
18
|
+
static compare(a, b) {
|
|
19
|
+
let res = compare(( a.item.uri.toString()), ( b.item.uri.toString()));
|
|
20
|
+
if (res === 0) {
|
|
21
|
+
res = Range.compareRangesUsingStarts(a.item.range, b.item.range);
|
|
22
|
+
}
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class DataSource {
|
|
27
|
+
constructor(getDirection) {
|
|
28
|
+
this.getDirection = getDirection;
|
|
29
|
+
}
|
|
30
|
+
hasChildren() {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
async getChildren(element) {
|
|
34
|
+
if (element instanceof CallHierarchyModel) {
|
|
35
|
+
return ( element.roots.map(root => ( new Call(root, undefined, element, undefined))));
|
|
36
|
+
}
|
|
37
|
+
const { model, item } = element;
|
|
38
|
+
if (this.getDirection() === "outgoingCalls" ) {
|
|
39
|
+
return ( (await model.resolveOutgoingCalls(item, CancellationToken.None)).map(call => {
|
|
40
|
+
return ( new Call(call.to, ( call.fromRanges.map(range => ({ range, uri: item.uri }))), model, element));
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return ( (await model.resolveIncomingCalls(item, CancellationToken.None)).map(call => {
|
|
45
|
+
return ( new Call(call.from, ( call.fromRanges.map(range => ({ range, uri: call.from.uri }))), model, element));
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class Sorter {
|
|
51
|
+
compare(element, otherElement) {
|
|
52
|
+
return Call.compare(element, otherElement);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
class IdentityProvider {
|
|
56
|
+
constructor(getDirection) {
|
|
57
|
+
this.getDirection = getDirection;
|
|
58
|
+
}
|
|
59
|
+
getId(element) {
|
|
60
|
+
let res = this.getDirection() + JSON.stringify(element.item.uri) + JSON.stringify(element.item.range);
|
|
61
|
+
if (element.parent) {
|
|
62
|
+
res += this.getId(element.parent);
|
|
63
|
+
}
|
|
64
|
+
return res;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class CallRenderingTemplate {
|
|
68
|
+
constructor(icon, label) {
|
|
69
|
+
this.icon = icon;
|
|
70
|
+
this.label = label;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
class CallRenderer {
|
|
74
|
+
constructor() {
|
|
75
|
+
this.templateId = CallRenderer.id;
|
|
76
|
+
}
|
|
77
|
+
static { this.id = 'CallRenderer'; }
|
|
78
|
+
renderTemplate(container) {
|
|
79
|
+
container.classList.add('callhierarchy-element');
|
|
80
|
+
const icon = document.createElement('div');
|
|
81
|
+
container.appendChild(icon);
|
|
82
|
+
const label = ( new IconLabel(container, { supportHighlights: true }));
|
|
83
|
+
return ( new CallRenderingTemplate(icon, label));
|
|
84
|
+
}
|
|
85
|
+
renderElement(node, _index, template) {
|
|
86
|
+
const { element, filterData } = node;
|
|
87
|
+
const deprecated = element.item.tags?.includes(1 );
|
|
88
|
+
template.icon.className = '';
|
|
89
|
+
template.icon.classList.add('inline', ...ThemeIcon.asClassNameArray(SymbolKinds.toIcon(element.item.kind)));
|
|
90
|
+
template.label.setLabel(element.item.name, element.item.detail, { labelEscapeNewLines: true, matches: createMatches(filterData), strikethrough: deprecated });
|
|
91
|
+
}
|
|
92
|
+
disposeTemplate(template) {
|
|
93
|
+
template.label.dispose();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
class VirtualDelegate {
|
|
97
|
+
getHeight(_element) {
|
|
98
|
+
return 22;
|
|
99
|
+
}
|
|
100
|
+
getTemplateId(_element) {
|
|
101
|
+
return CallRenderer.id;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
class AccessibilityProvider {
|
|
105
|
+
constructor(getDirection) {
|
|
106
|
+
this.getDirection = getDirection;
|
|
107
|
+
}
|
|
108
|
+
getWidgetAriaLabel() {
|
|
109
|
+
return ( localizeWithPath(
|
|
110
|
+
'vs/workbench/contrib/callHierarchy/browser/callHierarchyTree',
|
|
111
|
+
'tree.aria',
|
|
112
|
+
"Call Hierarchy"
|
|
113
|
+
));
|
|
114
|
+
}
|
|
115
|
+
getAriaLabel(element) {
|
|
116
|
+
if (this.getDirection() === "outgoingCalls" ) {
|
|
117
|
+
return ( localizeWithPath(
|
|
118
|
+
'vs/workbench/contrib/callHierarchy/browser/callHierarchyTree',
|
|
119
|
+
'from',
|
|
120
|
+
"calls from {0}",
|
|
121
|
+
element.item.name
|
|
122
|
+
));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return ( localizeWithPath(
|
|
126
|
+
'vs/workbench/contrib/callHierarchy/browser/callHierarchyTree',
|
|
127
|
+
'to',
|
|
128
|
+
"callers of {0}",
|
|
129
|
+
element.item.name
|
|
130
|
+
));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export { AccessibilityProvider, Call, CallRenderer, DataSource, IdentityProvider, Sorter, VirtualDelegate };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".monaco-workbench .call-hierarchy .message,.monaco-workbench .call-hierarchy .results{display:none}.monaco-workbench .call-hierarchy[data-state=data] .results{display:inherit;height:100%}.monaco-workbench .call-hierarchy[data-state=message] .message{align-items:center;display:flex;height:100%;justify-content:center}.monaco-workbench .call-hierarchy .editor,.monaco-workbench .call-hierarchy .tree{height:100%}.monaco-editor .call-hierarchy .tree{background-color:var(--vscode-peekViewResult-background);color:var(--vscode-peekViewResult-fileForeground)}.monaco-workbench .call-hierarchy .tree .callhierarchy-element{align-items:center;display:flex;flex:1;flex-flow:row nowrap}.monaco-workbench .call-hierarchy .tree .callhierarchy-element .monaco-icon-label{padding-left:4px}.monaco-editor .call-hierarchy .tree .monaco-list:focus .monaco-list-rows>.monaco-list-row.selected:not(.highlighted){background-color:var(--vscode-peekViewResult-selectionBackground);color:var(--vscode-peekViewResult-selectionForeground)!important}.monaco-editor .call-hierarchy .call-decoration{background-color:var(--vscode-peekViewEditor-matchHighlightBackground);border:2px solid var(--vscode-peekViewEditor-matchHighlightBorder);box-sizing:border-box}.monaco-editor .call-hierarchy .editor .monaco-editor .inputarea.ime-input,.monaco-editor .call-hierarchy .editor .monaco-editor .monaco-editor-background{background-color:var(--vscode-peekViewEditor-background)}.monaco-editor .call-hierarchy .editor .monaco-editor .margin{background-color:var(--vscode-peekViewEditorGutter-background)}";
|
|
4
|
+
n(css,{});
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
3
|
+
import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
|
|
4
|
+
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
5
|
+
import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
|
|
6
|
+
import { CustomEditorInputSerializer, ComplexCustomWorkingCopyEditorHandler } from './customEditorInputFactory.js';
|
|
7
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
+
import { WebviewEditor } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditor';
|
|
9
|
+
import { CustomEditorInput } from 'vscode/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput';
|
|
10
|
+
import './customEditors.js';
|
|
11
|
+
|
|
12
|
+
( Registry.as(EditorExtensions.EditorPane))
|
|
13
|
+
.registerEditorPane(EditorPaneDescriptor.create(WebviewEditor, WebviewEditor.ID, 'Webview Editor'), [
|
|
14
|
+
( new SyncDescriptor(CustomEditorInput))
|
|
15
|
+
]);
|
|
16
|
+
( Registry.as(EditorExtensions.EditorFactory))
|
|
17
|
+
.registerEditorSerializer(CustomEditorInputSerializer.ID, CustomEditorInputSerializer);
|
|
18
|
+
registerWorkbenchContribution2(ComplexCustomWorkingCopyEditorHandler.ID, ComplexCustomWorkingCopyEditorHandler, 1 );
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
4
|
+
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
5
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
6
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
|
+
import { CustomEditorInput } from 'vscode/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput';
|
|
8
|
+
import { ICustomEditorService } from 'vscode/vscode/vs/workbench/contrib/customEditor/common/customEditor.service';
|
|
9
|
+
import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
10
|
+
import { IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview.service';
|
|
11
|
+
import { WebviewEditorInputSerializer, reviveWebviewExtensionDescription, restoreWebviewOptions, restoreWebviewContentOptions } from '../../webviewPanel/browser/webviewEditorInputSerializer.js';
|
|
12
|
+
import { IWebviewWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.service';
|
|
13
|
+
import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup.service';
|
|
14
|
+
import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.service';
|
|
15
|
+
|
|
16
|
+
let CustomEditorInputSerializer = class CustomEditorInputSerializer extends WebviewEditorInputSerializer {
|
|
17
|
+
static { this.ID = CustomEditorInput.typeId; }
|
|
18
|
+
constructor(webviewWorkbenchService, _instantiationService, _webviewService) {
|
|
19
|
+
super(webviewWorkbenchService);
|
|
20
|
+
this._instantiationService = _instantiationService;
|
|
21
|
+
this._webviewService = _webviewService;
|
|
22
|
+
}
|
|
23
|
+
serialize(input) {
|
|
24
|
+
const dirty = input.isDirty();
|
|
25
|
+
const data = {
|
|
26
|
+
...this.toJson(input),
|
|
27
|
+
editorResource: input.resource.toJSON(),
|
|
28
|
+
dirty,
|
|
29
|
+
backupId: dirty ? input.backupId : undefined,
|
|
30
|
+
};
|
|
31
|
+
try {
|
|
32
|
+
return JSON.stringify(data);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
fromJson(data) {
|
|
39
|
+
return {
|
|
40
|
+
...super.fromJson(data),
|
|
41
|
+
editorResource: ( URI.from(data.editorResource)),
|
|
42
|
+
dirty: data.dirty,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
deserialize(_instantiationService, serializedEditorInput) {
|
|
46
|
+
const data = this.fromJson(JSON.parse(serializedEditorInput));
|
|
47
|
+
const webview = reviveWebview(this._webviewService, data);
|
|
48
|
+
const customInput = this._instantiationService.createInstance(CustomEditorInput, { resource: data.editorResource, viewType: data.viewType }, webview, { startsDirty: data.dirty, backupId: data.backupId });
|
|
49
|
+
if (typeof data.group === 'number') {
|
|
50
|
+
customInput.updateGroup(data.group);
|
|
51
|
+
}
|
|
52
|
+
return customInput;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
CustomEditorInputSerializer = ( __decorate([
|
|
56
|
+
( __param(0, IWebviewWorkbenchService)),
|
|
57
|
+
( __param(1, IInstantiationService)),
|
|
58
|
+
( __param(2, IWebviewService))
|
|
59
|
+
], CustomEditorInputSerializer));
|
|
60
|
+
function reviveWebview(webviewService, data) {
|
|
61
|
+
const webview = webviewService.createWebviewOverlay({
|
|
62
|
+
providedViewType: data.viewType,
|
|
63
|
+
origin: data.origin,
|
|
64
|
+
title: undefined,
|
|
65
|
+
options: {
|
|
66
|
+
purpose: "customEditor" ,
|
|
67
|
+
enableFindWidget: data.webviewOptions.enableFindWidget,
|
|
68
|
+
retainContextWhenHidden: data.webviewOptions.retainContextWhenHidden,
|
|
69
|
+
},
|
|
70
|
+
contentOptions: data.contentOptions,
|
|
71
|
+
extension: data.extension,
|
|
72
|
+
});
|
|
73
|
+
webview.state = data.state;
|
|
74
|
+
return webview;
|
|
75
|
+
}
|
|
76
|
+
let ComplexCustomWorkingCopyEditorHandler = class ComplexCustomWorkingCopyEditorHandler extends Disposable {
|
|
77
|
+
static { this.ID = 'workbench.contrib.complexCustomWorkingCopyEditorHandler'; }
|
|
78
|
+
constructor(_instantiationService, _workingCopyEditorService, _workingCopyBackupService, _webviewService, _customEditorService
|
|
79
|
+
) {
|
|
80
|
+
super();
|
|
81
|
+
this._instantiationService = _instantiationService;
|
|
82
|
+
this._workingCopyBackupService = _workingCopyBackupService;
|
|
83
|
+
this._webviewService = _webviewService;
|
|
84
|
+
this._register(_workingCopyEditorService.registerHandler(this));
|
|
85
|
+
}
|
|
86
|
+
handles(workingCopy) {
|
|
87
|
+
return workingCopy.resource.scheme === Schemas.vscodeCustomEditor;
|
|
88
|
+
}
|
|
89
|
+
isOpen(workingCopy, editor) {
|
|
90
|
+
if (!this.handles(workingCopy)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (workingCopy.resource.authority === 'jupyter-notebook-ipynb' && editor instanceof NotebookEditorInput) {
|
|
94
|
+
try {
|
|
95
|
+
const data = JSON.parse(workingCopy.resource.query);
|
|
96
|
+
const workingCopyResource = ( URI.from(data));
|
|
97
|
+
return isEqual(workingCopyResource, editor.resource);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (!(editor instanceof CustomEditorInput)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (workingCopy.resource.authority !== editor.viewType.replace(/[^a-z0-9\-_]/gi, '-').toLowerCase()) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
const data = JSON.parse(workingCopy.resource.query);
|
|
111
|
+
const workingCopyResource = ( URI.from(data));
|
|
112
|
+
return isEqual(workingCopyResource, editor.resource);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async createEditor(workingCopy) {
|
|
119
|
+
const backup = await this._workingCopyBackupService.resolve(workingCopy);
|
|
120
|
+
if (!backup?.meta) {
|
|
121
|
+
throw new Error(`No backup found for custom editor: ${workingCopy.resource}`);
|
|
122
|
+
}
|
|
123
|
+
const backupData = backup.meta;
|
|
124
|
+
const extension = reviveWebviewExtensionDescription(backupData.extension?.id, backupData.extension?.location);
|
|
125
|
+
const webview = reviveWebview(this._webviewService, {
|
|
126
|
+
viewType: backupData.viewType,
|
|
127
|
+
origin: backupData.webview.origin,
|
|
128
|
+
webviewOptions: restoreWebviewOptions(backupData.webview.options),
|
|
129
|
+
contentOptions: restoreWebviewContentOptions(backupData.webview.options),
|
|
130
|
+
state: backupData.webview.state,
|
|
131
|
+
extension,
|
|
132
|
+
});
|
|
133
|
+
const editor = this._instantiationService.createInstance(CustomEditorInput, { resource: URI.revive(backupData.editorResource), viewType: backupData.viewType }, webview, { backupId: backupData.backupId });
|
|
134
|
+
editor.updateGroup(0);
|
|
135
|
+
return editor;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
ComplexCustomWorkingCopyEditorHandler = ( __decorate([
|
|
139
|
+
( __param(0, IInstantiationService)),
|
|
140
|
+
( __param(1, IWorkingCopyEditorService)),
|
|
141
|
+
( __param(2, IWorkingCopyBackupService)),
|
|
142
|
+
( __param(3, IWebviewService)),
|
|
143
|
+
( __param(4, ICustomEditorService))
|
|
144
|
+
], ComplexCustomWorkingCopyEditorHandler));
|
|
145
|
+
|
|
146
|
+
export { ComplexCustomWorkingCopyEditorHandler, CustomEditorInputSerializer };
|