@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,362 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/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/codeEditor/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, peekViewResultsBackground, peekViewEditorMatchHighlight, 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 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
17
|
+
import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
|
|
18
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
19
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
20
|
+
import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
21
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
22
|
+
import { themeColorFromId } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
23
|
+
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
24
|
+
import { Sorter, AccessibilityProvider, IdentityProvider, VirtualDelegate, TypeRenderer, DataSource } from './typeHierarchyTree.js';
|
|
25
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
26
|
+
|
|
27
|
+
var TypeHierarchyTreePeekWidget_1;
|
|
28
|
+
class LayoutInfo {
|
|
29
|
+
static store(info, storageService) {
|
|
30
|
+
storageService.store('typeHierarchyPeekLayout', JSON.stringify(info), 0 , 1 );
|
|
31
|
+
}
|
|
32
|
+
static retrieve(storageService) {
|
|
33
|
+
const value = storageService.get('typeHierarchyPeekLayout', 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 TypeHierarchyTree extends WorkbenchAsyncDataTree {
|
|
48
|
+
}
|
|
49
|
+
let TypeHierarchyTreePeekWidget = class TypeHierarchyTreePeekWidget extends PeekViewWidget {
|
|
50
|
+
static { TypeHierarchyTreePeekWidget_1 = this; }
|
|
51
|
+
static { this.TitleMenu = ( new MenuId('typehierarchy/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(TypeHierarchyTreePeekWidget_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('type-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(TypeHierarchyTree, 'TypeHierarchyPeek', treeContainer, new VirtualDelegate(), [this._instantiationService.createInstance(TypeRenderer)], 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: 'type-hierarchy-decoration',
|
|
225
|
+
stickiness: 1 ,
|
|
226
|
+
className: 'type-decoration',
|
|
227
|
+
overviewRuler: {
|
|
228
|
+
color: themeColorFromId(peekViewEditorMatchHighlight),
|
|
229
|
+
position: OverviewRulerLane.Center
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
let previewUri;
|
|
233
|
+
if (this._direction === "supertypes" ) {
|
|
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
|
+
const loc = { uri: element.item.uri, range: element.item.selectionRange };
|
|
244
|
+
if (( loc.uri.toString()) === ( previewUri.toString())) {
|
|
245
|
+
decorations.push({ range: loc.range, options });
|
|
246
|
+
fullRange = !fullRange ? loc.range : Range.plusRange(loc.range, fullRange);
|
|
247
|
+
}
|
|
248
|
+
if (fullRange) {
|
|
249
|
+
this._editor.revealRangeInCenter(fullRange, 1 );
|
|
250
|
+
const decorationsCollection = this._editor.createDecorationsCollection(decorations);
|
|
251
|
+
this._previewDisposable.add(toDisposable(() => decorationsCollection.clear()));
|
|
252
|
+
}
|
|
253
|
+
this._previewDisposable.add(value);
|
|
254
|
+
const title = this._direction === "supertypes"
|
|
255
|
+
? ( localizeWithPath(
|
|
256
|
+
'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
|
|
257
|
+
'supertypes',
|
|
258
|
+
"Supertypes of '{0}'",
|
|
259
|
+
element.model.root.name
|
|
260
|
+
))
|
|
261
|
+
: ( localizeWithPath(
|
|
262
|
+
'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
|
|
263
|
+
'subtypes',
|
|
264
|
+
"Subtypes of '{0}'",
|
|
265
|
+
element.model.root.name
|
|
266
|
+
));
|
|
267
|
+
this.setTitle(title);
|
|
268
|
+
}
|
|
269
|
+
showLoading() {
|
|
270
|
+
this._parent.dataset['state'] = "loading" ;
|
|
271
|
+
this.setTitle(( localizeWithPath(
|
|
272
|
+
'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
|
|
273
|
+
'title.loading',
|
|
274
|
+
"Loading..."
|
|
275
|
+
)));
|
|
276
|
+
this._show();
|
|
277
|
+
}
|
|
278
|
+
showMessage(message) {
|
|
279
|
+
this._parent.dataset['state'] = "message" ;
|
|
280
|
+
this.setTitle('');
|
|
281
|
+
this.setMetaTitle('');
|
|
282
|
+
this._message.innerText = message;
|
|
283
|
+
this._show();
|
|
284
|
+
this._message.focus();
|
|
285
|
+
}
|
|
286
|
+
async showModel(model) {
|
|
287
|
+
this._show();
|
|
288
|
+
const viewState = this._treeViewStates.get(this._direction);
|
|
289
|
+
await this._tree.setInput(model, viewState);
|
|
290
|
+
const root = this._tree.getNode(model).children[0];
|
|
291
|
+
await this._tree.expand(root.element);
|
|
292
|
+
if (root.children.length === 0) {
|
|
293
|
+
this.showMessage(this._direction === "supertypes"
|
|
294
|
+
? ( localizeWithPath(
|
|
295
|
+
'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
|
|
296
|
+
'empt.supertypes',
|
|
297
|
+
"No supertypes of '{0}'",
|
|
298
|
+
model.root.name
|
|
299
|
+
))
|
|
300
|
+
: ( localizeWithPath(
|
|
301
|
+
'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek',
|
|
302
|
+
'empt.subtypes',
|
|
303
|
+
"No subtypes of '{0}'",
|
|
304
|
+
model.root.name
|
|
305
|
+
)));
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
this._parent.dataset['state'] = "data" ;
|
|
309
|
+
if (!viewState || this._tree.getFocus().length === 0) {
|
|
310
|
+
this._tree.setFocus([root.children[0].element]);
|
|
311
|
+
}
|
|
312
|
+
this._tree.domFocus();
|
|
313
|
+
this._updatePreview();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
getModel() {
|
|
317
|
+
return this._tree.getInput();
|
|
318
|
+
}
|
|
319
|
+
getFocused() {
|
|
320
|
+
return this._tree.getFocus()[0];
|
|
321
|
+
}
|
|
322
|
+
async updateDirection(newDirection) {
|
|
323
|
+
const model = this._tree.getInput();
|
|
324
|
+
if (model && newDirection !== this._direction) {
|
|
325
|
+
this._treeViewStates.set(this._direction, this._tree.getViewState());
|
|
326
|
+
this._direction = newDirection;
|
|
327
|
+
await this.showModel(model);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
_show() {
|
|
331
|
+
if (!this._isShowing) {
|
|
332
|
+
this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber, 0 );
|
|
333
|
+
super.show(Range.fromPositions(this._where), this._layoutInfo.height);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
_onWidth(width) {
|
|
337
|
+
if (this._dim) {
|
|
338
|
+
this._doLayoutBody(this._dim.height, width);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
_doLayoutBody(height, width) {
|
|
342
|
+
if (this._dim.height !== height || this._dim.width !== width) {
|
|
343
|
+
super._doLayoutBody(height, width);
|
|
344
|
+
this._dim = ( new Dimension(width, height));
|
|
345
|
+
this._layoutInfo.height = this._viewZone ? this._viewZone.heightInLines : this._layoutInfo.height;
|
|
346
|
+
this._splitView.layout(width);
|
|
347
|
+
this._splitView.resizeView(0, width * this._layoutInfo.ratio);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
TypeHierarchyTreePeekWidget = TypeHierarchyTreePeekWidget_1 = ( __decorate([
|
|
352
|
+
( __param(3, IThemeService)),
|
|
353
|
+
( __param(4, IPeekViewService)),
|
|
354
|
+
( __param(5, IEditorService)),
|
|
355
|
+
( __param(6, ITextModelService)),
|
|
356
|
+
( __param(7, IStorageService)),
|
|
357
|
+
( __param(8, IMenuService)),
|
|
358
|
+
( __param(9, IContextKeyService)),
|
|
359
|
+
( __param(10, IInstantiationService))
|
|
360
|
+
], TypeHierarchyTreePeekWidget));
|
|
361
|
+
|
|
362
|
+
export { TypeHierarchyTreePeekWidget };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { TypeHierarchyModel } from 'vscode/vscode/vs/workbench/contrib/typeHierarchy/common/typeHierarchy';
|
|
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 Type {
|
|
12
|
+
constructor(item, model, parent) {
|
|
13
|
+
this.item = item;
|
|
14
|
+
this.model = model;
|
|
15
|
+
this.parent = parent;
|
|
16
|
+
}
|
|
17
|
+
static compare(a, b) {
|
|
18
|
+
let res = compare(( a.item.uri.toString()), ( b.item.uri.toString()));
|
|
19
|
+
if (res === 0) {
|
|
20
|
+
res = Range.compareRangesUsingStarts(a.item.range, b.item.range);
|
|
21
|
+
}
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
class DataSource {
|
|
26
|
+
constructor(getDirection) {
|
|
27
|
+
this.getDirection = getDirection;
|
|
28
|
+
}
|
|
29
|
+
hasChildren() {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
async getChildren(element) {
|
|
33
|
+
if (element instanceof TypeHierarchyModel) {
|
|
34
|
+
return ( element.roots.map(root => ( new Type(root, element, undefined))));
|
|
35
|
+
}
|
|
36
|
+
const { model, item } = element;
|
|
37
|
+
if (this.getDirection() === "supertypes" ) {
|
|
38
|
+
return ( (await model.provideSupertypes(item, CancellationToken.None)).map(item => {
|
|
39
|
+
return ( new Type(item, model, element));
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return ( (await model.provideSubtypes(item, CancellationToken.None)).map(item => {
|
|
44
|
+
return ( new Type(item, model, element));
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class Sorter {
|
|
50
|
+
compare(element, otherElement) {
|
|
51
|
+
return Type.compare(element, otherElement);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class IdentityProvider {
|
|
55
|
+
constructor(getDirection) {
|
|
56
|
+
this.getDirection = getDirection;
|
|
57
|
+
}
|
|
58
|
+
getId(element) {
|
|
59
|
+
let res = this.getDirection() + JSON.stringify(element.item.uri) + JSON.stringify(element.item.range);
|
|
60
|
+
if (element.parent) {
|
|
61
|
+
res += this.getId(element.parent);
|
|
62
|
+
}
|
|
63
|
+
return res;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class TypeRenderingTemplate {
|
|
67
|
+
constructor(icon, label) {
|
|
68
|
+
this.icon = icon;
|
|
69
|
+
this.label = label;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
class TypeRenderer {
|
|
73
|
+
constructor() {
|
|
74
|
+
this.templateId = TypeRenderer.id;
|
|
75
|
+
}
|
|
76
|
+
static { this.id = 'TypeRenderer'; }
|
|
77
|
+
renderTemplate(container) {
|
|
78
|
+
container.classList.add('typehierarchy-element');
|
|
79
|
+
const icon = document.createElement('div');
|
|
80
|
+
container.appendChild(icon);
|
|
81
|
+
const label = ( new IconLabel(container, { supportHighlights: true }));
|
|
82
|
+
return ( new TypeRenderingTemplate(icon, label));
|
|
83
|
+
}
|
|
84
|
+
renderElement(node, _index, template) {
|
|
85
|
+
const { element, filterData } = node;
|
|
86
|
+
const deprecated = element.item.tags?.includes(1 );
|
|
87
|
+
template.icon.classList.add('inline', ...ThemeIcon.asClassNameArray(SymbolKinds.toIcon(element.item.kind)));
|
|
88
|
+
template.label.setLabel(element.item.name, element.item.detail, { labelEscapeNewLines: true, matches: createMatches(filterData), strikethrough: deprecated });
|
|
89
|
+
}
|
|
90
|
+
disposeTemplate(template) {
|
|
91
|
+
template.label.dispose();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
class VirtualDelegate {
|
|
95
|
+
getHeight(_element) {
|
|
96
|
+
return 22;
|
|
97
|
+
}
|
|
98
|
+
getTemplateId(_element) {
|
|
99
|
+
return TypeRenderer.id;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
class AccessibilityProvider {
|
|
103
|
+
constructor(getDirection) {
|
|
104
|
+
this.getDirection = getDirection;
|
|
105
|
+
}
|
|
106
|
+
getWidgetAriaLabel() {
|
|
107
|
+
return ( localizeWithPath(
|
|
108
|
+
'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree',
|
|
109
|
+
'tree.aria',
|
|
110
|
+
"Type Hierarchy"
|
|
111
|
+
));
|
|
112
|
+
}
|
|
113
|
+
getAriaLabel(element) {
|
|
114
|
+
if (this.getDirection() === "supertypes" ) {
|
|
115
|
+
return ( localizeWithPath(
|
|
116
|
+
'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree',
|
|
117
|
+
'supertypes',
|
|
118
|
+
"supertypes of {0}",
|
|
119
|
+
element.item.name
|
|
120
|
+
));
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
return ( localizeWithPath(
|
|
124
|
+
'vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree',
|
|
125
|
+
'subtypes',
|
|
126
|
+
"subtypes of {0}",
|
|
127
|
+
element.item.name
|
|
128
|
+
));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { AccessibilityProvider, DataSource, IdentityProvider, Sorter, Type, TypeRenderer, VirtualDelegate };
|